POST
/services/data/v54.0/composite/tree/AttachmentUpload Attachments
Upload supporting documents for a sub-merchant application.
Requirements:
- Opportunity ID is required (ParentId field)
- Files must be Base64 encoded
- Maximum file size: 100 MB per file
Supported File Types:
- PDF documents
- Images (JPEG, PNG, etc.)
- Text files
Process:
- Convert file to Base64
- Include ParentId (Opportunity ID from create response)
- Provide descriptive file name with extension
Request Body
Content type: application/json
Required1 field
recordsarray<object>Array of attachment records to upload
minItems=1
Enums (1)
records[].attributes.type
Attachment
Validations (3)
records
minItems=1
records[].ParentId
pattern=^[a-zA-Z0-9]{15,18}$
records[].body
format=byte
Response
200
Success
Common2 fields
hasErrorsbooleanIndicates if any errors occurred during upload
resultsarray<object>Attachment Requirements
- ParentId (Opportunity ID) is required
- File size limit: 100 MB per file
- Files must be Base64 encoded in the body field
- Provide a descriptive file name with extension
- Supported file types: PDF, JPEG, PNG, text files
- Each attachment needs a unique referenceId
Code samples
Copy-paste ready code in your preferred language.
API call
Copy/paste friendly
curl -X POST "https://merchante-solutions--cert.my.salesforce.com/services/data/v54.0/composite/tree/Attachment" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"records": [
{
"attributes": {
"type": "Attachment",
"referenceId": "attachment0"
},
"ParentId": "YOUR_OPPORTUNITY_ID",
"Name": "business_license.pdf",
"body": "BASE64_ENCODED_FILE_CONTENT"
}
]
}'