Skip to content

API reference ​

The HTTP API the kol CLI and MCP server use. Everything is JSON. Calls that change or read your AIs need a token from the sign-in flow (POST /api/pair, then approve the code in the Kol app, then GET /api/pair/{code}), sent as Authorization: Bearer <token>.

Errors are {"error": "...", "hint": "..."} (hint is optional) with a 4xx or 5xx status.

The full OpenAPI 3.1 spec: openapi.yaml. Load it in any OpenAPI tool to generate a client.

Sign-in ​

POST /api/pair ​

Start signing in · no sign-in needed

Returns a short code to approve in the Kol app (Companions → Creator portal), and a secret deviceCode that only you see. Codes expire after 5 minutes. At most 20 codes per address every 10 minutes.

Body

FieldTypeDescription
clientcliAsk for a CLI sign-in (with a device code).
labelstringWhat is signing in, for example "kol on my-laptop".
json
{
  "client": "cli",
  "label": "kol on my-laptop"
}
StatusMeaning
200A code to approve.
429Too many requests. Wait and try again.

GET /api/pair/{code} ​

Collect the token · no sign-in needed

Poll every 2 seconds until the code is approved. Needs the deviceCode from the start.

ParameterInDescription
codepath
devicequeryThe deviceCode from POST /api/pair.
StatusMeaning
200Approved. Keep the token secret; it works for 90 days.
202Not approved yet. Try again in 2 seconds.
410The code expired, was already used, or the device code is wrong.

GET /api/me ​

Who you are · needs a token

StatusMeaning
200You.
401No token, or it expired or was revoked. Sign in again.

POST /api/logout ​

Sign out · needs a token

The token stops working.

StatusMeaning
200Signed out.
401No token, or it expired or was revoked. Sign in again.

Rules ​

GET /api/schema ​

Allowed values and limits · no sign-in needed

StatusMeaning
200What a draft may contain.

POST /api/validate ​

Check a draft · no sign-in needed

The same check as saving, without saving. problem is a short code, see the Draft schema.

Body

FieldTypeDescription
draft (required)Draft
StatusMeaning
200The result.

AIs ​

GET /api/creations ​

Your AIs · needs a token

StatusMeaning
200Every AI you made.
401No token, or it expired or was revoked. Sign in again.

POST /api/creations ​

Make an AI · needs a token

Saves a new draft. Only you can see it until you publish it. At most 20 per person.

Body

FieldTypeDescription
draft (required)Draft
StatusMeaning
200The AI.
400Something in the request is wrong; error says what.
401No token, or it expired or was revoked. Sign in again.

GET /api/creations/{id} ​

One AI · needs a token

ParameterInDescription
idpathThe AI's ID, like c-1a2b3c4d.
StatusMeaning
200The AI.
404There is no such AI, or it isn't yours (error is "not yours").

PUT /api/creations/{id} ​

Change an AI · needs a token

Saves a new version. If it is published, everyone gets the change on their next call. kind can't change.

ParameterInDescription
idpathThe AI's ID, like c-1a2b3c4d.

Body

FieldTypeDescription
draft (required)Draft
StatusMeaning
200The AI.
400Something in the request is wrong; error says what.
404There is no such AI, or it isn't yours (error is "not yours").

POST /api/creations/{id}/publish ​

Publish or unpublish · needs a token

Puts it in the marketplace (on: true) or takes it out. People who have it keep it.

ParameterInDescription
idpathThe AI's ID, like c-1a2b3c4d.

Body

FieldTypeDescription
on (required)boolean
StatusMeaning
200The AI.
404There is no such AI, or it isn't yours (error is "not yours").

PUT /api/creations/{id}/knowledge ​

Replace its knowledge · needs a token

Replaces everything it knows with these items. Web pages are read once, now. All or nothing: on an error nothing changes. At most 50 items and 40,000 characters in total.

ParameterInDescription
idpathThe AI's ID, like c-1a2b3c4d.

Body

FieldTypeDescription
items (required)array of KnowledgeInput
StatusMeaning
200The AI.
400Something in the request is wrong; error says what.
404There is no such AI, or it isn't yours (error is "not yours").

GET /api/creations/{id}/requests ​

Requests it took · needs a token

Requests callers confirmed and asked it to send you (the requests skill).

ParameterInDescription
idpathThe AI's ID, like c-1a2b3c4d.
StatusMeaning
200Newest first.
404There is no such AI, or it isn't yours (error is "not yours").

Testing ​

POST /api/try ​

Talk to an AI in text · needs a token

The AI's next reply to a conversation, with the same instructions and skills it has in a call. Send a draft (with knowledge) to try something unsaved, or a saved creation ID. With no messages you get its greeting. Tools run in test mode: nothing is delivered. dryRun returns the instructions without calling the AI model.

