← Changelog
NewAPI

Read logged content from code: GET /v1/requests/:id/content

Give a key the new Read logged content permission and it can fetch the prompt and response Log content kept for any request of its project, from a script, a test or an agent. Off by default, and every read is in the audit log under the key.

Tick Read logged content when creating a key on the API Keys page, or send permissions: ["content:read"] to POST /v1/keys; turn it on or off later from the key's Permissions on that page or with PATCH /v1/keys/:id, and rotating a key keeps it. Management keys can't hold it.

The endpoint returns the request body and the response, parsed when they are JSON, with what was cut at 256 KB, their sizes and when the content expires. A key without the permission gets 403 policy_denied; another project's or team's request, one never logged and expired content all get the same 404. Each key can read 60 times a minute.

Logs can now filter on content = logged, with a Logged content view, and mark those requests. Content stays out of receipts, usage and the Logs export.

More in Get a request's content.