Uploads (unified)
Single path for policy, complete, and direct upload. Pass resourceType and resourceId in the request body; constraints and access are validated per resource. Flow: 1) POST uploads/upload-policy → fileId + URL; 2) upload to URL; 3) POST uploads/upload-complete → attachment reference; 4) use reference when creating resource.
Upload policy
POST /api/v2/upload-policy
Returns fileId and presigned S3 policy. Send resourceType and resourceId in the body; constraints (content-type, size) are applied per resource. Upload to URL, then call upload-complete.
curl "https://api.markup.io/api/v2/upload-policy" \
-X POST \
-H "Authorization: Bearer <API-KEY-SECRET>" \
-H "Markup-API-Version: 2023-02-22" \
-H "Content-Type: application/json" \
--data '{
"resourceType": "message_attachment",
"resourceId": "some resourceId",
"filename": "some filename",
"contentType": "some contentType",
"filesize": 123
}'{
"data": {
"fileId": "some fileId",
"key": "some key",
"bucket": "some bucket",
"policy": {}
}
}Response Body UploadPolicyResponse
| Option | Type | |
|---|---|---|
| fileId | string | |
| key | string | |
| bucket | string | |
| policy | PresignedPost | |
| metadata | Record |
Request Body UploadPolicyRequest
| Option | Type | |
|---|---|---|
| resourceType | ||
| resourceId | string | |
| filename | string | |
| contentType | string | |
| filesize | number |
Complete upload
POST /api/v2/upload-complete
Confirms S3 upload. Send resourceType, resourceId (match policy), fileId, key, etag, etc. Returns attachment reference for create/update resource.
curl "https://api.markup.io/api/v2/upload-complete" \
-X POST \
-H "Authorization: Bearer <API-KEY-SECRET>" \
-H "Markup-API-Version: 2023-02-22" \
-H "Content-Type: application/json" \
--data '{
"fileId": "some fileId",
"etag": "some etag"
}'{
"data": {}
}Response Body “
| Option | Type |
|---|
Request Body UploadCompleteRequest
| Option | Type | |
|---|---|---|
| fileId | string | |
| etag | string |
Related types
UploadResourceType
| Option | Type | |
|---|---|---|
| UploadResourceType | `message_attachment` | `thread_screenshot` | `thread_snapshot` | `markup_asset` | `user_avatar` | `external_user_avatar` | `workspace_icon` |