Skip to main content
PATCH
/
upload
/
batch_update
Batch Update
curl --request PATCH \
  --url https://api.usecortex.ai/upload/batch_update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'source_ids[0]=CortexDoc1234' \
  --form 'source_ids[1]=CortexDoc4567' \
  --form 'tenant_metadata=<string>' \
  --form 'document_metadata=<string>'
{
  "uploaded": [
    {
      "file_id": "CortexDoc1234",
      "filename": "document1.pdf"
    },
    {
      "file_id": "CortexDoc4567",
      "filename": "document2.docx"
    }
  ],
  "message": "<string>",
  "success": true
}
Hit the Try it button to try this API now in our playground. It’s the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.

Sample Request

curl --request PATCH \
  --url 'https://api.usecortex.ai/upload/batch_update?tenant_id=tenant_1234&sub_tenant_id=sub_tenant_4567' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: multipart/form-data' \
  --form files=@example-file \
  --form 'source_ids=[
  "<string>"
]' \
  --form 'tenant_metadata={}' \
  --form 'document_metadata={}'
Update multiple sources in bulk, creating new entries for any source_id that doesn’t exist (upsert operation).
Provide one source_id per file. The number of source_ids must match the number of files.

Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our Error Responses documentation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

tenant_id
string
required

Unique identifier for the tenant/organization

Example:

"tenant_1234"

sub_tenant_id
string
default:""

Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used.

Example:

"sub_tenant_4567"

Body

multipart/form-data
files
file[]
required

The document file to upload (e.g., PDF, DOCX, TXT)

source_ids
string[] | null

List of source IDs corresponding to the files being updated

Example:
["CortexDoc1234", "CortexDoc4567"]
tenant_metadata
string | null
default:{}

JSON string containing tenant-level document metadata (e.g., department, compliance_tag)

Example: > "{"department":"Finance","compliance_tag":"GDPR"}"

document_metadata
string | null
default:{}

JSON string containing document-specific metadata (e.g., title, author, file_id). If file_id is not provided, the system will generate an ID automatically.

Example: > "{"title":"Q1 Report.pdf","author":"Alice Smith","file_id":"custom_file_123"}"

Response

Successful Response

uploaded
FileUploadResult · object[]
required

List of successfully uploaded files for processing

Example:
[
{
"file_id": "CortexDoc1234",
"filename": "document1.pdf"
},
{
"file_id": "CortexDoc4567",
"filename": "document2.docx"
}
]
message
string
required

Status message indicating batch document parsing scheduled

success
boolean
default:true
Example:

true

I