---
# @generated by sylphx-gen. Do not edit.
title: "Upload workspace diff on an agent session"
description: "`agents.agent_sessions.upload_workspace_diff` (POST /v1/{name}:uploadWorkspaceDiff): Uploads a digest-verified patch to the pinned workspace bucket."
type: reference
product: agents
summary: "Uploads a digest-verified patch to the pinned workspace bucket."
nav: false
---

Uploads a digest-verified patch to the pinned workspace bucket.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agent_sessions/agent-session:uploadWorkspaceDiff`
- **Scope** `agents:sessions`
- **Effect** `write` — a successful call changes state.
- **Collection** [agent_sessions](/docs/api/agent_sessions)

## Request

| Field | Type | What it is |
| --- | --- | --- |
| `name` | `string` | Canonical destination Session resource name. Required. |
| `workspace_diff` | `struct` | git_unified_diff_v1 descriptor. bucket_file_key must be transfer/&lt;sha256&gt;.patch. Required. |
| `patch` | `bytes` | Exact nonempty patch bytes, base64 on HTTP, at most 64 KiB. Required. Never returned again. |

## Response

The call answers with an empty object.

## Errors

- [`UNAUTHENTICATED`](/docs/api/errors/UNAUTHENTICATED) — No valid key or token was presented.
- [`PERMISSION_DENIED`](/docs/api/errors/PERMISSION_DENIED) — The key lacks the method's permission.
- [`RESOURCE_NOT_FOUND`](/docs/api/errors/RESOURCE_NOT_FOUND) — The named Resource does not exist or is not visible.
- [`INVALID_FIELD`](/docs/api/errors/INVALID_FIELD) — A field failed validation.
- [`INVALID_STATE`](/docs/api/errors/INVALID_STATE) — The Resource is in a state that forbids the call.

Every error arrives in the body [Errors](/docs/platform/errors) describes.

## Examples

**cURL**

```curl
curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agent_sessions/agent-session:uploadWorkspaceDiff" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"patch":"…","workspace_diff":{}}'
```

**TypeScript**

```ts
const response = await sylphx.agents.agentSessions.uploadWorkspaceDiff({ name: 'orgs/acme/projects/shop/envs/production/agent_sessions/agent-session', patch: '…', workspaceDiff: {} })
```

**Rust**

```rust
let mut req = sylphx::agents::UploadAgentSessionWorkspaceDiffRequest::default();
req.name = "orgs/acme/projects/shop/envs/production/agent_sessions/agent-session".to_string();
req.patch = "…".to_string();
req.workspace_diff = Some(Default::default());
let response = sx.agents().agent_sessions().upload_workspace_diff(req).await?;
```

**CLI**

```bash
sylphx agents agent-sessions upload-workspace-diff orgs/acme/projects/shop/envs/production/agent_sessions/agent-session
```

**MCP**

```json
{ "method_id": "agents.agent_sessions.upload_workspace_diff", "args": {"name":"orgs/acme/projects/shop/envs/production/agent_sessions/agent-session","patch":"…","workspace_diff":{}} }
```
