{"openapi":"3.1.0","info":{"title":"KnowledgeBase.org API","version":"1.0.0","summary":"Owner-approved, versioned, source-cited knowledge for products and AI agents.","description":"Read owner-approved KnowledgeBases: exact field values, search passages, cited answers, full releases and a change feed. Every record is private: reading one needs the owner's API key or an OAuth access token from an app the owner connected, and returns only the details that credential was granted. Without credentials, only the fictional sandbox (sample-dental, sample-person, sample-kettle, sample-cafe) is readable. Every result names the release and revision it came from. Guides: https://knowledgebase.org/developers","contact":{"url":"https://knowledgebase.org/developers"}},"servers":[{"url":"https://knowledgebase.org"}],"externalDocs":{"description":"Developer guide","url":"https://knowledgebase.org/developers"},"security":[{},{"bearer":[]}],"tags":[{"name":"Knowledge","description":"One or more knowledgebases you may read."},{"name":"Network","description":"Across every KnowledgeBase you may read, or one of your collections."},{"name":"Sync","description":"Full releases and the change feed."}],"paths":{"/v1/answers":{"post":{"tags":["Knowledge"],"operationId":"answer","summary":"Answer a question with citations","description":"Answers from approved, published items only, with numbered citations. `mode` is `ai` when an AI answer was written, `passages` when only the best passages are returned, and `no_match` when nothing relevant was found. Without credentials, `knowledge_base` must name a sandbox record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["question"],"properties":{"question":{"type":"string","example":"Do you take walk-ins?"},"knowledge_base":{"type":"string","description":"A knowledgebase slug. Omit to use every base your key or token can read.","example":"sample-dental"}}}}}},"responses":{"200":{"description":"An answer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Answer"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/search":{"post":{"tags":["Knowledge"],"operationId":"search","summary":"Search passages","description":"Ranked passages from published items you were granted. No AI involved. Without credentials, `knowledge_base` must name a sandbox record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","example":"insurance"},"knowledge_base":{"type":"string","example":"sample-dental"},"limit":{"type":"integer","minimum":1,"maximum":25,"default":8}}}}}},"responses":{"200":{"description":"Matching passages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/knowledge-bases":{"get":{"tags":["Knowledge"],"operationId":"listKnowledgeBases","summary":"List the knowledgebases you can read","security":[{"bearer":[]}],"responses":{"200":{"description":"Knowledgebases","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeBaseSummary"}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"}}}},"/v1/knowledge-bases/{slug}":{"get":{"tags":["Sync"],"operationId":"getKnowledgeBase","summary":"Get the current release","description":"Every published item in the current release, filtered to what this caller may see (`scope` is `public` or `full`). Use it to sync or export. Pass `release` to read an older release instead (callers with full access only).","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"example":"sample-dental"},{"name":"release","in":"query","description":"A release number from listReleases. Omit for the current release.","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"The release","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeBase"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/knowledge-bases/{slug}/fields":{"get":{"tags":["Knowledge"],"operationId":"getFields","summary":"Read exact field values","description":"Approved values by field key (for example `hours`, `warranty`, `short_bio`) with the context each value applies in. Use it to fill forms and feeds, where you need the exact approved value; use answer for open questions. Only granted details are returned; `missing` lists requested keys with no value you may read.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"example":"sample-kettle"},{"name":"keys","in":"query","description":"Comma-separated field keys.","schema":{"type":"string"},"example":"warranty,compatibility"},{"name":"release","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Field values","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"fields"},"knowledge_base":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string"}}},"release":{"type":["object","null"],"properties":{"number":{"type":"integer"},"published_at":{"type":"string","format":"date-time"},"current":{"type":"boolean"}}},"scope":{"enum":["full","selected"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"section":{"type":["string","null"]},"values":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"context":{"type":"string","description":"When this value applies; empty means always."},"title":{"type":"string"},"item_id":{"type":"string"},"revision":{"type":"integer"}}}}}}},"missing":{"type":"array","items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/knowledge-bases/{slug}/releases":{"get":{"tags":["Sync"],"operationId":"listReleases","summary":"List releases","description":"Release history, newest first. Your current grant applies to every release: details you may not read today stay hidden in older releases too.","security":[{"bearer":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Releases","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"number":{"type":"integer"},"published_at":{"type":"string","format":"date-time"},"notes":{"type":"string"},"item_count":{"type":"integer"},"current":{"type":"boolean"}}}}}}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/changes":{"get":{"tags":["Sync"],"operationId":"listChanges","summary":"Follow new releases","description":"New releases in the knowledgebases you may read, oldest first. Entries carry identifiers only; fetch content with getKnowledgeBase. Store `next_cursor` and pass it back. Apps need the changes:read permission.","security":[{"bearer":[]}],"parameters":[{"name":"cursor","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Changes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"}}}},"/v1/directory":{"get":{"tags":["Network"],"operationId":"searchDirectory","summary":"List sandbox records","description":"The fictional sandbox records, for trying the API without a key. Customer records are private and never listed here; use listKnowledgeBases with credentials.","security":[{}],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}},{"name":"location","in":"query","schema":{"type":"string"}},{"name":"language","in":"query","schema":{"type":"string"}},{"name":"topic","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Profiles","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DirectoryEntry"}}}}}}}}}},"/v1/network/search":{"post":{"tags":["Network"],"operationId":"networkSearch","summary":"Search across many sources","description":"Passages across every KnowledgeBase you may read (the sandbox without credentials), at most 3 per source, or across one of your collections.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"collection":{"type":"string","description":"A collection id from listCollections (needs credentials). Omit for everything you may read."},"limit":{"type":"integer","minimum":1,"maximum":30,"default":12}}}}}},"responses":{"200":{"description":"Matching passages","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SearchResult"},{"type":"object","properties":{"scope":{"enum":["authorized","sandbox","collection"]}}}]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/network/answers":{"post":{"tags":["Network"],"operationId":"networkAnswer","summary":"Answer from several sources","description":"An answer that attributes each claim to its source and lists where sources disagree (`conflicts`).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["question"],"properties":{"question":{"type":"string"},"collection":{"type":"string"}}}}}},"responses":{"200":{"description":"An answer","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Answer"},{"type":"object","properties":{"scope":{"enum":["authorized","sandbox","collection"]}}}]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"}}}},"/v1/collections":{"get":{"tags":["Network"],"operationId":"listCollections","summary":"List your collections","security":[{"bearer":[]}],"responses":{"200":{"description":"Collections","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"purpose":{"type":"string"},"members":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/E401"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A workspace API key (create one at /app/keys; keep it on your server) or an OAuth access token from /oauth/token. Omit the header entirely to read public knowledgebases."}},"responses":{"E400":{"description":"invalid_request: a required field is missing or malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"invalid_token: the key or token is missing, malformed, expired or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"insufficient_scope: the app's connection doesn't include the permission this endpoint needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"not_found: no knowledgebase (or collection) with that id is available to this caller. Private ones look the same as missing ones.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["invalid_request","invalid_token","insufficient_scope","not_found"]},"message":{"type":"string"},"request_id":{"type":"string"}}}}},"Citation":{"type":"object","description":"A published passage. `ref` is the number used in answer text, such as [1].","properties":{"ref":{"type":"integer"},"knowledgeBase":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"publisher":{"type":"string"},"language":{"type":"string"},"domainChecked":{"type":["string","null"],"description":"The website domain the owner proved, if any."}}},"item":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"}}},"revision":{"type":"integer"},"release":{"type":"integer"},"publishedAt":{"type":"string","format":"date-time"}}},"Answer":{"type":"object","properties":{"object":{"const":"answer"},"question":{"type":"string"},"answer":{"type":["string","null"]},"mode":{"enum":["ai","passages","no_match"]},"insufficientEvidence":{"type":"boolean","description":"True when the sources don't fully answer the question. Say so instead of guessing."},"citations":{"type":"array","items":{"$ref":"#/components/schemas/Citation"}},"conflicts":{"type":"array","items":{"type":"object","properties":{"about":{"type":"string"},"positions":{"type":"array","items":{"type":"object","properties":{"ref":{"type":"integer"},"says":{"type":"string"}}}}}}},"sources":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"publisher":{"type":"string"}}}}}},"SearchResult":{"type":"object","properties":{"object":{"const":"search_result"},"query":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Citation"}}}},"KnowledgeBaseSummary":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","enum":["personal","company","organization","product","location","service","event","team","project"]},"visibility":{"type":"string","enum":["private","sandbox"]}}},"KnowledgeBase":{"allOf":[{"$ref":"#/components/schemas/KnowledgeBaseSummary"},{"type":"object","properties":{"object":{"const":"knowledge_base"},"kind":{"type":"string"},"sandbox":{"type":"boolean"},"scope":{"enum":["full","selected"],"description":"selected: the owner granted only some details."},"release":{"type":["object","null"],"properties":{"number":{"type":"integer"},"published_at":{"type":"string","format":"date-time"},"current":{"type":"boolean","description":"False when you pinned an older release."}}},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"field":{"type":["string","null"]},"section":{"type":["string","null"]},"context":{"type":"string"},"revision":{"type":"integer"}}}}}}]},"ChangeList":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"const":"release.published"},"knowledge_base":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}}},"release":{"type":["integer","null"]},"occurred_at":{"type":"string","format":"date-time"}}}},"next_cursor":{"type":"integer"},"has_more":{"type":"boolean"}}},"DirectoryEntry":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"entity_type":{"type":"string"},"category":{"type":"string"},"location":{"type":"string"},"language":{"type":"string"},"topics":{"type":"array","items":{"type":"string"}},"publisher":{"type":"string"},"domain_checked":{"type":["string","null"]},"public_items":{"type":"integer"},"release":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"},"access":{"type":"object","properties":{"ask":{"type":"boolean"},"download":{"type":"boolean"}}},"match_reasons":{"type":"array","items":{"type":"string"}}}}}}}