Create Source
Registers a previously-uploaded file as a document source under a source batch and queues it for asynchronous parsing. Once status: "success", the source is searchable in chat/search conversations that reference its source_batch_id.
Important Notes:
- Prerequisite: A source batch must be created first using
POST /v1/source_batches - The file must already be in S3 before calling this endpoint. Two ways to get it there:
- Recommended: call
POST /v1/sources/upload_urlto obtain a presigned PUT URL, upload the file directly via that URL, then pass the returnedfile_keyhere. No client-side AWS setup required. - Alternative: if you already have your own S3 staging bucket integrated with us, upload there and pass the resulting
file_key.
- Recommended: call
- Processing: Sources are queued for asynchronous processing. Use
GET /v1/sources/{source_id}to poll the processing status before using in conversations. - File Requirements:
- Supported formats: PDF, DOCX, XLSX, DOC, TXT, PPTX
- Maximum size: 20MB per file
- Maximum files per batch: 10 files
- Usage in Conversations:
- Reference sources via
source_batch_idin chat/search API requests - All sources in a batch are accessible when the batch is referenced
- Sources remain available for reuse within conversations that reference their batch
- Reference sources via
Workflow (presigned-URL path):
POST /v1/source_batches→source_batch_idPOST /v1/sources/upload_url→upload_url,file_key,content_type- PUT the file body to
upload_urlwith headerContent-Type: <content_type> POST /v1/sources(this endpoint) withfile_keyfrom step 2- Poll
GET /v1/sources/{source_id}untilstatus: "success" - Reference
source_batch_idin chat/search requests
Authorizations
Body
ID of the source batch to add this source to. The batch must be created first via POST /v1/source_batches.
"123e4567-e89b-12d3-a456-426614174000"
Display name for the source, typically the original filename. Must not include a file extension.
"Q4_Revenue_Report"
S3 object key path where the file is stored. The file must be accessible to the API service and meet format/size requirements (PDF, DOCX, XLSX, DOC, TXT, PPTX; max 20MB).
"uploaded_sources/2024/q4/revenue_report.pdf"
User ID
"123e4567-e89b-12d3-a456-426614174000"
Organization ID
"123e4567-e89b-12d3-a456-426614174000"
User email
"john.doe@example.com"
User name
"John Doe"
Response
Source created and queued for processing
Unique identifier for the created source. Use this ID to poll processing status via GET /v1/sources/{source_id}.
"456e7890-e89b-12d3-a456-426614174001"
File size in bytes
x >= 02048576
Initial processing status (typically 'processing' when first created)
processing, success, failed "processing"