POST /v1/media
Stage a file and get a transferId to attach to a message.
POST /v1/mediaUploads 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.send → attachment.
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
| Status | Code | Cause |
|---|---|---|
400 | filename_mimeType_bytesBase64_required | A required field is missing or empty. |
400 | invalid_base64_bytes | bytesBase64 is not valid base64. |
401 | unauthenticated | Missing or unusable credential. |
405 | method_not_allowed | Anything but POST. |
422 | validation message | The bytes or metadata were rejected. |
503 | line message | No connector available to receive it. |