The whole hunk
from line 31, old and new numbered
/
lines
from line 31
3131
3232The session must be `idle` to update the agent. To update the agent while the session is running, send a [`user.interrupt` event](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#integrating-events) by itself and wait for the session to become `idle`.
3333
34<CodeGroup defaultLanguage="CLI">
34<CodeGroup>
3535 ```bash cURL
3636 curl -sS --fail-with-body "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
3737 -H "x-api-key: $ANTHROPIC_API_KEY" \
from line 217
217217
218218## Retrieving a session
219219
220<CodeGroup defaultLanguage="CLI">
220<CodeGroup>
221221 ```bash cURL
222 retrieved=$(curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
222 curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
223223 -H "x-api-key: $ANTHROPIC_API_KEY" \
224224 -H "anthropic-version: 2023-06-01" \
225 -H "anthropic-beta: managed-agents-2026-04-01")
226 echo "Status: $(jq -r '.status' <<< "$retrieved")"
225 -H "anthropic-beta: managed-agents-2026-04-01"
227226 ```
228227
229228 ```bash CLI
from line 276
277276
278277A `page` cursor is opaque and encodes the `order` of the request that produced it. The `order` query parameter sets the sort direction of the results, `asc` or `desc` by creation time; the default is `desc` (newest first). Reusing a cursor with a different `order` returns a 400 error, as does changing a `created_at` filter so that it excludes the cursor's position. Other query parameters, including the remaining filters and `limit`, can change between paginated requests. For the pagination fields shared across list endpoints, see [Pagination](https://platform.claude.com/docs/en/api/overview#pagination).
279278
280<CodeGroup defaultLanguage="CLI">
279<CodeGroup>
281280 ```bash cURL
282281 first_page=$(curl -sS --fail-with-body \
283282 "https://api.anthropic.com/v1/sessions?agent_id=$AGENT_ID&limit=1" \
from line 533
534533
535534Archive a session to prevent new events from being sent while preserving its history. A `running` session cannot be archived; to archive one, send a [`user.interrupt` event](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#integrating-events) by itself and wait for the session to become `idle`.
536535
537<CodeGroup defaultLanguage="CLI">
536<CodeGroup>
538537 ```bash cURL
539538 curl -fsSL -X POST "https://api.anthropic.com/v1/sessions/$SESSION_ID/archive" \
540539 -H "x-api-key: $ANTHROPIC_API_KEY" \
from line 584
585584
586585Memory stores, vaults, skills, environments, and agents are independent resources and are not affected by session deletion. Files you uploaded through the Files API are also unaffected, but files the session itself produced are scoped to it and are permanently deleted along with its filesystem. Download anything you need to keep before deleting the session. An output file written at the end of the last turn can take a few seconds after the session goes idle to appear in the [session's file list](https://platform.claude.com/docs/en/managed-agents/files#listing-and-downloading-session-files), so check that the files you expect are listed first.
587586
588<CodeGroup defaultLanguage="CLI">
587<CodeGroup>
589588 ```bash cURL
590589 curl -fsSL -X DELETE "https://api.anthropic.com/v1/sessions/$SESSION_ID" \
591590 -H "x-api-key: $ANTHROPIC_API_KEY" \