# Upload file bytes

PUT /v1/sessions/{session_id}/files/{file_id}/content: Upload the prepared file's bytes with `Content-Type: application/octet-stream` and a `Content-Length` equal to the prepared `size_bytes`.

PUT<code>/v1/sessions/&#123;session_id&#125;/files/&#123;file_id&#125;/content</code>

Upload the prepared file's bytes with `Content-Type: application/octet-stream` and a `Content-Length` equal to the prepared `size_bytes`. The file becomes `ready` when the digest matches.

Generated from the Platform API specification on 2026-09-04.

## Path parameters

| Parameter | Type | Description |
|---|---|---|
| `session_id` | string | The session, as returned by Create a session. |
| `file_id` | string | The file, as returned by Prepare a file. |

## Headers

| Header | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer` plus a short-lived OAuth access token issued for the Tanomis API audience. Backends obtain tokens with an [organization automation client](/guides/run/authenticate-your-backend); the CLI's human login is not an application credential. |
| `X-Organization-ID` | yes | The `organization_id` from the workspace projection you selected in `GET /v1/me/workspaces`. |
| `X-Workspace-Tenant-ID` | yes | The nested `tenant_id` from the same projection. A header cannot widen what the token grants. Some single-workspace or self-hosted environments take `X-Tenant-ID` instead, as supplied by their administrator. |
| `Content-Type` | yes | Send `application/octet-stream`. |

## Request body

The raw bytes of the file, sent as `application/octet-stream`.

## Responses

| Status | Meaning |
|---|---|
| `200` | The file, now `ready`. |
| `404` | No such prepared file, or attachments are disabled. |
| `409` | The agent version lacks file support, or the bytes did not match the prepared size and digest. |

## Request

```bash
curl -X PUT "https://api.tanomis.com/v1/sessions/ses_7d4f9c/files/file_b172c9/content" \
  -H "Authorization: Bearer $TANOMIS_TOKEN" \
  -H "X-Organization-ID: $TANOMIS_ORG" \
  -H "X-Workspace-Tenant-ID: $TANOMIS_WORKSPACE" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @case-summary.pdf
```

```python
import httpx

response = httpx.put(
    f"https://api.tanomis.com/v1/sessions/{session_id}/files/{file_id}/content",
    headers={
        "Authorization": f"Bearer {token}",
        "X-Organization-ID": organization_id,
        "X-Workspace-Tenant-ID": tenant_id,
        "Content-Type": "application/octet-stream",
    },
    content=open("case-summary.pdf", "rb").read(),
)
response.raise_for_status()
result = response.json()
```

```typescript
const response = await fetch(`https://api.tanomis.com/v1/sessions/${sessionId}/files/${fileId}/content`, {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${token}`,
    "X-Organization-ID": organizationId,
    "X-Workspace-Tenant-ID": tenantId,
    "Content-Type": "application/octet-stream",
  },
  body: await readFile("case-summary.pdf"),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const result = await response.json();
```

## Response

```json title="200 OK"
{
  "id": "file_b172c9",
  "filename": "case-summary.pdf",
  "media_type": "application/pdf",
  "size_bytes": 48213,
  "status": "ready",
  "created_at": "2026-09-02T11:45:00Z"
}
```
