Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Korey Threads API
description: 'The Korey API is a REST API that lets you build integrations on top of
Korey threads and messages. All requests are made to:
```
https://api.korey.ai/api/v1
```
All endpoints require a Bearer token and return JSON. Get started by creating a personal access token at **Settings → API Tokens**. ## Authentication
All endpoints require a Bearer token passed in the `Authorization` header:
```
Authorization: Bearer kt_pat_
```
Create a personal access token at **Settings → API Tokens**. Each token
carries a set of scopes that gate access to specific endpoints. If a token
lacks the required scope for an endpoint, the response is `403 Forbidden`
with a `required_scope` field indicating what is needed. ## Pagination
List endpoints use **keyset pagination** based on item IDs. Each response
includes `first_id`, `last_id`, and `has_more`. To fetch the next page, pass `?after=` from the previous response. When `has_more` is `false` there are no further pages. The sort order used on the first request must be kept consistent across
all subsequent page requests. Changing `sort_by` or `sort_dir` mid-pagination
will produce unexpected results. Filters are also **not** carried between pages. If you paginate with filters
(e.g. `?owned=true`), pass the same filters on every request. Cursors do not expire — you can resume pagination at any time. ## Thread State Lifecycle
Every thread has a `state` field that indicates whether it is ready to accept
new messages or is currently processing a response. | State | Meaning |
|---|---|
| `ready` | The thread is idle and accepts new messages via `POST /threads/:id/messages` |
| `waiting` | A message has been queued and is awaiting the AI processor |
| `active` | The LLM is actively generating a response |
| `error` | Processing failed; inspect the response for details |
| `interrupted` | Generation was interrupted (e.g. by a conflicting message) |
**You may only send a new message when the thread is in `ready` state.**
Sending while `waiting` or `active` returns `409 Conflict`. The simplest way to know when a thread is `ready` again after sending a message
is to open the SSE stream (`GET /threads/:id/messages/:msg-id/response/stream`)
and wait for the `done` event — it is only emitted after the thread returns to
`ready`. Alternatively, poll `GET /threads/:id` and check the `state` field. ## Feedback
You can rate any AI response with a thumbs up or down via
`POST /threads/:id/messages/:msg-id/feedback`. Optionally include a short
free-text comment. One rating per user per message — submitting again
updates the previous rating. ## Conversational Continuity
Threads are persistent conversations. For multi-turn interactions, reuse the
same thread by sending subsequent messages to
`POST /threads/:thread-id/messages` rather than creating a new thread each
time. Store the `thread_id` from the initial response and pass it to all
follow-up messages. Every thread and message includes an `app_url` field — a direct link to that
item in the Korey web app, useful for surfacing context to users. Set a meaningful `name` when creating a thread. It appears in the Korey UI
and helps users identify the conversation later. ## Error State Recovery
A thread in `error` state is still readable — you can fetch its messages via
`GET /threads/:id/messages` — but it cannot receive new messages. There is
currently no way to resume or reset a thread in `error` state. To continue work after an error, create a new thread and seed it with a
summary of the previous conversation. A useful pattern:
1. Fetch the messages from the errored thread. 2. Summarize the relevant context (e.g. what was being worked on, what was
decided, where it left off). 3. Create a new thread with that summary as the initial message. ## File attachments
To include files in the first message, create a thread with `POST /threads`
without `text`. The response contains `thread_id` and `message_id: null`;
no AI response starts until you send a message.'
version: v1
servers:
- url: https://api.korey.ai/api/v1
description: Current environment
security:
- bearerAuth: []
tags:
# --- truncated at 32 KB (39 KB total) ---
# Full source: https://artifacts.apis.io/korey-ai/openapi/korey-ai-threads-api-openapi.yml