POST /v1/media

Stage a file and get a transferId to attach to a message.

POST /v1/media

Uploads a file to Mapier storage and returns a transferId. That id is how an attachment is referenced when sending — a command body never carries bytes. See message.sendattachment.

Request

JSON, with the file base64-encoded.

curl $MAPIER_BASE_URL/v1/media \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "card.vcf",
    "mimeType": "text/vcard",
    "bytesBase64": "'"$(base64 < card.vcf)"'"
  }'

Prop

Type

Response

{ "transferId": "1f607047-a3e6-4521-8dcd-b3754cf28c74" }

Reference transferId from message.send as { "kind": "attachment", "transferId": "..." }. The staged file is delivered to the sending Mac and attached when the command runs.

Stage before you send. The bytes must reach the sending Mac before the attachment command runs; a send that references media still in flight settles failed on the response stream.

Errors

StatusCodeCause
400filename_mimeType_bytesBase64_requiredA required field is missing or empty.
400invalid_base64_bytesbytesBase64 is not valid base64.
401unauthenticatedMissing or unusable credential.
405method_not_allowedAnything but POST.
422validation messageThe bytes or metadata were rejected.
503line messageNo connector available to receive it.

On this page