API reference
Sessions
Create a session
POST https://antarya.ai/v1/sessions
A session holds the turns of one conversation. Create it, then pass its id as session_id on /v1/chat. The guide shows the whole path.
curl https://antarya.ai/v1/sessions \
-H "Authorization: Bearer $ANTARYA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata": {"matter": "supply-agreement"}}'Output
{
"id": "sess_4f2a9c1e7b3d48a6915e0c2d8f7a6b31",
"object": "session",
"created_at": "2026-11-27T09:30:00Z",
"updated_at": "2026-11-27T09:30:00Z",
"metadata": {"matter": "supply-agreement"}
}| Name | Type | Required | Description |
|---|---|---|---|
metadata | object | No | Up to 16 key and value pairs of your own, such as a matter name. Keys are at most 64 characters and values at most 512. |
The session object
| Name | Type | Required | Description |
|---|---|---|---|
id | text | YesRequired | The id to pass as session_id, such as sess_4f2a9c1e7b3d48a6915e0c2d8f7a6b31. It is `sess_` followed by 32 lowercase hex characters. |
object | text | YesRequired | Always "session". |
created_at | text | YesRequired | When the session was created, as an ISO 8601 time. |
updated_at | text | YesRequired | When a turn was last saved to it, as an ISO 8601 time. |
metadata | object | YesRequired | The pairs you set when you created it. |
messages | array | No | The saved turns, oldest first. Only on a fetch of one session. |
List, fetch and delete
| Request | Does |
|---|---|
GET /v1/sessions |
Lists your sessions, newest first, in pages. |
GET /v1/sessions/{id} |
Returns one session object with its messages. |
DELETE /v1/sessions/{id} |
Deletes the session and the turns stored in it. |
curl "https://antarya.ai/v1/sessions?limit=20" \
-H "Authorization: Bearer $ANTARYA_API_KEY"
# the id comes from the create reply
curl https://antarya.ai/v1/sessions/sess_4f2a9c1e7b3d48a6915e0c2d8f7a6b31 \
-H "Authorization: Bearer $ANTARYA_API_KEY"
curl -X DELETE https://antarya.ai/v1/sessions/sess_4f2a9c1e7b3d48a6915e0c2d8f7a6b31 \
-H "Authorization: Bearer $ANTARYA_API_KEY"Output
{
"id": "sess_4f2a9c1e7b3d48a6915e0c2d8f7a6b31",
"deleted": true
}Paging
A list returns at most limit sessions, newest first. The reply is {"object": "list", "data": [...], "has_more": true}. When has_more is true there is another page: pass the id of the last session you received as after to get it.
| Name | Type | Required | Description |
|---|---|---|---|
limit | number | No | How many sessions to return. The default is 20 and the most is 100. |
after | text | No | A session id. The list continues with the sessions after it. |
Limits
| Limit | Value |
|---|---|
| Sessions an account | 1,000 |
| Who can use a session | Every key on the account |
- Creating a session past 1,000 is a 400
invalid_request: "An account can hold up to 1,000 sessions. Delete one to make room." - A session of another account is a 403
permission_error. An unknown id is a 404not_found. A badafteris a 400. - On success,
/v1/chatsaves the new turns and the reply. A failed or refused request saves nothing. - Management requests share the 60 a minute per key allowance in rate limits.