Close a capture window now
POST /v1/agents/{agent_id}/capture-windows/{capture_window_id}/close
| Property | Value |
|---|---|
| Operation | close_capture_window |
| Group | Capture windows and reveal grants |
| Scope | agents:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited capture_window.close (mutation) |
| Released in | 1.57.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Closes a scheduled or open window at once (1.57.0): no later Call is made verbose by it, and Calls already admitted keep their capture. A window that is ended or closed answers 409 capture_window_closed.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the agents:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/agents/agt_.../capture-windows/cpw_.../close" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/agents/agt_.../capture-windows/cpw_.../close`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/agents/agt_.../capture-windows/cpw_.../close",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id | path | AgentId | yes | The id of an Agent: agt_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
capture_window_id | path | CaptureWindowId | yes | The id of a verbose capture window on an Agent: cpw_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: CaptureWindowCloseRequest.
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | CaptureWindow | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | capture_window_closed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is CaptureWindow.
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | AgentId | yes | |
agent_version | integer or null | yes | The one version the window captures; null for every version. |
calls_captured | integer | yes | The Calls the window made verbose so far. |
closed_at | Timestamp or null | yes | When a Member closed the window early. |
closed_by | ActorRef or null | yes | |
created_at | Timestamp | yes | |
created_by | ActorRef | yes | |
ends_at | Timestamp | yes | starts_at plus the duration; at most 24 hours later. |
environment | Environment | yes | |
id | CaptureWindowId | yes | |
max_calls | integer | yes | |
object | "capture_window" | yes | |
reason | string or null | no | Why the window is opened, for the access review: free text, stored as a content pair and scrubbed at retention_days. Answered only by GET /v1/agents/{agent_id}/capture-windows/{capture_window_id}, an audited content read; null once scrubbed. |
starts_at | Timestamp | yes | |
status | CaptureWindowStatus | yes |