MMS
Queue an outgoing MMS
Use this method to queue MMS messages. Can be used to send the same message body to multiple recipients.
Schemas
Request
| Name | Type | Description |
|---|---|---|
| body | String(1..4096) | Optional text body, required if no media is provided and should not be included if media is provided. |
| expires_at | String(format:date-time) | An ISO8601 timestamp denoting when the message should be considered expired and abort sending. Expired messages will not refund the cost of processing the message, even if it is never sent. |
| from | String(format:e164) | The sender number, or address that the message should originate from. If set to null or not present, a random number from the account will be used instead. Numbers may be in E.164 format (eg +17055551234), the preceding + will always be stripped internally. |
| id | String | Any user-supplied id string, it need not be unique, however it will only be used for tagging purposes and is not generally available for lookup. Users may provide this id, or the response’s id for inquiries or support. |
| media | Array:Queue MMS Request Media | Unlike SMS, MMS is made up of small media segments or attachments. This array allows supplying the media segments for the message. |
| request_dlr | Boolean | Whether or not a DLR should be requested. Note: some carriers may not return a DLR. |
| to | Array:String(format:e164) | Array of recipient phone numbers in E.164 format. Note: Multiple recipient numbers will results in multiple messages |
Response
| Name | Type | Description |
|---|---|---|
| results | Array:Object | Array of result objects, one for each recipient |
| results[].direction | String | Direction of the message, “OUTBOUND” for sent messages |
| results[].error_code | String | Status code of the operation, “OK” for success or an error code. |
| results[].expires_at | String(format:date-time) | ISO8601 timestamp when the message expires |
| results[].from | String(format:e164) | The sender phone number |
| results[].id | String | Unique identifier for the message |
| results[].origin_id | String | User-supplied ID passed in the request |
| results[].schedule_at | String(format:date-time) | ISO8601 timestamp when the message is scheduled to be sent |
| results[].status | String | Current status of the message |
| results[].timestamp | String(format:date-time) | ISO8601 timestamp of when the message was processed |
| results[].to | String(format:e164) | The recipient phone number |
| results[].type | String | The message type, “MMS” for multimedia messages |
Examples
Successful request
Everything is correct and functioning as expected.
Request:
POST: https://mms.swift-api.com/v1/mmsContent-Type: application/jsonAuthorization: Bearer ABC123
{ "body": "Hello, World", "expires_at": "2024-06-14T00:00:00.000000Z", "from": "12003004000", "id": "my-mms-message-2", "media": [ { "blob": "SGVsbG8sIFdvcmxk", "content_type": "image/png", "id": "image", "type": "BLOB", "url": "https://example.com/path/to/image.png" } ], "request_dlr": false, "to": [ "12003004001" ]}Response:
HTTP/1.1 200Content-Type: application/jsonContent-Length: 441
{ "results": [ { "direction": "OUTBOUND", "error_code": "OK", "expires_at": "2024-06-14T00:00:00.000000Z", "from": "12003004000", "id": "01JDQ11TSMA0SXCS4ZMEP5FVTP", "origin_id": "my-mms-message-2", "schedule_at": "2024-06-14T00:00:00.000000Z", "status": "NEW", "timestamp": "2024-06-14T00:00:00.000000Z", "to": "12003004001", "type": "MMS" } ]}Errored request
Occurs when there’s an issue with the request. Refer to the error_code field for details. A list of possible error codes can be found here.
HTTP/1.1 422Content-Type: application/jsonContent-Length: 441
{ "results": [ { "direction": "OUTBOUND", "error_code": "ACCOUNT_MMS_DISABLED", "expires_at": "2024-06-14T00:00:00.000000Z", "from": "12003004000", "id": "01JDQ11TSMA0SXCS4ZMEP5FVTP", "origin_id": "my-mms-message-2", "schedule_at": "2024-06-14T00:00:00.000000Z", "status": "NEW", "timestamp": "2024-06-14T00:00:00.000000Z", "to": "12003004001", "type": "MMS" } ]}Partial success
Occurs when there are successes and failures in the request.
HTTP/1.1 207Content-Type: application/jsonContent-Length: 441
{ "results": [ { "direction": "OUTBOUND", "error_code": "ACCOUNT_MMS_DISABLED", "expires_at": "2024-06-14T00:00:00.000000Z", "from": "12003004000", "id": "01JDQ11TSMA0SXCS4ZMEP5FVTP", "origin_id": "my-mms-message-2", "schedule_at": "2024-06-14T00:00:00.000000Z", "status": "NEW", "timestamp": "2024-06-14T00:00:00.000000Z", "to": "12003004001", "type": "MMS" } ]}