Attaching files to a Pega case via the DX API is a clean two-step process. First, upload the file to get a temporary GUID, then use that GUID to permanently link the file to the case. Built-in virus scanning runs automatically on Pega Cloud during the upload step — no extra configuration needed.
When attaching multiple files, scale the pattern predictably: upload each file individually to collect GUIDs, then batch all GUIDs into a single attach call. As a rule of thumb: N files = N + 1 total API calls (e.g., 3 files = 4 calls).
_________________________________________________________________
Step 1 — Upload the File
Endpoint:
POST api/application/v2/attachments/upload
Header:
Content-Type: multipart/form-data
Request Body:
Key: file
Value: <file content>
Success Response: Returns a GUID for the uploaded file.
Virus Scan Failure Response:
Can't continue with file attachment. File is missing and might have been quarantined by anti-malware software
If malware is detected, no GUID is returned and the file is rejected.
Step 2 — Attach the File to the Case
Endpoint:
POST api/application/v2/cases/{caseID}/attachments
Request Body:
{
"attachments": [
{
"attachmentFieldName": "fieldname",
"ID": "{GUID}",
"category": "Attachment",
"name": "filename",
"type": "File"
}
]
}
For multiple files, include all GUIDs as separate objects in the
attachmentsarray in a single call.