POST /v2/knowledge-bases/{knowledge_base_id}/resources
Upload a file directly and start indexing; poll the resource GET for status.
How to use
Upload multipart field file (singular). Indexing starts automatically. Save the resource_id from the 202 response and poll resource GET until indexed or error. Do not set the multipart boundary yourself or re-upload while waiting. Read successful resource payloads under data when a body is returned.
Authentication and permissions
Required permissions: kbs.index. Resource and owner access checks also apply.
Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header.
The file to upload to the knowledge base
Successful Response
Machine-readable response code, when provided.
Validation Error
curl --fail-with-body -sS \
"$STACKAI_BASE_URL/v2/knowledge-bases/${KNOWLEDGE_BASE_ID}/resources" \
-H "Authorization: Bearer $STACKAI_API_KEY" \
-F 'file=@document.pdf'{
"response_code": "text",
"meta": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"data": {
"message": "text",
"resource_id": "123e4567-e89b-12d3-a456-426614174000"
}
}Last updated
Was this helpful?

