リファレンスHTTP APISession control

Restore from the last committed checkpoint or cancel a pause

POST
/v1/sessions/{id}/resume

Brings a stopped or paused session back to active, or cancels a pause that is still draining. The receipt result is {resulting_admission_state, checkpoint_revision, queued_turn_count}.

  • From stopped: the session is active at once, the next worker restores the last committed checkpoint, queued input is dispatched, and the receipt is succeeded in the response.
  • From paused: the session goes resuming and a new worker restores the pause's checkpoint. The receipt stays accepted until that worker reports ready; then the session is active and the receipt succeeded. If the restore keeps failing, the receipt fails and the session goes recovery_required.
  • From pausing, before the stop is committed: the pause is cancelled (its receipt fails), the session is active again, and this receipt is succeeded. Once the stop is committed the answer is 409 PAUSE_COMMITTING.

Each change is a status event with admission_state on the stream.

Scope: sessions:control (API key or cookie session). Idempotency-Key: required.

Authorization

headerAuthorizationBearer <token>

For servers and scripts: an API key sent as an HTTP bearer token, Bearer <key>. It holds exactly the scopes it was issued with; a key issued before scopes existed holds none. It never needs the CSRF header, and it cannot manage agents, members, teams or API keys. Issue one in the web console under Settings → API keys; each operation names the scope it needs.

Scope: sessions:control

Path Parameters

id*string

The session's id.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Header Parameters

Idempotency-Key*string

Required, 1–255 characters; a UUID per user intent works. A retry with the same key and the same body returns the original response and runs the command once; the same key with a different body answers 409 IDEMPOTENCY_CONFLICT. A missing or invalid key answers 400 BAD_REQUEST, after the body is read.

Length1 <= length <= 255
X-Requested-With?"werft-web"

Required with a cookie session: the literal werft-web.

Value in"werft-web"

Request Body

application/json
  1. body
expected_revision*integer
Range0 <= value <= 2147483647

Response Body

The resume is stored: accepted while a worker restores a paused session, succeeded when it took effect in the request.

application/json
  1. response
receipt_id*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
receipt_status*string
Value in"accepted""succeeded""failed""unknown"
Example Request
curl -X POST 'https://example.com/v1/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08/resume' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "expected_revision": 8}'
Example Response
{  "receipt_id": "c4a1e9d2-7b3f-4e8a-a6c5-1d2e3f4a5b6c",  "receipt_status": "accepted"}