# Keep an editing workspace active

Record explicit editor activity and set an idle timeout of 1–60 minutes. When idleTimeoutMinutes is omitted, the app's idleTimeoutMinutes applies, then 20. Saved source survives runtime termination. Preview polling does not renew this deadline. The worker archives after inactivity and active work has drained; storage failure retains the runtime for recovery.

`POST /api/platform/v1/apps/{appId}/threads/{threadId}/workspace/activity`

Required permission: `thread:update`.

## Parameters

| Name | In | Type | Required | Description |

| --- | --- | --- | --- | --- |

| `appId` | path | `string` | Yes | — |

| `threadId` | path | `string` | Yes | — |

| `Idempotency-Key` | header | `string` | No | Required for service credentials. Retry the same request with the same key. |

## Request body

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `idleTimeoutMinutes` | `integer` | No | min 1, max 60 | — |

```json
{
  "idleTimeoutMinutes": 20
}
```

## Example request

```bash
curl --request POST \
  --url https://api.hoplite.sh/api/platform/v1/apps/appId/threads/threadId/workspace/activity \
  --header "X-Api-Key: $HOPLITE_API_KEY" \
  --header "Idempotency-Key: $HOPLITE_OPERATION_ID" \
  --header 'Content-Type: application/json' \
  --data '{
  "idleTimeoutMinutes": 20
}'
```

## 200 response

Success

Content type: `application/json`. Response type: `object`.

| Field | Type | Required | Constraints | Description |
| --- | --- | --- | --- | --- |
| `ok` | `boolean` | Yes | true | — |
| `policy` | `object` | Yes | — | — |
| `policy.idleTimeoutMinutes` | `integer` | Yes | min -9007199254740991, max 9007199254740991 | — |
| `policy.lastActivityAt` | `string<date-time>` | Yes | — | — |
| `policy.expiresAt` | `string<date-time>` | No | — | — |
| `policy.workspaceStatus` | `string` | No | — | — |

```json

```

## Status codes

- `200` — Success

- `400` — Invalid request

- `401` — Authentication required

- `403` — Permission, app scope or entitlement denied

- `404` — App, source or thread not found

- `409` — Idempotency conflict or request in progress

- `413` — Request too large

- `503` — Source storage or execution unavailable