Developers

API reference

Every endpoint of the REST API v1, generated from the API's own OpenAPI document.

Base URL https://api.headknot.com/api. Every call needs Authorization: Bearer <key> (see Authentication). The machine-readable document is at /v1/openapi.json; this page was generated from it on 25 November 2026.

Account

List the workspaces this credential can use

GET/v1/workspaces

Active workspaces you own or are a member of, narrowed to the credential's workspace list. Needs the read scope.

Response 200 · V1Workspace[]

NameTypeDescription
iduuid
namestring
slugstring
personalbooleanYour own personal workspace.

Who this credential acts as

GET/v1/me

The account, its plan, its AI Reasoning answers this period, and what the credential may do. Needs no scope.

Response 200 · V1Me

NameTypeDescription
userIduuid
emailstring
planV1Plan
aiReasoningV1AiReasoning
credentialV1Credential

Ask

Find the passages that answer a query

POST/v1/workspaces/{workspaceId}/search

Semantic Search: the quoted passages and their sources, best first. Free on every plan. Needs the read scope. workspaceId comes from GET /v1/workspaces.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces

Request body (application/json · V1SearchRequest)

NameTypeDescription
query *stringWhat to look for, in plain language.

Response 200 · V1Answer

NameTypeDescription
answerstringThe answer; [n] markers refer to citations.
mode"reasoning" | "search"
abstainedbooleanTrue when the workspace does not hold enough to answer. A declined AI Reasoning answer is not counted against the allowance.
citationsV1Citation[]
passagesV1Passage[]Matching passages, quoted (search mode).
conversationIduuidPass it back as conversationId to ask a follow-up.
turnIduuid

Ask a question

POST/v1/workspaces/{workspaceId}/ask

A cited answer from the workspace's sources. In reasoning mode (the default) it counts against your AI Reasoning allowance, exactly as in the app, and answers 402 when that is used up; a declined answer is not counted. search mode is free. Needs the ask scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces

Request body (application/json · V1AskRequest)

NameTypeDescription
question *stringThe question, in plain language.
mode"reasoning" | "search"reasoning (default): a written answer, counted against your AI Reasoning allowance. search: the passages that answer it, free.
conversationIduuidContinue a conversation: the conversationId of an earlier answer. Omit to start a new one.

Response 200 · V1Answer

NameTypeDescription
answerstringThe answer; [n] markers refer to citations.
mode"reasoning" | "search"
abstainedbooleanTrue when the workspace does not hold enough to answer. A declined AI Reasoning answer is not counted against the allowance.
citationsV1Citation[]
passagesV1Passage[]Matching passages, quoted (search mode).
conversationIduuidPass it back as conversationId to ask a follow-up.
turnIduuid

Ask a question, streamed

POST/v1/workspaces/{workspaceId}/ask/stream

Server-Sent Events: token events carry the answer as it is written ({"text": …}), then one answer event carries the whole Answer, then the stream closes. A failure is an error event ({"code", "message"}). Access and the allowance are checked before the stream opens, so those refusals are ordinary 403 / 402 responses. Needs the ask scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces

Request body (application/json · V1AskRequest)

NameTypeDescription
question *stringThe question, in plain language.
mode"reasoning" | "search"reasoning (default): a written answer, counted against your AI Reasoning allowance. search: the passages that answer it, free.
conversationIduuidContinue a conversation: the conversationId of an earlier answer. Omit to start a new one.

Response 200 · SseEmitter

NameTypeDescription
timeoutinteger

Documents

Upload files

POST/v1/workspaces/{workspaceId}/files

One or more files in the files form field, or a .zip (expanded), with the app's limits (10 MB a file). Read in the background; the words count against your plan exactly as an upload in the app does. Needs the write scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces

Request body (multipart/form-data)

NameTypeDescription
files *file[]

Response 202 · V1UploadResult

NameTypeDescription
addedV1UploadAdded[]
skippedV1UploadSkipped[]

List the workspace's documents

GET/v1/workspaces/{workspaceId}/documents

Newest first. Only documents whose source you may view are listed. Needs the read scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces
limitquery · integer1 to 100, default 50
offsetquery · integerFrom a previous page's nextOffset

Response 200 · V1DocumentPage

NameTypeDescription
documentsV1Document[]
nextOffsetintegerPass as offset for the next page; null when there is none. A page can hold fewer than limit documents.

Add a note

POST/v1/workspaces/{workspaceId}/documents

Stored and searched like an uploaded file named after its title. Read in the background; the words count against your plan as an upload does. Needs the write scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces

Request body (application/json · V1NoteRequest)

NameTypeDescription
title *string
text *string
format"markdown" | "text"markdown (default) or text.

Response 202 · V1UploadResult

NameTypeDescription
addedV1UploadAdded[]
skippedV1UploadSkipped[]

Read a document

GET/v1/workspaces/{workspaceId}/documents/{documentId}

Its current text, as extracted from the source. documentId is a citation's documentId or an id from the list. 404 when it is not in the workspace, was excluded, or its source is not one you may view. Needs the read scope.

Parameters

NameTypeDescription
workspaceId *path · uuidA workspace from GET /v1/workspaces
documentId *path · uuid

Response 200 · V1DocumentContent

NameTypeDescription
iduuid
titlestring
sourceAppstring
urlstring
updatedAtdate-time
textstringThe text, exactly as it was extracted from the source.