Skip to main content
POST
/
v1
/
knowledge-base
Create a knowledge base
curl --request POST \
  --url https://api.roark.ai/v1/knowledge-base \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "sourceType": "TEXT",
  "description": "<string>",
  "content": "<string>",
  "filename": "<string>",
  "mimeType": "application/pdf",
  "contentBase64": "<string>"
}
'
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "description": "<string>",
    "sourceType": "TEXT",
    "status": "READY",
    "originalFilename": "<string>",
    "mimeType": "<string>",
    "byteSize": 1,
    "contentHash": "<string>",
    "errorMessage": "<string>",
    "createdAt": "<string>",
    "updatedAt": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.roark.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Input for creating a knowledge base. See sourceType for which fields are required.

name
string
required

Customer-facing name. Unique within the project. Required.

Required string length: 1 - 120
sourceType
enum<string>
required

How the knowledge base content was provided. TEXT/JSON are stored as-is; FILE was uploaded and its text content extracted (PDF → text).

Available options:
TEXT,
FILE,
JSON
description
string | null

Optional short blurb shown in pickers.

Maximum string length: 500
content
string | null

For TEXT: raw markdown/text. For JSON: a JSON string (validated server-side and re-formatted with stable whitespace). Required for TEXT and JSON; omit for FILE.

filename
string | null

For FILE: customer-supplied filename (informational only — used for download links).

Required string length: 1 - 255
mimeType
enum<string> | null

For FILE: mime type of the uploaded file. Only application/pdf, text/plain, and text/markdown are accepted.

Available options:
application/pdf,
text/plain,
text/markdown
contentBase64
string | null

For FILE: base64-encoded file bytes. Required for FILE. Max 10 MB after decoding. PDFs are text-extracted server-side; image-only PDFs are rejected.

Response

The created knowledge base.

data
KnowledgeBase · object
required

A customer-uploaded reference document attached to custom metrics as ground truth at evaluation time.