Skip to main content
POST
Create a knowledge document

Authorizations

Authorization
string
header
required

API key starting with sk_. Generate one in Settings > API Keys.

Path Parameters

workspaceId
string
required

Workspace ID.

Body

application/json
name
string
required

Display name of the document.

Minimum string length: 1
content
string

Text of the document. Provide exactly one of content, url, or fileName with size.

Minimum string length: 1
fileName
string

Original file name, extension included. Give it with size to create a file document.

Required string length: 1 - 255
knowledgeFolderId
string

Folder that will hold the document. Omit it to file the document in General.

replaces
string[]

IDs of existing knowledge documents this one replaces. The new document does not inherit the replaced document's folder: pass its knowledgeFolderId to keep it there.

Maximum array length: 500
size
integer

File size in bytes, up to 50 MB. Give it with fileName.

Required range: x > 0
url
string<uri>

Web page to index. Provide exactly one of content, url, or fileName with size.

Response

201 - application/json

Default Response

contentType
string | null
required

MIME type of the uploaded file. Null when the document has no file.

createdAt
string
required

ISO 8601 creation date.

createdById
string | null
required

ID of the user who created the document.

failureReason
enum<string> | null
required

Why processing failed. Null unless the status is failed.

Available options:
upload_expired,
unsupported_type,
encrypted,
page_too_large,
too_large,
optimization_timeout,
processing_error,
kb_failed
fileName
string | null
required

Original file name. Null when the document has no file.

fileSize
integer | null
required

File size in bytes. Null when the document has no file.

id
string
required

Unique identifier of the knowledge document.

knowledgeFolderId
string | null
required

Knowledge folder holding the document. Null for the General folder and for page documents.

name
string
required

Name of the document.

nbCitations
integer | null
required

Number of times AI content cited this document. Null for a document created before citations were counted and never cited since.

pageId
string | null
required

Page the document is attached to. Null for workspace documents.

reviewStatus
enum<string> | null
required

to_validate when the document is 18 months old or more and was not validated in the last 3 months, up_to_date otherwise. Null until processing has succeeded.

Available options:
to_validate,
up_to_date
status
enum<string> | null
required

Processing status.

Available options:
pending,
success,
failed
summary
string | null
required

Summary of the document content.

type
enum<string> | null
required

Document type.

Available options:
text,
url,
file
updatedAt
string | null
required

ISO 8601 date of the last update.

updatedById
string | null
required

ID of the user who last updated the document.

url
string | null
required

Source URL of a url document. Known on the single-document routes only, null elsewhere.

validatedAt
string | null
required

ISO 8601 date of the last validation.

validatedById
string | null
required

ID of the user who last validated the document.

workspace
object
required

Workspace this knowledge document belongs to.

upload
object

Presigned S3 POST form, present only for a file document. Valid for 15 minutes.