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#

AttributeTypeDescription
idstringUnique identifier with file_ prefix
objectstringAlways "file"
filenamestringOriginal filename
purposeenumdispute_evidence, identity_document, invoice_pdf, collection_document, other
sizeintegerFile size in bytes
typestringMIME type
urlstringSigned download URL (expires in 1 hour)
createdtimestampTime 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

ParameterTypeRequiredDescription
filefileYesFile to upload (max 50MB)
purposestringYesFile 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

ParameterTypeDescription
purposestringFilter by purpose
limitintegerNumber of objects (1–100)
curl "https://api.casapay.com/v1/files?purpose=dispute_evidence" \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"