Appearance
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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
page | query | integer | Page, from 1 |
page_size | query | integer | Page size, at most 100 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createDocSourceRequest.
| Field | Type | Description |
|---|---|---|
config | integer[] | |
kind | string | |
name | string | |
refresh_every_seconds | integer | |
tags | string[] |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 422 | Unprocessable Entity | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
sourceID (required) | path | integer | Source ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
sourceID (required) | path | integer | Source ID |
Responses
| Status | Description | Body |
|---|---|---|
| 202 | Accepted | data |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
q | query | string | Part of the title or of a tag, case-insensitive |
has_tag | query | string | 1 keeps only the documents with at least one tag; 0 or leaving it out lists all One of: 0, 1. |
page | query | integer | Page, from 1 |
page_size | query | integer | Page size, at most 100 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createDocRequest.
| Field | Type | Description |
|---|---|---|
content | string | |
tags | string[] | |
title | string |
Request body (application/x-www-form-urlencoded)
Type: string or string or string.
Request body (multipart/form-data)
Type: object.
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 404 | Not Found | error envelope |
| 413 | file past the upload cap, or code docs_storage_full: past the project's remaining docs storage | error envelope |
| 422 | Unprocessable Entity | error envelope |
| 502 | Bad Gateway | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
docID (required) | path | integer | Document ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 304 | Not Modified | |
| 404 | Not Found | error envelope |
Delete a documentation file
DELETE/v1/projects/{id}/docs/{docID}
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
docID (required) | path | integer | Document ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
docID (required) | path | integer | Document ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | |
| 206 | the requested Range | |
| 304 | Not Modified | |
| 404 | Not 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
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |