curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"text": "<string>",
"content_base64": "<string>",
"kind": "other",
"source": "upload",
"source_ref": "<string>",
"share_scope": "project",
"replaces": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
text: '<string>',
content_base64: '<string>',
kind: 'other',
source: 'upload',
source_ref: '<string>',
share_scope: 'project',
replaces: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents"
payload = {
"name": "<string>",
"text": "<string>",
"content_base64": "<string>",
"kind": "other",
"source": "upload",
"source_ref": "<string>",
"share_scope": "project",
"replaces": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}{
"error": "<string>",
"code": "storage_rule_violation",
"violations": [
{
"rule": "<string>",
"message": "<string>",
"limit": "<unknown>",
"actual": "<unknown>"
}
],
"project_id": "<string>",
"refused_by_rules": [
{
"title": "<string>",
"rule": "<string>",
"message": "<string>"
}
]
}Add a document to a project
A project’s brain (#663), on every plan, within its plan’s project document allowance (the Workspace Brain’s when the workspace has one); a project hidden from the caller answers 404. Adds a document to the project and queues it for indexing (202; 200 with duplicate: true when the same file is already in this project). Send text (content_type text/plain, the default, or text/markdown), or a file as content_base64 with its content_type. Text and Markdown are UTF-8 in any language, at most 1 MiB, with no control characters. PDF, Word (.docx) and HTML files up to 10 MiB are converted to Markdown with Workers AI on the way in (images are not described) and only the extracted text is kept; a file that yields no text answers 422, and 503 means conversion is unavailable. Nothing is truncated: other types answer 415; a file over its limit, or a converted file whose text is over 1 MiB, answers 413. share_scope project (the default) keeps it in this project’s brain: its vectors live in the project’s own namespace, so no other project’s search ranks it. share_scope workspace shares it up to the workspace and needs the Workspace Brain (403 without it). kind says what it is; source and source_ref where it came from (an agent’s upload is always source agent). Needs write in the project. A document that holds a credential-shaped value, in its text or in the text extracted from a file, is refused with 400.
curl --request POST \
--url https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"text": "<string>",
"content_base64": "<string>",
"kind": "other",
"source": "upload",
"source_ref": "<string>",
"share_scope": "project",
"replaces": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
text: '<string>',
content_base64: '<string>',
kind: 'other',
source: 'upload',
source_ref: '<string>',
share_scope: 'project',
replaces: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.hookie.ai/admin/api/projects/{project_id}/brain/documents"
payload = {
"name": "<string>",
"text": "<string>",
"content_base64": "<string>",
"kind": "other",
"source": "upload",
"source_ref": "<string>",
"share_scope": "project",
"replaces": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}{
"error": "<string>",
"code": "storage_rule_violation",
"violations": [
{
"rule": "<string>",
"message": "<string>",
"limit": "<unknown>",
"actual": "<unknown>"
}
],
"project_id": "<string>",
"refused_by_rules": [
{
"title": "<string>",
"rule": "<string>",
"message": "<string>"
}
]
}Path Parameters
Body
The document as UTF-8 text or Markdown. Send text or content_base64, not both.
Response
Successful operation
The response is of type object.