Skip to content
Kept
Connect AI Coding Tools

HTTP API

Use Kept’s HTTP API to retrieve exact wording from your team’s documents or ask for an answer with citations. In a script, check the HTTP status before interpreting the JSON: a successful response can report that the documents don’t cover a question.

Connect from the Mac running Kept

Use the JSON HTTP API for scripts and apps that run on the Mac hosting Kept. Its base URL is http://127.0.0.1:47822/v1. Port 47822 is loopback-only, even if you turn on the separate HTTPS browser dashboard for colleagues on the office network.

The API is off by default. In Kept, go to Settings → Sharing and turn on Let apps and AI tools on this Mac use Kept. Create a key in Sharing for each caller so you can revoke one without affecting the others. Revocation takes effect on the next request. Set KEPT_KEY in the caller’s environment and send it as Authorization: Bearer $KEPT_KEY on every request. The API is read-only: it can’t add, change or delete documents or settings.

For an AI coding tool, use the MCP server at http://127.0.0.1:47822/mcp. It uses the same keys and limits at a separate endpoint outside /v1.

Check status and list sources

Start with GET /v1/status. It checks that Kept is running and your key works without running the answer model. From the Mac hosting Kept, run:

curl http://127.0.0.1:47822/v1/status \
  -H "Authorization: Bearer $KEPT_KEY"

A successful status request returns a JSON object with these fields:

FieldTypeMeaning
appstringAlways Kept.
versionstringKept’s version.
businessstringTeam name from Settings → General. May be empty.
sourcesintegerNumber of sources.
chatModelstring, optionalModel that writes answers.
licensestringHuman-readable trial or subscription status.
canAskbooleanWhether search and ask are available. false after the trial or subscription ends.

Use GET /v1/sources to inspect individual documents. It returns a JSON object whose sources field is an array of source objects. Both GET routes remain available after the trial or subscription ends.

FieldTypeMeaning
idintegerKept’s ID for the source.
namestringDisplay name, usually the filename.
typestringpdf, docx, rtf, txt, md, html or image.
categorystring, optionalSource category.
statusstringready means searchable, noText means Kept found no readable text, and error means Kept couldn’t read the source.
pagesinteger, optionalPage count for paged formats.
addedAtstringTime the source was added, in ISO 8601 UTC.

Search for passages

Use POST /v1/search when your script needs verbatim text without a generated answer. Send a JSON object with query, a required string of up to 2,000 characters, and optionally limit, an integer from 1 to 20 that defaults to 6. For example, 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}'

The JSON response has a passages array, ordered from most to least relevant. Each item contains:

FieldTypeMeaning
sourcestringSource name.
categorystring, optionalSource category.
pageStart, pageEndinteger, optionalPages the passage spans in a paged document.
headingstring, optionalNearest heading above the passage.
textstringVerbatim passage.
relevancenumberRanking score from 0 to 1. Use it to compare passages, not as an absolute measure of whether the docs answer a question.

Ask a question and read citations

Use POST /v1/ask for an answer written from your documents. Send a JSON object with question, a required plain-language string of up to 2,000 characters. The local model takes 5 to 60 seconds to answer, so give your client a timeout with room for that range, such as 90 seconds. Pinned answers return immediately without running the model.

For example, ask for the rollback procedure rather than a list of passages about it:

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?"}'

On success, read kind first. grounded means the answer comes from your documents. notFound means the documents don’t cover the question, and answer says so. That is an answer result, not an HTTP error.

FieldTypeMeaning
kindstringgrounded or notFound.
answerstringAnswer text, which can contain numbered citation markers such as [1].
citationsarrayPassage objects with an integer number, the source name (source) and the quoted text (quote). Items can also include a string category and integer page bounds (pageStart, pageEnd).
noticestring, optionalNote to display alongside the answer, such as when Kept answered from outside the requested category.
pinnedboolean, optionalPresent and true only for an answer the owner pinned.

Match each [n] marker in answer to the citation with that number. If the model writes no markers, Kept returns the closest passages as context. Those passages show what the model read, but don’t tell you which passage supports a specific claim. The API reference describes citationsAreExplicit as a next-release field. Treat its absence as unknown and check the answer text for markers.

API questions don’t appear in Kept’s history or on its Gaps page.

Handle errors and limits

On an HTTP error, Kept returns a JSON object with one string field, error, which you can display to the caller. In all responses, fields without a value are omitted rather than sent as null.

HTTP statusMeaning
200Success. Interpret the result according to the route.
400Invalid input, such as malformed JSON, a missing required field, or an empty or oversized question.
401Missing or unknown API key. The response includes WWW-Authenticate: Bearer.
402The trial or subscription has ended, so search and ask are unavailable.
403The API is off, the Host isn’t a loopback name, or Kept rejected a request from a website.
404No such route.
405Wrong HTTP method. Check the Allow header for the supported method.
413Request body exceeds 64 KB.
429This key reached a rate limit. Wait before retrying.
500Internal Kept error.
502The AI engine reported a problem.
503Kept’s AI isn’t set up, the engine isn’t running, or the model isn’t installed.

Each key can make 120 requests per minute, of which up to 20 can be questions. Both budgets are shared with MCP: an HTTP POST /v1/ask request and an MCP ask call on the same key count toward the same question limit.