---
title: "Update an agent session"
method: PATCH
path: "/api/v0beta1/sandboxes/{id}/sessions/{sessionId}"
tags: ["Sandboxes"]
---

# Update an agent session

`PATCH /api/v0beta1/sandboxes/{id}/sessions/{sessionId}`

## Path parameters

- `id` string, required
- `sessionId` string, required

## Request body

- UpdateSessionRequest
  - `status` 'active' | 'completed' | 'failed'
  - `metadata` object

## Response `200`

Updated session.

- AgentSessionDetail
  - `session_id` string, required
  - `sandbox_id` string, required
  - `sandbox_name` string, nullable, required
  - `agent` string, required
  - `status` string, required
  - `preview` string, nullable, required
  - `model` string, nullable, required
  - `effort` string, nullable, required
  - `started_at` union, required
    - string
    - string, date-time
  - `ended_at` union, required
    - string
    - string, date-time
    - unknown
  - `created_at` union, required
    - string
    - string, date-time
  - `updated_at` union, required
    - string
    - string, date-time
  - `messages` AgentSessionMessage[], required
    - `role` string, required
    - `content` string, required
    - `timestamp` string, required
    - `is_error` boolean

## Other responses

- `400` — Error
- `401` — Error
- `403` — Error
- `404` — Error

## Changes

- **2026-09-01** `9d2fbb0537d1` — 11 breaking, 1 info
  - the response's body type changed from `object` to no type for status `200`
  - removed the required property `agent_name` from the response with the `200` status
  - removed the required property `created_at` from the response with the `200` status
  - removed the required property `ended_at` from the response with the `200` status
  - …8 more

[Change history](https://skmtc.dev/amika/apis/amika-api/changes/api/v0beta1/sandboxes/:id/sessions/:sessionId/patch.md)

---

[API](https://skmtc.dev/amika/apis/amika-api.md) · [All operations](https://skmtc.dev/amika/apis/amika-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/amika/amika-api/revisions/9d2fbb0537d1/schema)
