Skip to Content
APIResourcesAdmin APIUploads (unified)

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.

POST /api/v2/upload-policy
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 }'
200 OK
{ "data": { "fileId": "some fileId", "key": "some key", "bucket": "some bucket", "policy": {} } }

Response Body UploadPolicyResponse

OptionType
fileId string
key string
bucket string
policy PresignedPost
metadata Record

Request Body UploadPolicyRequest

OptionType
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.

POST /api/v2/upload-complete
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" }'
200 OK
{ "data": {} }

Response Body “

OptionType

Request Body UploadCompleteRequest

OptionType
fileId string
etag string

UploadResourceType

OptionType
UploadResourceType `message_attachment` | `thread_screenshot` | `thread_snapshot` | `markup_asset` | `user_avatar` | `external_user_avatar` | `workspace_icon`