HTTP API reference
The Kept API lets scripts and apps on the Mac that runs Kept ask questions, search passages and list sources. The API is read-only and returns JSON over HTTP. AI agents can use the MCP server, which shares the same keys and limits.
The API is off by default. Turn it on in Settings → Sharing → Let apps and AI tools on this Mac use Kept.
The base URL is:
http://127.0.0.1:47822/v1The MCP endpoint is separate from /v1: POST /mcp.
Authentication
Every request needs an API key in the Authorization header as a bearer token. Make one key per tool or person in Settings → Sharing so you can revoke one without affecting the others.
- Keys start with
kept_and are 69 characters long. - Kept shows each key once, when you make it, and stores only its SHA-256 hash.
- Revoking a key stops it on the next request.
- Settings shows when each key was last used, updated every few minutes rather than on every request.
A missing or unknown key returns 401 with a WWW-Authenticate: Bearer header.
Send the bearer token as shown in these authenticated requests:
curl http://127.0.0.1:47822/v1/status \
-H "Authorization: Bearer kept_3f9a1c…"Errors
Kept uses ordinary HTTP status codes. Errors have a JSON body with one field, error, a sentence you can show to a person. In every response, Kept omits fields with no value rather than sending them as null.
| Status | Meaning |
|---|---|
200 | OK. |
400 | Bad input: not JSON, a missing field, an empty or too-long question. |
401 | Missing or unknown API key. |
402 | The trial or subscription has ended. Search and ask stop; status and sources still work. |
403 | The API is turned off, the Host isn’t a loopback name, or the request came from a website. |
404 | No such route. |
405 | Wrong method. The Allow header says which one to use. |
413 | The body is larger than 64 KB. |
429 | Rate limit reached for this key. |
500 | Something went wrong inside Kept. |
502 | The AI engine reported a problem. |
503 | Kept’s AI isn’t set up, its engine isn’t running, or its model isn’t installed. |
A request after the free trial ends can return this error:
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"error": "Your free trial has ended. The owner can subscribe at kept.computer; the documents are all still there."
}Rate limits
Each key can make 120 requests a minute, of which 20 can be questions (POST /v1/ask or the MCP ask tool), since each question runs the local model. Give each tool its own key. Over the limit, Kept returns 429; wait a moment and retry.
Other limits
- Request bodies: 64 KB.
- Questions and queries: 2,000 characters.
- Search results: 20 passages.
If a key exceeds the question limit, Kept returns this error body:
{
"error": "Too many questions in the last minute. Wait a moment and try again."
}Get status
GET /v1/statusCheck that Kept is running and your key works. The response includes the team name, source count, model and whether Kept can answer questions right now.
Parameters
None.
Returns
| Attribute | Type | Description |
|---|---|---|
app | string | Always Kept. |
version | string | Kept’s version. |
business | string | The team’s name from Settings → General. May be empty. |
sources | integer | How many sources Kept has. |
chatModel | string, optional | The model that writes answers. |
license | string | The trial or subscription, in words, for example Subscribed · renews by Dec 9, 2026. |
canAsk | boolean | Whether search and ask will work. false after the trial or subscription ends. |
Send an authenticated request to get the current status:
curl http://127.0.0.1:47822/v1/status \
-H "Authorization: Bearer $KEPT_KEY"Example response:
{
"app": "Kept",
"version": "0.1.0",
"business": "Acme Platform",
"sources": 214,
"chatModel": "qwen3.5:9b",
"license": "Subscribed · renews by Dec 9, 2026",
"canAsk": true
}The source object
A source is a document Kept has read.
| Attribute | Type | Description |
|---|---|---|
id | integer | Kept’s ID for the source. |
name | string | The display name, usually the file name. |
type | string | The file type: pdf, docx, rtf, txt, md, html or image. |
category | string, optional | Its category, if it has one. |
status | string | ready (searchable), noText (nothing readable found) or error (couldn’t be read). |
pages | integer, optional | Page count, for paged formats. |
addedAt | string | When it was added, ISO 8601 in UTC. |
Example source object:
{
"id": 42,
"name": "payments-runbook.md",
"type": "md",
"category": "Runbooks",
"status": "ready",
"addedAt": "2026-11-05T12:28:29Z"
}List sources
GET /v1/sourcesList every source Kept has. This endpoint works after the trial or subscription ends.
Parameters
None.
Returns
An object with sources, a list of source objects.
Send an authenticated request to list the sources:
curl http://127.0.0.1:47822/v1/sources \
-H "Authorization: Bearer $KEPT_KEY"Example response (abbreviated):
{
"sources": [
{
"id": 42,
"name": "payments-runbook.md",
"type": "md",
"category": "Runbooks",
"status": "ready",
"addedAt": "2026-11-05T12:28:29Z"
},
…
]
}The passage object
A passage is a short piece of a source, a few paragraphs long, as Kept indexed it.
| Attribute | Type | Description |
|---|---|---|
source | string | The source’s name. |
category | string, optional | The source’s category. |
pageStart, pageEnd | integer, optional | The pages the passage spans, for paged formats. |
heading | string, optional | The nearest heading above the passage. |
text | string | The passage, word for word. |
relevance | number | How close it is to the query in meaning, from 0 to 1. Use it to rank passages rather than as an absolute score. |
Example passage object:
{
"source": "payments-runbook.md",
"category": "Runbooks",
"heading": "Rolling back",
"text": "To roll back, run deploy rollback payments --to previous, then watch the error-rate dashboard for 10 minutes…",
"relevance": 0.812
}Search passages
POST /v1/searchGet the passages most relevant to a query, best first. Search skips answer generation, so use it when your code or model needs the source text directly.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | What to look for. Up to 2,000 characters. |
limit | integer | No | How many passages, from 1 to 20. Default 6. |
Returns
An object with passages, a list of passage objects. Returns 402 after the trial or subscription ends.
Request up to three passages about a payments rollback:
curl http://127.0.0.1:47822/v1/search \
-H "Authorization: Bearer $KEPT_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "payments rollback", "limit": 3}'Example response (abbreviated):
{
"passages": [
{
"source": "payments-runbook.md",
"category": "Runbooks",
"heading": "Rolling back",
"text": "To roll back, run deploy rollback payments --to previous…",
"relevance": 0.812
},
…
]
}The answer object
An answer from your documents, with its citations.
| Attribute | Type | Description |
|---|---|---|
kind | string | grounded when the answer comes from your documents, notFound when they don’t cover the question. |
answer | string | The answer, with [n] markers that match citations. For notFound, a sentence saying so. |
citations | array | The passages the answer relies on. If the model wrote no [n] markers, the array holds the few passages Kept found closest to the question. Treat these as the passages the model read. They don’t show which passage supports each sentence. |
citationsAreExplicit | boolean, from the next release | true when each citation matches an [n] marker in the answer; false when the answer has no markers and citations are the closest passages Kept found. Until the next release, Kept omits this field. Treat a missing field as unknown and check the answer for [n] markers yourself. |
notice | string, optional | A note to show with the answer, when Kept has one. For example, when the question names a category and nothing in it answers, Kept answers from your other documents and says so here. |
pinned | boolean | Only present, and true, when the owner pinned (approved) the answer. Kept serves it without running the model. |
Citation attributes
| Attribute | Type | Description |
|---|---|---|
number | integer | Matches an [n] in the answer, when the answer has markers. |
source | string | The source’s name. |
category | string, optional | The source’s category. |
pageStart, pageEnd | integer, optional | Pages, for paged formats. |
quote | string | The cited passage, or the part of it that matters. |
Example answer object:
{
"kind": "grounded",
"answer": "Roll back with the deploy tool's previous release, then confirm the error rate drops within 10 minutes [1].",
"citations": [
{
"number": 1,
"source": "payments-runbook.md",
"category": "Runbooks",
"quote": "To roll back, run deploy rollback payments --to previous, then watch the error-rate dashboard for 10 minutes."
}
]
}Ask a question
POST /v1/askAsk a question and get an answer from your documents, the same way the app does. A local model writes the answer, so a request takes 5 to 60 seconds. Set your client’s timeout to match. Pinned answers come back at once.
Kept doesn’t save API questions in its history or show them on the Gaps page.
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The question, in plain language. Up to 2,000 characters. |
Returns
An answer object. The request counts toward the 20 questions a minute. Returns 402 after the trial or subscription ends, and 503 if the AI engine isn’t running.
Ask how to roll back a payments deploy:
curl http://127.0.0.1:47822/v1/ask \
-H "Authorization: Bearer $KEPT_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "How do we roll back a payments deploy?"}'Example response:
{
"kind": "grounded",
"answer": "Roll back with the deploy tool's previous release, then confirm the error rate drops within 10 minutes [1].",
"citations": [
{
"number": 1,
"source": "payments-runbook.md",
"category": "Runbooks",
"quote": "To roll back, run deploy rollback payments --to previous…"
}
]
}Security
- Kept listens on
127.0.0.1. Other computers can’t reach port 47822. Hostmust be127.0.0.1,localhostor[::1], which stops DNS rebinding. AnyOriginmust be a loopbackhttp://origin. Browsers can’t sendAuthorizationcross-site without a CORS preflight, which Kept never approves.- Nothing in the API can add, change or delete documents or settings.
- Passages and answers contain your documents’ words. If you pass them to an AI with tools, treat them as untrusted data rather than instructions.
See Privacy and network.