---
# @generated by sylphx-gen. Do not edit.
title: "Handback an agent session"
description: "`agents.agent_sessions.handback` (POST /v1/{name}:handback): Fences an idle Session before returning its public continuity snapshot."
type: reference
product: agents
summary: "Fences an idle Session before returning its public continuity snapshot."
nav: false
---

Fences an idle Session before returning its public continuity snapshot.

- **Path** `POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/agent_sessions/agent-session:handback`
- **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 source Session resource name. Required. |
| `destination_id` | `string` | Stable opaque destination identity (1–128 bytes). Persist it before calling and reuse it after a lost response. A different ID cannot take over. To return to Cloud, adopt into a new Session; this source stays fenced. Required. |

## Response

| Field | Type | What it is |
| --- | --- | --- |
| `snapshot` | `bytes` | UTF-8 public continuity snapshot (base64 on HTTP). Never returned again. |
| `snapshot_sha256` | `string` | Lowercase SHA-256 hex of the exact decoded snapshot bytes. |

## 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:handback" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination_id":"…"}'
```

**TypeScript**

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

**Rust**

```rust
let mut req = sylphx::agents::HandbackAgentSessionRequest::default();
req.destination_id = "…".to_string();
req.name = "orgs/acme/projects/shop/envs/production/agent_sessions/agent-session".to_string();
let response = sx.agents().agent_sessions().handback(req).await?;
```

**CLI**

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

**MCP**

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