Runs on your own AI key. At most 120 per hour.

Body

TryRequest

json
{
  "draft": {
    "name": "Kitchen Buddy",
    "tagline": "Cooks with you.",
    "description": "",
    "persona": "You are Kitchen Buddy",
    "a calm home cook.": null,
    "greeting": "",
    "icon": "restaurant",
    "color": "#E8590C",
    "voice": "cedar",
    "price": 0,
    "canAnswerForYou": false,
    "kind": "companion"
  },
  "knowledge": [
    {
      "title": "notes.md",
      "text": "Salt pasta water well."
    }
  ],
  "messages": [
    {
      "role": "user",
      "text": "How much salt goes in pasta water?"
    }
  ]
}
StatusMeaning
200The reply, or with dryRun the instructions.
400Something in the request is wrong; error says what.
402You have no AI key. Add one in the Kol app (Companions → Your AI key).
404There is no such AI, or it isn't yours (error is "not yours").
429Too many requests. Wait and try again.
502The AI model did not answer, or your AI key was rejected.

GET /api/events ​

Live events · needs a token

Server-sent events (text/event-stream): each data: line is one JSON Event. Try-outs, voice tests from the app or portal, and new requests. A comment line every 20 seconds keeps it open.

StatusMeaning
200The stream.
401No token, or it expired or was revoked. Sign in again.

Schemas ​

Error ​

FieldTypeDescription
error (required)string
hintstringWhat to do about it.

PairStart ​

FieldTypeDescription
code (required)string6 characters to approve in the Kol app.
link (required)stringThe same code as a link the phone can open (for a QR code).
expiresInSec (required)integer
deviceCodestringOnly with client "cli": the secret needed to collect the token. Never show it to anyone.

PairDone ​

FieldTypeDescription
token (required)stringSend as Authorization Bearer.
me (required)Person
expiresAtstring

Person ​

FieldTypeDescription
idstringYour 6-character Kol ID.
namestring

Me ​

Everything in Person, plus:

FieldTypeDescription
accessobjectWho pays for your try-outs and your public AIs' calls.

Rules ​

FieldTypeDescription
iconsarray of string
colorsarray of string
voicesarray of string
pricesarray of number
limitsobject
kindsarray of string

Draft ​

What you fill in. The kol CLI makes this from kol.json and persona.md. Problem codes from validation: name, tagline (missing), persona (under 20 characters), too long, look (icon, color or voice not allowed), price, kind, requestWhat (requests on but nothing listed), malformed (a field missing or the wrong type).

FieldTypeDescription
name (required)string
tagline (required)string
description (required)string
persona (required)stringIts instructions.
greeting (required)stringFirst words. {owner} is replaced by the name of who it talks to.
icon (required)sparkles, chatbubbles, restaurant, school, fitness, heart, musical-notes, book, briefcase, leaf, rocket, happy
color (required)#3B5BDB, #E8590C, #2F9E44, #C2255C, #7048E8, #0C8599, #E67700, #495057
voice (required)marin, cedar, coral, sage, ash, verse, ballad, alloy
price (required)0, 0.99, 1.99, 2.99, 4.99USD a month for a companion; 0 is free.
canAnswerForYou (required)booleanCompanions only. It may answer calls for its owner and take a message.
kindcompanion, service
takesRequestsbooleanThe requests skill.
requestWhatstringWhat a request must include.

Creation ​

FieldTypeDescription
idstring
versionintegerGoes up by one on every change.
draftDraft
publishedboolean
serviceIdstring or nullA service: its Kol ID, once it has been online.
installsintegerPeople who have it (you included).
callsinteger
minutesinteger
requestsinteger
knowledgearray of KnowledgeItem

KnowledgeItem ​

FieldTypeDescription
idstring
kindtext, file, url
titlestring
charsinteger
addedAtstring

KnowledgeInput ​

One of: object · object

Message ​

FieldTypeDescription
role (required)user, assistant
text (required)string

TryRequest ​

FieldTypeDescription
draftDraft
knowledgearray of objectWith draft. Text only (web pages are read when saved).
creationstringA saved AI's ID
messagesarray of MessageThe conversation so far, oldest first. The last one is from the user. Empty for the greeting.
asowner, standInstandIn tries it answering a call for its owner.
dryRunboolean

TryReply ​

FieldTypeDescription
asowner, service, standIn
modelstring
replystring
toolsarray of object

DryRun ​

FieldTypeDescription
asowner, service, standIn
instructionsstringEverything the AI is told.
greetingstring
toolsarray of object

Request ​

FieldTypeDescription
idstring
fromNamestring
atstring
textstring

Event ​

One of: A test or try-out line. · A new request from a caller. · Your AIs changed (in the app or another window).

MIT licensed.