Upload file to a document
curl --request POST \
--url https://clarus-api.com/api/documents/{id}/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Disposition: <content-disposition>' \
--header 'Content-Type: application/octet-stream' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '<string>'import requests
url = "https://clarus-api.com/api/documents/{id}/upload"
payload = "<string>"
headers = {
"Content-Disposition": "<content-disposition>",
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Disposition': '<content-disposition>',
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/octet-stream'
},
body: '<string>'
};
fetch('https://clarus-api.com/api/documents/{id}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "documents",
"attributes": {
"category": "report",
"file_name": null,
"file_path": null,
"file_type": null,
"status": "queued",
"user_id": 1
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Documents
Upload file to a document
Upload binary file content to an existing document record. The document must be in queued or processing status. On success, the document status changes to available.
POST
/
api
/
documents
/
{id}
/
upload
Upload file to a document
curl --request POST \
--url https://clarus-api.com/api/documents/{id}/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Disposition: <content-disposition>' \
--header 'Content-Type: application/octet-stream' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '<string>'import requests
url = "https://clarus-api.com/api/documents/{id}/upload"
payload = "<string>"
headers = {
"Content-Disposition": "<content-disposition>",
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Disposition': '<content-disposition>',
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/octet-stream'
},
body: '<string>'
};
fetch('https://clarus-api.com/api/documents/{id}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "documents",
"attributes": {
"category": "report",
"file_name": null,
"file_path": null,
"file_type": null,
"status": "queued",
"user_id": 1
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Upload Format
This endpoint uses binary upload (not JSON:API format). Send the raw file content as the request body.Required Headers
| Header | Format | Example |
|---|---|---|
Content-Disposition | attachment; filename="<name>" | attachment; filename="report.csv" |
Content-Type | MIME type of the file | text/csv |
Example (cURL)
curl -X POST https://clarus-api.com/api/documents/42/upload \
-H 'Authorization: Bearer <token>' \
-H 'X-Clarus-Subdomain: acme-warehouse' \
-H 'Content-Disposition: attachment; filename="report.csv"' \
-H 'Content-Type: text/csv' \
--data-binary @report.csv
Status Transitions
- Document must be in
queuedorprocessingstatus - After successful upload, status becomes
available - If the document is already
availableorfailed, the upload will be rejected
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
FlowAuthorization Code
- Authorization URL
- https://clarus-api.com/oauth/authorize
- Token URL
- https://clarus-api.com/oauth/token
FlowClient Credentials
- Token URL
- https://clarus-api.com/oauth/token
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Headers
File name in the format: attachment; filename="report.csv"
Path Parameters
The unique identifier of the document to upload to
Body
application/octet-stream
Raw binary file content
Response
Document uploaded successfully
Show child attributes
Show child attributes

