Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.chamelio.ai/llms.txt

Use this file to discover all available pages before exploring further.

Endpoint

PATCH /core/files/{file_id}/attributes

Authentication

This endpoint requires authentication via API key. Include your API key in the X-API-Key header:
X-API-Key: ca_your_api_key_here

Path Parameters

ParameterTypeDescription
file_idstringUnique identifier of the document whose attributes you want to update

Request Body

The request body must be a JSON object with the following fields:

Required Fields

FieldTypeDescription
attributesarrayList of metadata attributes to set on the document. Existing attributes with the same name will be overwritten; new attributes will be added

Attribute Object

Each object in the attributes array contains:
FieldTypeDescription
namestringName of the metadata field (e.g., “contract_type”, “effective_date”)
data_typestringType of the field. Allowed values: text, date, number, boolean, link
valuestringValue of the metadata field (formatted as a string regardless of data_type)

Request Example

curl -X PATCH https://platform.chamelio.ai/core/files/file_abc123/attributes \
  -H "X-API-Key: ca_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "attributes": [
      {
        "name": "contract_type",
        "data_type": "text",
        "value": "Non-Disclosure Agreement"
      },
      {
        "name": "effective_date",
        "data_type": "date",
        "value": "2025-06-01"
      },
      {
        "name": "contract_value",
        "data_type": "number",
        "value": "50000"
      },
      {
        "name": "auto_renew",
        "data_type": "boolean",
        "value": "false"
      }
    ]
  }'

Response

Success Response

Status Code: 200 OK
{
  "file_id": "file_abc123",
  "status": "success",
  "updated_attributes": [
    "contract_type",
    "effective_date",
    "contract_value",
    "auto_renew"
  ]
}

Response Fields

FieldTypeDescription
file_idstringUnique identifier of the updated document
statusstringUpdate status (always “success” for successful updates)
updated_attributesarrayList of attribute names that were created or updated

Error Responses

401 Unauthorized

Returned when authentication fails. See the authentication errors section for details.
{
  "detail": "Invalid API key"
}

404 Not Found

Returned when the specified file does not exist or is not accessible with your API key.
{
  "detail": "File not found"
}

422 Validation Error

Returned when the request body is invalid or contains unsupported attribute types.
{
  "detail": [
    {
      "loc": ["body", "attributes", 0, "data_type"],
      "msg": "value is not a valid enum member; permitted: 'text', 'date', 'number', 'boolean', 'link'",
      "type": "type_error.enum"
    }
  ]
}

500 Internal Server Error

Returned when the attribute update fails due to a server error.
{
  "detail": "Failed to update attributes: Internal processing error"
}

Notes

This endpoint uses a merge strategy: attributes you provide are added or overwritten, while attributes not included in the request are left unchanged. To remove an attribute entirely, contact support.
Use the same data_type values consistently for a given attribute name across documents. Mixing types for the same field name may cause unexpected behavior in filters and reports.

Use Cases

This endpoint is useful for:
  • Post-upload enrichment - Add or correct metadata after a document has been processed
  • Bulk attribute updates - Programmatically update attributes across many documents via automation
  • Workflow integration - Update document metadata as part of a downstream workflow (e.g., after review or signing)
  • Data correction - Fix incorrect attribute values without re-uploading the document