List files across the organization's spaces
Read-only gallery of every space of the organization where the caller holds files:read, newest first, paginated with startingAfter + limit across the spaces. Each row follows the rules of its own space: the files of every run there where the caller holds runs:read-all (and the deliverables those runs left behind), otherwise the files of the runs they launched — plus their own chat and container-less files; capabilities.keep / capabilities.delete follow files:delete in the row's space. Each row carries its spaceId; map it to a name with GET /api/spaces. Takes the filters of GET /api/files; a runId or context_chat_session_id resolves only inside the listed spaces. A space the caller holds no role in (a closed space not joined, a private space they are not a member of) contributes nothing, and a credential pinned to a space (a space API key, a space-bound MCP token) reaches that space only. No X-Space-Id: the organization is the path's. An end-user is refused with 403.
/api/orgs/{orgId}/filesCookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.
In: cookie
Path Parameters
Organization ID.
Query Parameters
Filter by file purpose.
"user_upload" | "agent_output"Filter to the files of this run, for a caller who reads it as its container (its launcher, or runs:read-all): those it produced and the inputs it consumed, each input resolved as a file read by id. Anyone else is listed nothing.
Filter to files produced by this agent package.
Filter to files anchored to this chat session.
Filter to the private conversation context: direct attachments plus files produced or consumed by runs launched from the session.
Case-insensitive substring search over document names. Longer than 200 characters is rejected with 400.
length <= 200Keyset cursor — file id to page after (newest-first order).
Page size (1–100, default 20).
201 <= value <= 100curl -X GET "https://your-instance/api/orgs/string/files"{
"object": "list",
"data": [
{
"object": "file",
"id": "string",
"uri": "string",
"purpose": "user_upload",
"spaceId": "string",
"runId": "string",
"chat_session_id": "string",
"packageId": "string",
"name": "string",
"mime": "string",
"size": 0,
"sha256": "string",
"downloadable": true,
"capabilities": {
"visible": true,
"metadata": true,
"download": true,
"preview": true,
"keep": true,
"delete": true
},
"previewable": true,
"preview_kind": "html",
"expiresAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z"
}
],
"hasMore": true
}{
"type": "https://docs.appstrate.dev/errors/validation-failed",
"title": "Validation Failed",
"status": 400,
"detail": "name: Invalid input: expected string, received undefined (+2 more)",
"code": "validation_failed",
"request_id": "req_abc123",
"errors": [
{
"field": "name",
"code": "required",
"message": "Invalid input: expected string, received undefined"
},
{
"field": "email",
"code": "invalid_format",
"message": "Invalid email address"
},
{
"field": "age",
"code": "invalid_type",
"message": "Invalid input: expected number, received string"
}
]
}{
"type": "https://docs.appstrate.dev/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "Invalid or missing session",
"code": "unauthorized",
"request_id": "req_abc123"
}{
"type": "https://docs.appstrate.dev/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "Insufficient permissions",
"code": "forbidden",
"request_id": "req_abc123"
}{
"type": "https://docs.appstrate.dev/errors/rate-limited",
"title": "Rate Limited",
"status": 429,
"detail": "Too many requests. Please try again shortly.",
"code": "rate_limited",
"request_id": "req_abc123",
"retry_after": 30
}