Skip to main content
The knowledge base holds the articles your AI agent answers from and your human agents read in the inbox. Articles are grouped into collections. You can manage them in Clarity or keep them in sync from your own content system with these endpoints. Every request goes to https://back.leap.onclarity.com with Authorization: Bearer $CLARITY_API_KEY (see Authentication).

The article object

Articles accept other fields too (for example tags, confidence, criticality); Clarity stores whatever you send with the article.

Create an article

string
The article title.
string
The article body in Markdown.
string
The collection to file it in.
string
default:"draft"
draft or published.
boolean
default:"false"
Show the article on the public help page.
string
default:"manually"
Where the article came from.
string
When the article becomes valid.
string
When the article stops being valid.
Creating an article fires the kb_article_created webhook.

Update an article

PATCH /api/kb/articles/update?article_id=… takes the same body as create.
An update replaces the article’s fields. Only content, is_public, and the usage counters are kept when you leave them out. Any other field you omit, including title and collection, is removed, and status falls back to draft. Read the article with GET /api/kb/articles/detail first and send every field back with your change.
The response is the updated article.

Read, list, and delete

Read one article

An unknown id answers 404 article_not_found.

List articles

POST /api/kb/articles/list returns {"list": [...], "total": N}. Listed articles do not include content; read an article to get it.
string
Text to search for in titles and content.
object
Field filters. A list matches any of its values. The keys Clarity’s own Knowledge Base page uses are status, collection, source, tags, updated_at ({"gte": "...", "lte": "..."}), and validity_status (any of active, scheduled, expired).
object
{"key": "updated_at", "direction": "desc"}. direction is asc or desc.
integer
default:"1000"
How many articles to return.
integer[]
Ids you already have. They are excluded, so sending the ids of the previous pages returns the next page.
boolean
default:"false"
Order by collection name first, then by sort within each collection.

Delete an article

The response has a status and an optional message.

Upload a file

POST /api/kb/articles/upload takes a file as multipart form data, creates an article with status: "processing", and converts the file to Markdown in the background. Poll the article with GET /api/kb/articles/detail until its status leaves processing. A converted PDF lands as a draft, or error if the conversion failed; publish it with an update.
file
required
A PDF, or one of .docx, .pptx, .xlsx, .xls, .csv, .tsv, .txt, .html.
string
required
The collection for the new article.
qdrant_article_id is the new article’s id. The request body can be up to 150 MB.

Collections and values in use

GET /api/kb/meta returns: