Skip to main content
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>"'
{
  "data": {
    "id": 123,
    "type": "documents",
    "attributes": {
      "category": "report",
      "file_name": null,
      "file_path": null,
      "file_type": null,
      "status": "queued",
      "user_id": 1
    }
  }
}

Upload Format

This endpoint uses binary upload (not JSON:API format). Send the raw file content as the request body.

Required Headers

HeaderFormatExample
Content-Dispositionattachment; filename="<name>"attachment; filename="report.csv"
Content-TypeMIME type of the filetext/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 queued or processing status
  • After successful upload, status becomes available
  • If the document is already available or failed, the upload will be rejected

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Headers

Content-Disposition
string
required

File name in the format: attachment; filename="report.csv"

Path Parameters

id
integer
required

The unique identifier of the document to upload to

Body

application/octet-stream

Raw binary file content

Response

Document uploaded successfully

data
object