curl -sS -X POST "$BMA_BASE_URL/v1/sessions/ses_agray4o575ytrcguudsrm73sbq/resources" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "content-type: application/json" \
-d '{
"type": "file",
"file_id": "file_agray4o575y2lbvsxagpfttmqi",
"mount_path": "/data/q2.csv"
}'{
"type": "file",
"id": "sesrsc_agray4o575y23fldtfrskmoc4e",
"file_id": "file_agray4o575y2lbvsxagpfttmqi",
"mount_path": "/mnt/session/uploads/data/q2.csv",
"created_at": "2026-11-24T08:02:17.551094Z",
"updated_at": "2026-11-24T08:02:17.551094Z"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Add Session Resource
Mounts one more uploaded file in a session and returns the new file resource. The file must exist in the workspace. Without mount_path the file is mounted at /mnt/session/uploads/<file_id>; a mount_path must be a clean absolute path, is placed below /mnt/session/uploads/ (/data.csv becomes /mnt/session/uploads/data.csv) and must not be used by another resource of the session. Only file resources can be added. An archived session answers 409 conflict_error. Not idempotent: every call adds a resource with a new ID.
Authorization: Organization API key (x-api-key: bma_org_v1_…), personal access token (Authorization: Bearer bma_pat_v1_…), OAuth access token or signed-in dashboard session; a user credential names its organization with bma-organization-id. The request acts in one workspace: the one named by bma-workspace-id (or anthropic-workspace-id; when both are sent they must agree), else the credential’s default workspace (an API key’s own workspace, else its organization’s Default workspace), else the only workspace the credential can use. The caller’s workspace role must be admin, developer or operator (viewer is refused); organization owners and admins act as workspace admins in every workspace of their organization.
Limits:
- Request body: at most 4 MiB (4,194,304 bytes).
- A session holds at most 100 resources.
- Rate limit: one request of the organization’s write budget (Rate limits).
Errors (besides the common errors (401 authentication, 429 rate_limited, 500)):
| Status | error.type | error.code | Cause | Fix |
|---|---|---|---|---|
| 400 | invalid_request_error | invalid_field | file_id is missing, mount_path is not a clean absolute path or is already used, the body has a member a file resource does not have, or the session already has 100 resources. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 400 | invalid_request_error | invalid_json | The body cannot be read or is not a JSON object. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 400 | invalid_request_error | organization_required | A user credential (personal access token, OAuth token, dashboard session) names no organization. | Name the organization with the bma-organization-id header. |
| 400 | invalid_request_error | project_required | The credential can use several workspaces and the request names none. | Name the workspace with the bma-workspace-id header. |
| 400 | invalid_request_error | unsupported_session_option | The resource type is not file (for example github_repository). | Correct the request as the message describes and send it again; the same request will keep failing. |
| 400 | invalid_request_error | workspace_id_conflict | bma-workspace-id and anthropic-workspace-id name different workspaces. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 403 | permission_error | permission_denied | The caller’s workspace role is viewer, which may read sessions but not change them. | Use a credential with the required role or access; retrying with the same credential will not help. |
| 404 | not_found_error | file_not_found | The file does not exist in the workspace (also for a memory_store body, which names no file). | Check the ID and the organization or workspace it belongs to; do not retry the same request. |
| 404 | not_found_error | memory_store_not_found | The body is a memory_store resource whose memory_store_id is not a memory store ID. | Check the ID and the organization or workspace it belongs to; do not retry the same request. |
| 413 | request_too_large | request_too_large | The body is larger than 4 MiB. | Reduce the size of the request body or upload in smaller parts. |
curl -sS -X POST "$BMA_BASE_URL/v1/sessions/ses_agray4o575ytrcguudsrm73sbq/resources" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "content-type: application/json" \
-d '{
"type": "file",
"file_id": "file_agray4o575y2lbvsxagpfttmqi",
"mount_path": "/data/q2.csv"
}'{
"type": "file",
"id": "sesrsc_agray4o575y23fldtfrskmoc4e",
"file_id": "file_agray4o575y2lbvsxagpfttmqi",
"mount_path": "/mnt/session/uploads/data/q2.csv",
"created_at": "2026-11-24T08:02:17.551094Z",
"updated_at": "2026-11-24T08:02:17.551094Z"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Path Parameters
Body
Response
Success.
An uploaded file mounted in a session.