Media

Fetch Stored Media for a Session

Storage and access

Configure media_storage, a supported session database and a persisted run reference to the media. The key must belong to that session and match the stored backend/bucket/region identity. Missing media storage returns 503; RemoteDb returns 501.

Session ownership filtering follows configured user scope: JWT user isolation is opt-in, while non-admin service-account PAT callers self-scope. Scoped access to another user's session returns 404. The key-membership checks still apply to unscoped callers.

Bytes and redirects

The handler downloads the complete body before returning its bytes; it does not stream the storage download incrementally. With redirect=true, it returns 307 only when the backend supplies an HTTP(S) URL. A local file URL or absent URL falls back to the byte response.

Responses use the stored media type after validation. Active content types such as HTML, SVG, JavaScript and XML are served as an application/octet-stream attachment with nosniff. Do not assume the generic JSON response schema describes the returned media body.

GET/sessions/{session_id}/media/{storage_key}

Stream (or, with redirect=true, redirect to a freshly-signed URL for) a piece of media stored in external media storage. Scoped to the caller's session ownership; the storage_key must belong to the session.

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

session_id*Session Id

Session ID the media belongs to

storage_key*Storage Key

Storage key of the media to fetch

Query Parameters

type?|

Session type (agent, team, or workflow). If not provided, auto-detected from session data.

user_id?|

User ID to query session from

db_id?|

Database ID to query session from

table?|

Table to query session from

redirect?Redirect

Redirect to a freshly-signed URL instead of streaming bytes

Defaultfalse

Response Body

application/json

application/json

application/json

curl --request GET 'https://example.com/sessions/string/media/string'
null