Skip to content
Kept
Connect tools

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/v1

The 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.

StatusMeaning
200OK.
400Bad input: not JSON, a missing field, an empty or too-long question.
401Missing or unknown API key.
402The trial or subscription has ended. Search and ask stop; status and sources still work.
403The API is turned off, the Host isn’t a loopback name, or the request came from a website.
404No such route.
405Wrong method. The Allow header says which one to use.
413The body is larger than 64 KB.
429Rate limit reached for this key.
500Something went wrong inside Kept.
502The AI engine reported a problem.
503Kept’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/status

Check 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

AttributeTypeDescription
appstringAlways Kept.
versionstringKept’s version.
businessstringThe team’s name from Settings → General. May be empty.
sourcesintegerHow many sources Kept has.
chatModelstring, optionalThe model that writes answers.
licensestringThe trial or subscription, in words, for example Subscribed · renews by Dec 9, 2026.
canAskbooleanWhether 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.

AttributeTypeDescription
idintegerKept’s ID for the source.
namestringThe display name, usually the file name.
typestringThe file type: pdf, docx, rtf, txt, md, html or image.
categorystring, optionalIts category, if it has one.
statusstringready (searchable), noText (nothing readable found) or error (couldn’t be read).
pagesinteger, optionalPage count, for paged formats.
addedAtstringWhen 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/sources

List 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.

AttributeTypeDescription
sourcestringThe source’s name.
categorystring, optionalThe source’s category.
pageStart, pageEndinteger, optionalThe pages the passage spans, for paged formats.
headingstring, optionalThe nearest heading above the passage.
textstringThe passage, word for word.
relevancenumberHow 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/search

Get 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

NameTypeRequiredDescription
querystringYesWhat to look for. Up to 2,000 characters.
limitintegerNoHow 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.

AttributeTypeDescription
kindstringgrounded when the answer comes from your documents, notFound when they don’t cover the question.
answerstringThe answer, with [n] markers that match citations. For notFound, a sentence saying so.
citationsarrayThe 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.
citationsAreExplicitboolean, from the next releasetrue 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.
noticestring, optionalA 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.
pinnedbooleanOnly present, and true, when the owner pinned (approved) the answer. Kept serves it without running the model.

Citation attributes

AttributeTypeDescription
numberintegerMatches an [n] in the answer, when the answer has markers.
sourcestringThe source’s name.
categorystring, optionalThe source’s category.
pageStart, pageEndinteger, optionalPages, for paged formats.
quotestringThe 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/ask

Ask 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

NameTypeRequiredDescription
questionstringYesThe 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.
  • Host must be 127.0.0.1, localhost or [::1], which stops DNS rebinding. Any Origin must be a loopback http:// origin. Browsers can’t send Authorization cross-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.