Files#
The Files API allows you to upload documents that can be referenced across CasaPay resources, such as dispute evidence, collection case files, and identity documents.
The File object#
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier with file_ prefix |
object | string | Always "file" |
filename | string | Original filename |
purpose | enum | dispute_evidence, identity_document, invoice_pdf, collection_document, other |
size | integer | File size in bytes |
type | string | MIME type |
url | string | Signed download URL (expires in 1 hour) |
created | timestamp | Time at which the object was created |
{
"id": "file_abc123",
"object": "file",
"filename": "lease_agreement.pdf",
"purpose": "dispute_evidence",
"size": 245000,
"type": "application/pdf",
"url": "https://files.casapay.com/file_abc123?token=...",
"created": 1706140800
}Upload a File#
POST /v1/files
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
file | file | Yes | File to upload (max 50MB) |
purpose | string | Yes | File purpose |
curl https://api.casapay.com/v1/files \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-F "file=@lease_agreement.pdf" \
-F "purpose=dispute_evidence"Retrieve a File#
GET /v1/files/:id
curl https://api.casapay.com/v1/files/file_abc123 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"List Files#
GET /v1/files
| Parameter | Type | Description |
|---|---|---|
purpose | string | Filter by purpose |
limit | integer | Number of objects (1–100) |
curl "https://api.casapay.com/v1/files?purpose=dispute_evidence" \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"