Upload media▾
POST

Upload media

Upload a file once and reuse its id across sends.

Send multipart/form-data, not JSON. Uploaded media is retained for 30 days. For anything you send repeatedly, uploading beats passing a link — Meta re-downloads a link on every send.

cURL
curl -X POST https://api.sendport.tech/v1/media \
  -H "Authorization: Bearer $SENDPORT_KEY" \
  -F "type=image" \
  -F "file=@receipt-A-4417.jpg"
POST/v1/media

Body parameters

filefilerequired

The binary. See size caps below.

typeenumrequired

Media kind.

imagedocumentaudiovideosticker

filenamestring

Document only — the name shown to the recipient.

curl -X POST https://api.sendport.tech/v1/media \
  -H "Authorization: Bearer $SENDPORT_KEY"

Responses

201Created
{
  "object": "media",
  "id": "med_01JZQ8T0X5K2M4P6R8T0V2XACE",
  "mime_type": "image/jpeg",
  "sha256": "9d4c2f1a7b8e0d3c6a5f4e2b1c0d9a8f7e6b5c4d3a2f1e0b9c8d7a6f5e4b3c2d",
  "file_size": 184320,
  "filename": "receipt-A-4417.jpg",
  "expires_at": "2026-10-06T09:14:22.114Z",
  "created_at": "2026-09-06T09:14:22.114Z"
}
400Too large
{
  "error": {
    "type": "invalid_request_error",
    "code": "media_too_large",
    "message": "Images are capped at 5 MB; the upload was 8.4 MB.",
    "param": "file",
    "doc_url": "https://sendport.tech/docs/errors#media_too_large",
    "request_id": "req_1d7e4b3a09c2f856d4a1"
  }
}
401Unauthorized
{
  "error": {
    "type": "authentication_error",
    "code": "missing_api_key",
    "message": "No API key provided.",
    "doc_url": "https://sendport.tech/docs/errors#missing_api_key",
    "request_id": "req_9f3c2a7b41de08c5b2e6"
  }
}