import requests
url = "https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"files_metadata": "<string>",
"collection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"skip_parsing": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('files_metadata', '<string>');
form.append('collection_id', '3c90c3cc-0d44-4b50-8888-8dd25736052a');
form.append('skip_parsing', 'false');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'files_metadata=<string>' \
--form collection_id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
--form skip_parsing=false \
--form files.items='@example-file'[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file": "<string>",
"content_type": "application/pdf",
"computed_pdf_file": "<string>",
"source": "upload",
"source_metadata": {},
"page_count": 123,
"file_size": 123,
"metadata": [
[
"category",
"Finance"
],
[
"region",
"EMEA"
]
],
"collection": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]"
}
}
]{
"error": "User not found"
}{
"error": "Authentication credentials were not provided."
}{
"error": "You do not have permission to perform this action."
}Bulk upload documents
Upload multiple documents at once. Optionally skip the automatic parsing pipeline.
Per-file metadata can be attached at upload time via the files_metadata field so
documents arrive with their metadata already set (no follow-up metadata-add calls
needed).
import requests
url = "https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"files_metadata": "<string>",
"collection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"skip_parsing": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('files_metadata', '<string>');
form.append('collection_id', '3c90c3cc-0d44-4b50-8888-8dd25736052a');
form.append('skip_parsing', 'false');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/bulk-upload/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'files_metadata=<string>' \
--form collection_id=3c90c3cc-0d44-4b50-8888-8dd25736052a \
--form skip_parsing=false \
--form files.items='@example-file'[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file": "<string>",
"content_type": "application/pdf",
"computed_pdf_file": "<string>",
"source": "upload",
"source_metadata": {},
"page_count": 123,
"file_size": 123,
"metadata": [
[
"category",
"Finance"
],
[
"region",
"EMEA"
]
],
"collection": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]"
}
}
]{
"error": "User not found"
}{
"error": "Authentication credentials were not provided."
}{
"error": "You do not have permission to perform this action."
}Authorizations
Use Authorization: Bearer
Path Parameters
UUID of the project
Body
One or more files to upload
Optional JSON-encoded array of per-file metadata, aligned by position with
files. Each entry is itself a list of [key, value] string pairs for the
corresponding file, e.g.
[[["author","Alice"],["year","2024"]], [["author","Bob"]]].
The array length must equal the number of uploaded files. If the lengths do not match, all metadata is silently ignored and the files are uploaded without any metadata.
Optional collection (in this project) to upload every file into. Sets each
document's collection foreign key and writes the mirrored ["tag", slug]
pair. Omit to leave the documents in "Default".
Set to "true" to skip automatic parsing pipeline
true, false Response
Documents uploaded successfully
Document filename
URL to the document file
MIME type of the document
"application/pdf"
URL to generated PDF version (if applicable)
Origin of the document
upload, connector Metadata about the document source
Number of pages in the document
File size in bytes
List of key-value metadata pairs. Each element is a two-element array [key, value].
2 elements[["category", "Finance"], ["region", "EMEA"]]
The collection this document belongs to (the membership foreign key); null
means the "Default" (uncategorised) bucket. A mirrored ["tag", slug] pair is
also kept on metadata. Move a document with the set-collection action.
Show child attributes
Show child attributes
Document deletion status
active, deleting, deleted When the document was added to the project.
The user who uploaded the document. Only returned to callers with admin permission
on the project; null for non-admin callers. Also null for connector-imported
documents (which are attributed to the connector, not a person) and for documents
created before this was tracked.
Show child attributes
Show child attributes