# Use the durable HTTP API

Source: https://usecns.dev/cortex-topic-use-the-durable-http-api/

[Start here](https://usecns.dev/manual-cortex/)
[CLI commands](https://usecns.dev/commands-cortex/)
[Configuration & integration](https://usecns.dev/cortex-topics/)

Use JSON request bodies and `Authorization: Bearer <token>` over a protected connection. Query `token` is also accepted (including WebSocket upgrades), but can leak in URLs/logs. Without a configured master token, a request with no token is authorized in local mode; an explicitly invalid token still fails. Static UI assets, provider webhooks/OAuth callbacks and pairing exchange are dispatched before daemon bearer authentication and have their own validation. Serving the UI is not proof that an API token works.

Most successful reads return 200 JSON. Unmatched routes return 404 `{"error":"Not found","path":"…"}`; unauthenticated API calls return 401 `{"error":"Unauthorized"}`. Explicit role denials return 403. The common handler maps thrown messages containing `busy` to 409, `not found`/`not registered` to 404, and other failures (including many malformed bodies/arguments) to 500 `{"error":"…"}`. Do not assume all invalid arguments produce 400. Pair exchange separately returns 400 with `ok:false`. These are current implementation contracts, not a promise of uniform validation.

In the following table, `S` means `/api/v1/seats/{encodedSeatId}` and `C` means `S/conversations/{positiveConversationId}`. Default-seat equivalents `/api/v1/conversations…` and `/api/v1/tasks/graph` accept optional query `seatId`; they are aliases, not another data store.

* [GET S](https://usecns.dev/cortex-http-use-the-durable-http-api-get-s/)
* [GET S/tasks/graph](https://usecns.dev/cortex-http-use-the-durable-http-api-get-s-tasks-graph/)
* [GET / POST S/conversations](https://usecns.dev/cortex-http-use-the-durable-http-api-get-post-s-conversations/)
* [GET C](https://usecns.dev/cortex-http-use-the-durable-http-api-get-c/)
* [PATCH C/config](https://usecns.dev/cortex-http-use-the-durable-http-api-patch-c-config/)
* [GET C/context](https://usecns.dev/cortex-http-use-the-durable-http-api-get-c-context/)
* [GET C/entries](https://usecns.dev/cortex-http-use-the-durable-http-api-get-c-entries/)
* [POST C/submit](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-submit/)
* [POST C/abort](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-abort/)
* [POST C/compact](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-compact/)
* [POST C/reset](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-reset/)
* [POST C/fork](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-fork/)
* [POST C/classify-system1 or C/system1](https://usecns.dev/cortex-http-use-the-durable-http-api-post-c-classify-system1-or-c-system1/)

For example, after substituting an authorized daemon URL, token, seat and conversation:

```
curl -H "Authorization: Bearer $PI_DURABLE_API_TOKEN" \
  -H 'Content-Type: application/json' \
  "$PI_DURABLE_DAEMON_URL/api/v1/seats/example/conversations/1/submit" \
  -d '{"content":"Report current status without edits","whenBusy":"followUp","wait":false}'
# Accepted shape: {"submissionId":42,"status":...}
```

Use the entry ID for historical context/forking, submission ID for submission cancellation, task ID for task cancellation. They are not interchangeable. A request ID belongs to submission correlation/deduplication, not a replay permission for external effects.