๐Ÿ“Ž Attachments API: How to Use It

๐Ÿ” What is the Attachments API?

The Attachments API v2 allows you to retrieve files that have been uploaded and associated with Clara entities, such as transactions, invoices, or reimbursement requests.

Attachments may include receipts, invoices, approval files, or any supporting documentation. With this API, you can:

  • List all uploaded files
  • Retrieve metadata for a specific attachment
  • Download the attachment as a base64-encoded file

๐Ÿ“Œ Available Endpoints

OperationEndpointMethod
Get a list of attachments/v2/attachmentsGET
Get attachment metadata by UUID/v2/attachments/{uuid}GET
Get attachment file as base64/v2/attachments/{uuid}/base64GET

1๏ธโƒฃ Get a list of attachments

Use this endpoint to list all attachments available to your company. You can optionally filter by entity type or related ID.

๐Ÿ”— Endpoint

GET /v2/attachments

๐Ÿ“ค cURL Request

curl -X GET \
"https://public-api.mx.clara.com/api/v2/attachments" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

๐Ÿ“ฅ Sample JSON Response

[
  {
    "uuid": "attachment-001",
    "fileName": "receipt_q2.jpg",
    "entityUuid": "txn-123",
    "entityType": "TRANSACTION",
    "mimeType": "image/jpeg",
    "createdAt": "2025-06-10T18:22:00Z"
  }
]


2๏ธโƒฃ Get Single Attachment information with the pre signed URL

Use this to retrieve detailed metadata for a specific attachment by its UUID. This includes file name, type, entity association, and creation date.

๐Ÿ”— Endpoint

GET /v2/attachments/{uuid}

๐Ÿ“ค cURL Request

curl -X GET \
"https://public-api.mx.clara.com/api/v2/attachments/attachment-001" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

3๏ธโƒฃ Get Attachment File as Base64

Use this endpoint to download the file in base64 format, allowing you to render or store the file securely in your system

๐Ÿ”— Endpoint

GET /v2/attachments/{uuid}/base64

๐Ÿ“ค cURL Request

curl -X GET \
"https://public-api.mx.clara.com/api/v2/attachments/attachment-001/base64" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

๐Ÿ“ฅ Sample JSON Response

{
  "fileName": "receipt_q2.jpg",
  "mimeType": "image/jpeg",
  "base64": "/9j/4AAQSkZJRgABAQEAYABgAAD..."
}

๐Ÿ’ก Tip: You can use the base64 content to display the file inline in web or mobile apps, or decode and store it in your system.

โš ๏ธ Note: Attachments can be large. Avoid retrieving large batches unless necessary. Use pagination and lazy-loading in UIs where possible.