---
title: "Set session lifecycle"
url: https://hexelstudio.com/docs/api/titan/administration/lifecycle
---

# Set session lifecycle

**POST** `/titan/admin/sessions/{id}/lifecycle`

Pause, drain, resume or close a runtime session (ses_) or a durable session (dss_, every leg). pause and drain are signals to ACP v1 clients (titan.acp.v1) and restrict nothing: pause holds the client (running work finishes), drain asks it to finish its in-flight work and then close; that close ends the session, and for a leg of a draining durable session the durable session too. resume ends a pause or a drain. close moves the session to its terminal closed state now. pause while draining is 409 SESSION_DRAINING; a session that is no longer live is 409 SESSION_NOT_ACTIVE.

## Path parameters

- `id: string`

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for a member or a service user of your organization (or send a service user's API key as X-API-Key).

- `Titan-Enforcement-Deployment: optional string`

  The enforcement deployment this call acts on (its td-... id). Required on the shared plane, where one Gateway serves many tenants and there is no default: a missing, unknown, repeated or other organization's deployment answers 403, like a failed authorization. Optional on a dedicated cell, which defaults to its one deployment.

## Body parameters

- `action: string`

  One of: `"pause"`, `"drain"`, `"resume"`, `"close"`

- `reason_code: string`

  One of: `"OPERATOR_REQUEST"`, `"SECURITY_INCIDENT"`, `"POLICY_VIOLATION"`

## Returns

`200` Successful response; exact status varies by operation. (`object`)

- `changed: boolean`

- `lifecycle: string`

  One of: `"running"`, `"paused"`, `"draining"`, `"closed"`

- `session_id: string`

## Errors

- `400` Admin error
- `403` Admin error
- `404` Admin error
- `409` Admin error
- `413` Admin error
- `415` Admin error
- `503` Admin error

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/titan/admin/sessions/{id}/lifecycle' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "action": "pause",
  "reason_code": "OPERATOR_REQUEST"
}'
```

### Response (200)

```json
{
  "changed": true,
  "lifecycle": "running",
  "session_id": "string"
}
```

### Response (400)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (403)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (404)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (409)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (413)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (415)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```

### Response (503)

```json
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
```
