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:
| Field | Type | Meaning |
|---|---|---|
app | string | Always Kept. |
version | string | Kept’s version. |
business | string | Team name from Settings → General. May be empty. |
sources | integer | Number of sources. |
chatModel | string, optional | Model that writes answers. |
license | string | Human-readable trial or subscription status. |
canAsk | boolean | Whether 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.
| Field | Type | Meaning |
|---|---|---|
id | integer | Kept’s ID for the source. |
name | string | Display name, usually the filename. |
type | string | pdf, docx, rtf, txt, md, html or image. |
category | string, optional | Source category. |
status | string | ready means searchable, noText means Kept found no readable text, and error means Kept couldn’t read the source. |
pages | integer, optional | Page count for paged formats. |
addedAt | string | Time 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:
| Field | Type | Meaning |
|---|---|---|
source | string | Source name. |
category | string, optional | Source category. |
pageStart, pageEnd | integer, optional | Pages the passage spans in a paged document. |
heading | string, optional | Nearest heading above the passage. |
text | string | Verbatim passage. |
relevance | number | Ranking 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.
| Field | Type | Meaning |
|---|---|---|
kind | string | grounded or notFound. |
answer | string | Answer text, which can contain numbered citation markers such as [1]. |
citations | array | Passage 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). |
notice | string, optional | Note to display alongside the answer, such as when Kept answered from outside the requested category. |
pinned | boolean, optional | Present 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 status | Meaning |
|---|---|
200 | Success. Interpret the result according to the route. |
400 | Invalid input, such as malformed JSON, a missing required field, or an empty or oversized question. |
401 | Missing or unknown API key. The response includes WWW-Authenticate: Bearer. |
402 | The trial or subscription has ended, so search and ask are unavailable. |
403 | The API is off, the Host isn’t a loopback name, or Kept rejected a request from a website. |
404 | No such route. |
405 | Wrong HTTP method. Check the Allow header for the supported method. |
413 | Request body exceeds 64 KB. |
429 | This key reached a rate limit. Wait before retrying. |
500 | Internal Kept error. |
502 | The AI engine reported a problem. |
503 | Kept’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.