Attach and download a PDF
▾
Prepare your field and file
Copy the module table name and the CONTENT field's System name from the Designer. These examples use contract_pdf. Encode your PDF bytes as base64 and keep the decoded file at or below 10 MB. A larger file stops the request with 400 CONTENT_TOO_LARGE.
Attach inside a write
Send this as the create body. Replace <base64> with your encoded PDF; it is a placeholder, not file data. To attach it to an existing record, add its integer id and send the body to update.
{"module":"cm_equipment_requests_base","data":{"title":"Laptop","contract_pdf":{"fileName":"contract.pdf","contentType":"application/pdf","data":"<base64>"}}}For a multi-file field, wrap upload objects in an array. contentType is informational; the extension comes from fileName. Use an idempotency key on create or update if you need to retry the same write.
Read the reference
Call v4 get or query for the record and its file field. CONTENT returns one reference; multi-file fields return an array. Keep unstructuredId and module from the reference.
Download the PDF
Use the record's id for objectId. A reference can contain objectId: 0, which must not replace the record id.
curl --fail-with-body --silent --show-error \
'https://services.beezr.io/generic/api/v4/records/content' \
-H "X-API-Key: $BEEZR_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"unstructuredId": "a1b2c3d4",
"objectId": 482913,
"unstructuredModel": {"module":"cm_equipment_requests_base"}
}' \
--output contract.pdfA successful response is raw bytes. The samples save those bytes to contract.pdf. For errors, read the JSON envelope instead. CONTENT_NOT_FOUND means the file isn't attached to that record or the bytes are unavailable; CONTENT_TOO_LARGE means the download exceeds 10 MB.