Associate an uploaded file with a knowledge base and trigger processing.
This is Step 2 of the file upload flow (after uploading to the presigned URL).
What this endpoint does:
The orgId is automatically extracted from your JWT token - you don’t need to include it in the request body.
Complete upload flow:
1. POST /upload/presigned → Get signed URL + file metadata
2. PUT to signed URL → Upload file to storage
3. POST /kb/files → Associate with KB & trigger processing
Documentation Index
Fetch the complete documentation index at: https://docs.asteragents.com/llms.txt
Use this file to discover all available pages before exploring further.
JWT token from Clerk authentication.
Must be from a user with org:admin role.
The ID of the knowledge base to associate the file with
123
The file UUID returned from the presigned upload endpoint
"550e8400-e29b-41d4-a716-446655440000"
Original filename
"quarterly-report.pdf"
The storage key returned from the presigned upload endpoint
"org_xxx/uploads/550e8400-e29b-41d4-a716-446655440000/quarterly-report.pdf"
The content key returned from the presigned upload endpoint
"org_xxx/contents/550e8400-e29b-41d4-a716-446655440000.md"
MIME type of the file
"application/pdf"
File size in bytes (optional but recommended)
1048576
Optional metadata to attach to the file record. For inbound email files, this includes emailId, emailSubject, emailFrom, emailDate, and emailMessageId to link files from the same email.
{
"source": "inbound-email",
"emailId": "7ef4b7eb-4345-4f3f-ab95-ab76f7bd9634",
"emailSubject": "Updated contract",
"emailFrom": "user@example.com"
}