POST /api/upload
Uploads a document file and queues it for asynchronous processing. The document will be analyzed and vectorized for use in chat queries.Authentication
This endpoint requires authentication using Laravel Sanctum. Include the bearer token in the Authorization header.Headers
Bearer token obtained from login endpoint
Must be
multipart/form-dataBody parameters
The document file to uploadValidation rules:
- Must be a valid file
- Allowed MIME types:
pdf,txt - Maximum file size: 102,400 KB (100 MB)
The upload endpoint accepts PDF and plain text files only. Other file types will be rejected with a validation error.
Response
Returns a success message and the created document object.Success message confirming the upload
The created document object
Unique identifier for the document
ID of the user who owns the document
Original filename of the uploaded document
MIME type of the document
Storage path of the document file
Processing status. Will be
pending immediately after uploadID of the vector representation (null until processing completes)
ISO 8601 timestamp when the document was created
ISO 8601 timestamp when the document was last updated
Processing workflow
After a successful upload:- The file is stored securely in private storage
- A document metadata record is created with
status: "pending" - An asynchronous job (
ProcessDocument) is dispatched to handle vectorization - The document status will be updated as processing progresses
- Once complete, the
statuswill becompletedandvector_idwill be populated
Document processing happens asynchronously. Poll the List documents endpoint to check processing status.
Example request
Example response
201 - Created
401 - Unauthorized
422 - Validation error
422 - Invalid file type
422 - File too large