curl --request POST \
--url https://api.lighton.ai/api/v2/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'file=<string>' \
--form 'collection_type=<string>'import requests
url = "https://api.lighton.ai/api/v2/files"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('collection_type', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.lighton.ai/api/v2/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 1,
"object": "list",
"bytes": 20032,
"created_at": 1631533200,
"filename": "document.pdf",
"purpose": "documents",
"status": "embedded"
}Upload a document
Deprecated — this endpoint will be removed in a future release. Use POST /api/v3/files instead.
Endpoint to upload documents.
Documents are saved to the persistent storage, parsed, chunked and embedded.
The file is indexed as a document in the SQL database, with its chunks, and related to its owner, company and collection for permission application.
collection_type is required and must be one of:
private— upload to the caller’s personal workspaceshared— upload to a specific shared workspace;workspace_idis required
Passing collection_type=company returns HTTP 400.
curl --request POST \
--url https://api.lighton.ai/api/v2/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'file=<string>' \
--form 'collection_type=<string>'import requests
url = "https://api.lighton.ai/api/v2/files"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"collection_type\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('collection_type', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.lighton.ai/api/v2/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 1,
"object": "list",
"bytes": 20032,
"created_at": 1631533200,
"filename": "document.pdf",
"purpose": "documents",
"status": "embedded"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request serializer for file upload.
Type of collection to store the file in ('private' or 'shared')
255512Owner of the file (optional)
Company to associate the file with (optional)
30Workspace ID — required when collection_type is 'shared'
Size of chunks for document processing (optional)
Overlap between chunks (optional)
Additional external metadata for the document (optional)
Show child attributes
Show child attributes
OCR agent to use for processing (optional)
Enable complete document table extraction (optional)
High resolution OCR model name (optional)
OCR processing strategy (optional)
OCR processing timeout in seconds (optional)
OCR service URL (optional)
Enable visual ingestion processing (optional)
Default processing pipeline to use (optional)
Response
Response serializer for file upload results.
Unique identifier for the uploaded file
Object type, always 'file'
Size of the file in bytes
Unix timestamp of when the file was created
Original filename of the uploaded file
Purpose of the file, always 'documents'
Processing status of the file