## API reference

All paths are relative to `https://api.ikawn.com/v1`. Send `Authorization: Bearer …`. Session credentials are scoped to one session.

| Method | Path | Credential | Behavior |
| --- | --- | --- | --- |
| POST | /sessions/{id}/queue | API key or session token | Body: {}. Keep a queued session alive and admit it when its account has capacity. |
| POST | /sessions | API key | Create a connection. Body: capability and optional queue (default true). Requires Idempotency-Key. |
| GET | /usage | API key | Account granted, used, available and overage seconds. |
| GET | /sessions | API key | Latest 50 sessions. Pass next_before as ?before= to paginate. |
| GET | /sessions/{id} | API key or session token | Refresh the session state and provisional usage. |
| POST | /sessions/{id}/heartbeat | API key or session token | Body: {}. Maintain liveness and update usage. |
| POST | /sessions/{id}/connection | API key or session token | Body: {}. Renew credentials for the same session. |
| POST | /sessions/{id}/end | API key or session token | Body: {}. Request shutdown; 200 terminal, 202 ending. |

### Creation results and limits

A new allocation returns 201. An occupied account returns 202 with status queued, a scoped session token, queue position and expiry, and billable false. A replay can return 200 with the existing connection or a terminal session receipt. An allocation still pending returns 409; retry the same queue endpoint or idempotency key. Check the response state before connecting.

Current service limits: 10 creates per minute per key, 30 usage reads per minute per key, 30 session-list reads per minute per key and 60 operations per minute per session. The account concurrency limit is enforced separately; the default is one active session.
