Docs / API reference

Log export API

Updated 2026-11-22. Published by PentestLLM.

Route every finished request to the logging stack your security team already runs, and pull the same data as a spreadsheet whenever you need it; both live at https://api.pentestllm.ai/v1. Deliveries leave in batches roughly a minute after a request wraps up. One that fails on a dropped connection, a 408, a 429 or any 5xx is tried three further times, at 10 seconds, then 60 seconds, then 5 minutes; let 50 fail one after another and the destination is turned off with a single email to the account address.

List destinations

GET /v1/exports returns data, one object per destination, each paired with a summary that states the host, an opening slice of a Langfuse public key, or which header names ride along. No stored secret appears in it.

Add a destination

POST /v1/exports expects a kind plus the fields belonging to that kind, and answers 201:

FieldTypeKindNotes
kindstring, requiredallOne of webhook, langfuse or otlp.
namestringall1 to 80 characters.
urlstringwebhookA public https URL that takes the signed POST.
public_keystringlangfuseThe project's public key.
secret_keystringlangfuseThe project's secret key. Encrypted on save, never echoed again.
hoststringlangfuseThe Langfuse host; its managed cloud host unless set.
endpointstringotlpThe OTLP-over-HTTP base URL; the traces path is appended where absent.
headersobjectotlpAs many as 10 headers on each delivery, for instance an API key. Encrypted, names only.
key_idsarray or nullallConfine to these keys' requests; all keys unless set.
include_bodiesbooleanallCarry request bodies for keys that keep them. Off unless set.

A webhook destination takes a signed JSON POST whose body carries the event name, the destination, a timestamp and a data array of events; its signature is an HMAC-SHA256 computed across the timestamp joined to the body, keyed by a webhook_secret this create call returns one time only, and it travels in the delivery’s own headers. A Langfuse destination logs each request as a generation through Langfuse’s OpenTelemetry endpoint, bundled per session. An OTLP destination sends OTLP/HTTP JSON onward to the traces path carrying your headers, a session becoming one trace and every request a span. Nothing in an event identifies the infrastructure behind a call.

An account keeps up to 10 destinations at once; adding an 11th returns 409 limit_reached. A 400 invalid_request means the kind is unknown, the URL is not on public https, a required key is absent, or a key id belongs to a different account, and a console member who is not the owner gets 403 forbidden.

Change or remove a destination

GET /v1/exports/{destination_id} reads a destination together with its last 50 delivery attempts, PATCH /v1/exports/{destination_id} edits its fields (turning a paused one back on clears the failure tally), and DELETE /v1/exports/{destination_id} removes it, so no further batch is sent, including any already waiting in its queue. An unknown destination id gets 404 not_found.

Pull the usage log as CSV

GET /v1/usage/export yields one CSV row for each of the account’s requests inside the from to to window, oldest first, with these columns: request_id, created_at, key_id, session_id, model, outcome, status, input_tokens, cache_read_tokens, cache_write_tokens, output_tokens, charge_usd, latency_ms, refund_reason and user. Narrow it with key_id, model, status and user. Omit from and it opens 30 days before to, which stands at the present unless set; a single file reaches back no further than 92 days and stops at 200,000 rows, and a range whose from is not before to, or that spans more than 92 days, is rejected with 400 invalid_request. The charge_usd column holds the settled amount with no figure typed here.

Example

shell
1curl https://api.pentestllm.ai/v1/exports \
2 -H "Authorization: Bearer sk-ptl-live-…" \
3 -H "Content-Type: application/json" \
4 -d '{"kind": "otlp", "name": "siem", "endpoint": "https://otel.example.org", "headers": {"x-api-key": "..."}}'

Each route on this page takes an admin key from the console.

Questions

How long until a request shows up at my destination?

A batch leaves within roughly a minute of the request finishing. Should a delivery fail on a connection fault, a 408, a 429 or a 5xx, it is repeated three further times, spaced about 10 seconds, a minute, and 5 minutes out.

What if my receiver stays broken?

Fifty failures back to back turn the destination off and send one note to the account address, so a dead receiver neither loops without end nor backs up your other traffic; switch it on again and the tally starts over.

Do prompts and completions leave the gateway?

Only when include_bodies is set, and even then only for keys told to keep bodies. Left off, a destination gets the metadata and token counts, not the message text.

Join on TelegramHelp