Skip to content

Documentation ​

10 operations. Paths are relative to https://api.frege.io.

List an environment's documentation sources ​

GET/v1/projects/{id}/doc-sources

Newest first. Paginated by page/page_size like every other listing in this API: 20 per page by default, at most 100.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
pagequeryintegerPage, from 1
page_sizequeryintegerPage size, at most 100

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope
422Unprocessable Entityerror envelope

Add a documentation source to an environment ​

POST/v1/projects/{id}/doc-sources

Names somewhere this environment's documentation comes from, so it can be crawled and re-crawled. The config is the ingester's own, and is validated by building the ingester before the row is stored. refresh_every_seconds, when set (3600 to 2592000), crawls the source again on its own that long after each run; next_run_at says when. Absent or null, the source is crawled only when asked.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.createDocSourceRequest.

FieldTypeDescription
configinteger[]
kindstring
namestring
refresh_every_secondsinteger
tagsstring[]

Responses

StatusDescriptionBody
201Createddata
422Unprocessable Entityerror envelope

Remove a documentation source ​

DELETE/v1/projects/{id}/doc-sources/{sourceID}

Deletes the source AND the documents it produced, because a document from a removed source can never be refreshed again.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
sourceID (required)pathintegerSource ID

Responses

StatusDescriptionBody
204No Content
404Not Founderror envelope

Crawl a documentation source now ​

POST/v1/projects/{id}/doc-sources/{sourceID}/run

Starts the ingest as a background task and returns its handle. A crawl takes minutes and costs credits at the source, so it is never done inside the request. The source's last_status is pending until the run ends, then completed or error (with last_error). A source already pending is refused with 409 rather than crawled twice.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
sourceID (required)pathintegerSource ID

Responses

StatusDescriptionBody
202Accepteddata
404Not Founderror envelope
409Conflicterror envelope
422Unprocessable Entityerror envelope

List a project's documentation ​

GET/v1/projects/{id}/docs

Newest first. q keeps the documents whose title or any one of whose tags contains it, case-insensitively: q=billing finds "Billing FAQ" and a document tagged billing-v2. total and metadata count the matches. Paginated by page/page_size like every other listing in this API: 20 per page by default, at most 100.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
qquerystringPart of the title or of a tag, case-insensitive
has_tagquerystring1 keeps only the documents with at least one tag; 0 or leaving it out lists all One of: 0, 1.
pagequeryintegerPage, from 1
page_sizequeryintegerPage size, at most 100

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope
422Unprocessable Entityerror envelope

Create a documentation entry, from Markdown or from an uploaded file ​

POST/v1/projects/{id}/docs

Two ways in, one pipeline out: stores the document, chunks and embeds it for semantic search. Tags scope which clients can search it (doc_tag grants). Sent as JSON, content is stored as-is and must already be Markdown. Sent as multipart/form-data with a file field instead, the file is converted to Markdown first — text passes through untouched, HTML has its markup stripped, and anything else (PDF, Office file, slide deck, scan) goes to the configured document parser. Accepted files: PDF, DOCX, WPS, PPTX, Keynote (.key), XLSX, CSV, PNG, JPG/JPEG, TIFF, JSON, TXT, plus Markdown and HTML, and recordings (MP3, OGG, WAV, M4A, AAC, FLAC, MP4, MOV, WebM), stored as their transcript with each line's time; anything else is 422. title and tags are then form fields, and tags is a comma-separated list. A multipart upload is keyed by its filename: re-uploading the same name REPLACES the document it produced last time instead of duplicating it, so that is also how such a document gets updated. On that replacement, leaving the tags field out entirely keeps the tags the document already had; sending it — even empty — replaces them, and an empty one clears them. An uploaded file counts its ORIGINAL size (not the Markdown) against the project's docs storage (a crawled page counts its Markdown), shared by both environments; see GET .../docs/storage. A file that does not fit is refused with 413 and code docs_storage_full before it is converted.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.createDocRequest.

FieldTypeDescription
contentstring
tagsstring[]
titlestring

Request body (application/x-www-form-urlencoded)

Type: string or string or string.

Request body (multipart/form-data)

Type: object.

Responses

StatusDescriptionBody
201Createddata
404Not Founderror envelope
413file past the upload cap, or code docs_storage_full: past the project's remaining docs storageerror envelope
422Unprocessable Entityerror envelope
502Bad Gatewayerror envelope

Get one documentation entry, with its Markdown ​

GET/v1/projects/{id}/docs/{docID}

The document and the Markdown it was converted to, for a preview. The listing leaves the text out; this is where it is read. Answers with an ETag and Cache-Control: no-cache, so a browser re-opening an unchanged document is answered 304 with no body, and gzip when the client accepts it.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
docID (required)pathintegerDocument ID

Responses

StatusDescriptionBody
200OKdata
304Not Modified
404Not Founderror envelope

Delete a documentation file ​

DELETE/v1/projects/{id}/docs/{docID}

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
docID (required)pathintegerDocument ID

Responses

StatusDescriptionBody
204No Content
404Not Founderror envelope

Download the original file behind a document ​

GET/v1/projects/{id}/docs/{docID}/original

The uploaded file as it arrived, streamed from object storage. preview on the document says how to show it: pdf and image are served inline, everything else as an attachment. Supports Range requests and answers 304 to a matching If-None-Match. The route takes the same Bearer token as the rest of the API, so a browser fetches it and shows the result through URL.createObjectURL rather than pointing an iframe or img at it. 404 when no original is kept for this document (see has_original).

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
docID (required)pathintegerDocument ID

Responses

StatusDescriptionBody
200OK
206the requested Range
304Not Modified
404Not Found

Show a project's docs storage ​

GET/v1/projects/{id}/docs/storage

How much of its docs storage a project has used. The limit is per PROJECT, shared by both environments, and counts uploaded files at their original size and crawled pages at the size of their Markdown. A crawl that runs out of room stops, keeping the pages it stored, and its source ends in error.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope