Create a batch of SMS messages
/v1/sms/batchesconst result = await bird.sms.sendBatch({
messages: [
{
from: "+15557654321",
to: "+15551111111",
text: "Hi Alice!",
category: "marketing",
},
{
from: "+15557654321",
to: "+15552222222",
text: "Hi Bob!",
category: "marketing",
},
],
});batch = client.sms.send_batch(
messages=[
{
"from_": "+15557654321",
"to": "+15551111111",
"text": "Hi Alice!",
"category": "marketing",
},
{
"from_": "+15557654321",
"to": "+15552222222",
"text": "Hi Bob!",
"category": "marketing",
},
]
)
for msg in batch.data:
print(msg.id, msg.status)batch, err := client.Sms.SendBatch(context.Background(), bird.SmsSendBatchParams{
Messages: []bird.SmsSendParams{
{
From: "+15557654321", To: "+15551111111",
Text: "Hi Alice!", Category: bird.SMSCategoryMarketing,
},
{
From: "+15557654321", To: "+15552222222",
Text: "Hi Bob!", Category: bird.SMSCategoryMarketing,
},
},
})
if err != nil {
log.Fatal(err)
}
for _, msg := range batch.Data {
fmt.Println(msg.Id, *msg.Status)
}$batch = $bird->sms->sendBatch(messages: [
(new SMSMessageSendRequest())
->setFrom('+15557654321')
->setTo('+15551111111')
->setText('Hi Alice!')
->setCategory('marketing'),
(new SMSMessageSendRequest())
->setFrom('+15557654321')
->setTo('+15552222222')
->setText('Hi Bob!')
->setCategory('marketing'),
]);
foreach ($batch->getData() ?? [] as $item) {
echo $item->getId(), ' ', $item->getStatus(), "\n";
}curl -X POST "https://us1.platform.bird.com/v1/sms/batches" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"to": "+15551111111",
"from": "+15557654321",
"text": "Hi Alice!",
"category": "marketing"
},
{
"to": "+15552222222",
"from": "+15557654321",
"text": "Hi Bob!",
"category": "marketing"
}
]
}'{
"data": [
{
"id": "sms_01krdgeqcxet5s7t44vh8rt9mg",
"direction": "outbound",
"status": "scheduled",
"to": "+15551234567",
"from": "+15557654321",
"text": "Your order has shipped and is on its way.",
"category": "transactional",
"requested_language": "pt-BR",
"resolved_language": "pt-BR",
"template_id": "smt_01krdgeqcxet5s7t44vh8rt9mg",
"template_version_id": "smv_01krdgeqcxet5s7t44vh8rt9mg",
"template_content_hash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"segments": {
"encoding": "GSM_7BIT"
},
"cost": {
"amount": "0.00990",
"currency_code": "USD",
"transaction_amount": "0.00790",
"passthrough_amount": "0.00200"
},
"tags": [
{
"name": "category",
"value": "welcome"
}
],
"options": {
"smart_encoding": true
},
"carrier": "Verizon",
"mcc_mnc": "311480",
"last_error": {
"code": "invalid_destination",
"description": "Carrier filtered as spam"
}
}
]
}
Sends up to 100 independent SMS messages in one request. Each item is a complete send request with its own recipient, content, ID, status, and cost. For a single message, use Send an SMS message instead.
Acceptance is all-or-nothing: every item is validated before any is queued,
and one invalid item rejects the whole batch with a 422 (nothing is
sent). A batch from a workspace with no wallet balance fails with a 402.
The 202 response lists the accepted messages in submission order; each
delivers asynchronously and is tracked individually, like a single send.
Request Payload
messagesSMS message send requests, up to 100. Each is an independent send; all are validated before any is queued.
Show child parameters
messages.toRecipient phone number in E.164 format (for example +14155550100). One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a 422 SMSInvalidRecipient.
messages.fromSender to send from. It must be a sender the workspace holds: a number it owns in E.164, such as +15557654321, a short code it holds, such as 24680, or an alphanumeric sender ID it has claimed, such as MyBrand. A sender the workspace does not hold returns a 422 SMSSenderNotConfigured, and an alphanumeric sender must also be permitted, and where required registered, for the destination country. Required on a free-text send and when sending a workspace template. Omitting it in either case returns 422. A built-in template selects its sender automatically and rejects from.
messages.textFree-text message body. Required unless template is supplied (the two are mutually exclusive). At least 1 character, up to a 12-segment cap (roughly 1836 GSM-7 or 804 UCS-2 characters). Bird does not truncate; a body exceeding 12 segments is rejected with a 422. The cap applies to segments because GSM-7 and UCS-2 encodings differ in characters per segment.
messages.categoryContent classification: why you are sending. Required on a free-text send; omit it on a template send, where the category is derived from the template. Where the destination country requires the sender to be registered, a category outside what that registration covers returns a 422 SenderCategoryNotPermitted.
messages.validity_periodPreview feature: how long, in seconds (60-172800), the carrier may keep attempting delivery before the message is marked expired. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.tagsStructured {name, value} labels for filtering and analytics. Tags become first-class query dimensions: filter the list endpoint by tag name, slice analytics by tag, and surface in webhook payloads. Maximum 20 tags per send. Use tags for low-cardinality dimensions (category, experiment_variant). For arbitrary structured context you do not need as a filter dimension, use metadata instead.
Show child parameters
messages.tags.nameTag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
messages.tags.valueTag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
messages.metadataArbitrary JSON object stored on the message, returned on API reads, and echoed in webhook payloads. Maximum 2 KB serialized. Use metadata for per-send context like internal IDs and foreign keys. For low-cardinality filterable labels, use tags instead.
messages.optionsWhat Bird does to this message on its way out, such as smart_encoding. The message being relayed stays at the top level: its recipient, sender, content, and the delivery instructions the carrier acts on.
Show child parameters
messages.options.smart_encodingReplace characters outside the GSM-7 alphabet with their closest GSM-7 equivalent before sending: typically curly quotes, dashes, ellipses, fullwidth forms, and non-breaking spaces.
One such character forces the whole body into UCS2, which more than halves the characters that fit in a segment, so replacing them often lowers the segment count and the cost.
Disabled by default, because it alters the body you composed. The replacement is all-or-nothing: a body that still holds a character outside the alphabet afterwards, such as an emoji or a non-Latin script, is sent exactly as you supplied it. Read the message back to see what was applied: text is the body as sent.
messages.options.track_clicksPreview feature: link click tracking. Defaults to false. Currently unavailable; setting this to true returns 422 SMSUnsupportedFeature.
messages.options.max_price_per_segmentPreview feature: per-segment price ceiling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.media_urlsPreview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.messaging_profile_idPreview feature: sender selection from a messaging profile pool. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.scheduled_atPreview feature: send-later scheduling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.broadcast_idPreview feature: broadcast correlation. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.campaign_idPreview feature: campaign correlation for analytics. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.audience_idPreview feature: audience-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.contact_idPreview feature: contact-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.topic_idPreview feature: topic-gated sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.personalizationPreview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.toRecipient phone number in E.164 format (for example +14155550100). One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a 422 SMSInvalidRecipient.
messages.fromSender to send from. It must be a sender the workspace holds: a number it owns in E.164, such as +15557654321, a short code it holds, such as 24680, or an alphanumeric sender ID it has claimed, such as MyBrand. A sender the workspace does not hold returns a 422 SMSSenderNotConfigured, and an alphanumeric sender must also be permitted, and where required registered, for the destination country. Required on a free-text send and when sending a workspace template. Omitting it in either case returns 422. A built-in template selects its sender automatically and rejects from.
messages.categoryContent classification: why you are sending. Required on a free-text send; omit it on a template send, where the category is derived from the template. Where the destination country requires the sender to be registered, a category outside what that registration covers returns a 422 SenderCategoryNotPermitted.
messages.validity_periodPreview feature: how long, in seconds (60-172800), the carrier may keep attempting delivery before the message is marked expired. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.tagsStructured {name, value} labels for filtering and analytics. Tags become first-class query dimensions: filter the list endpoint by tag name, slice analytics by tag, and surface in webhook payloads. Maximum 20 tags per send. Use tags for low-cardinality dimensions (category, experiment_variant). For arbitrary structured context you do not need as a filter dimension, use metadata instead.
Show child parameters
messages.tags.nameTag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
messages.tags.valueTag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
messages.metadataArbitrary JSON object stored on the message, returned on API reads, and echoed in webhook payloads. Maximum 2 KB serialized. Use metadata for per-send context like internal IDs and foreign keys. For low-cardinality filterable labels, use tags instead.
messages.optionsWhat Bird does to this message on its way out, such as smart_encoding. The message being relayed stays at the top level: its recipient, sender, content, and the delivery instructions the carrier acts on.
Show child parameters
messages.options.smart_encodingReplace characters outside the GSM-7 alphabet with their closest GSM-7 equivalent before sending: typically curly quotes, dashes, ellipses, fullwidth forms, and non-breaking spaces.
One such character forces the whole body into UCS2, which more than halves the characters that fit in a segment, so replacing them often lowers the segment count and the cost.
Disabled by default, because it alters the body you composed. The replacement is all-or-nothing: a body that still holds a character outside the alphabet afterwards, such as an emoji or a non-Latin script, is sent exactly as you supplied it. Read the message back to see what was applied: text is the body as sent.
messages.options.track_clicksPreview feature: link click tracking. Defaults to false. Currently unavailable; setting this to true returns 422 SMSUnsupportedFeature.
messages.options.max_price_per_segmentPreview feature: per-segment price ceiling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.media_urlsPreview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.messaging_profile_idPreview feature: sender selection from a messaging profile pool. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.scheduled_atPreview feature: send-later scheduling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.templateSend using a stored template instead of free text. The category is derived from the template, so category and media_urls are rejected. A workspace template requires from; a built-in template selects its sender and rejects from.
Show child parameters
messages.template.idThe workspace or built-in template to send, by ID.
messages.template.languageWhich of the template's languages to send. Omit it to send the template's default language, unless the template sets language_source_required, in which case a send naming no language is rejected. When the template does not carry the language you ask for, its own on_missing_language setting decides whether the closest available language is sent instead or the send is rejected.
messages.template.parametersValues for the template's variables, keyed by variable name. Read the live version to see the accepted keys and formats. A missing key, an undeclared key, an invalid value, or a serialized object over 16 KiB returns 422.
messages.template.slugThe workspace or built-in template to send, by its immutable slug. Read the template's live version to see its variables.
messages.template.languageWhich of the template's languages to send. Omit it to send the template's default language, unless the template sets language_source_required, in which case a send naming no language is rejected. When the template does not carry the language you ask for, its own on_missing_language setting decides whether the closest available language is sent instead or the send is rejected.
messages.template.parametersValues for the template's variables, keyed by variable name. Read the live version to see the accepted keys and formats. A missing key, an undeclared key, an invalid value, or a serialized object over 16 KiB returns 422.
messages.template.nameDeprecated. Use slug instead. This resolves legacy built-in catalogue names and never matches a workspace template's display name.
messages.template.languageWhich of the template's languages to send. Omit it to send the template's default language, unless the template sets language_source_required, in which case a send naming no language is rejected. When the template does not carry the language you ask for, its own on_missing_language setting decides whether the closest available language is sent instead or the send is rejected.
messages.template.parametersValues for the template's variables, keyed by variable name. Read the live version to see the accepted keys and formats. A missing key, an undeclared key, an invalid value, or a serialized object over 16 KiB returns 422.
messages.broadcast_idPreview feature: broadcast correlation. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.campaign_idPreview feature: campaign correlation for analytics. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.audience_idPreview feature: audience-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.contact_idPreview feature: contact-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.topic_idPreview feature: topic-gated sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messages.personalizationPreview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
Response Payload
dataOne entry per message in the batch, in submission order.
Show child attributes
data.idID of the message, assigned when the send is accepted. Pass it as message_id to the get-message endpoint.
data.directionWhether the message was sent from a Bird sender (outbound) or received from a subscriber (inbound).
Possible values: outbound, inbound
data.statusdata.toWhere the message went. On an outbound message this is the recipient's phone number in E.164 format; on an inbound one it is your own number that received it.
data.fromWhere the message came from. On an outbound message this is the sender you sent it from: an E.164 number, an alphanumeric sender ID, or a short code. On an inbound message, this is the phone number that sent it to you.
data.textThe message body. Every message carries body text, attachments, or both, so this is absent only on a received message that carried attachments and no text. For a template send, this is the rendered text after parameter substitution. When category is authentication (a message carrying a one-time code), this is **REDACTED**: the code still reaches the recipient, but the API does not retain it for later reads.
data.categoryContent classification supplied for free text or derived from the template. Null for inbound messages.
data.requested_languageThe template language requested by the send, in canonical form. Null when the send named no language or used no template.
data.resolved_languageThe template language whose text was rendered, in canonical form. Null when the send used no template. This can differ from requested_language when the template's fallback policy selects another language.
data.template_idThe template rendered for this message, or null for a free-text message.
data.template_version_idThe workspace published version or synthetic built-in version rendered at acceptance, or null for a free-text message. For a built-in template, template_content_hash identifies the exact catalogue source.
data.template_content_hashThe rendered language's source fingerprint, or null for a free-text message.
data.segmentsSegment breakdown for the body.
Show child attributes
data.segments.countNumber of segments the body is split into. Each segment is a billable unit.
data.segments.encodingEncoding used for the body. The GSM_7BIT encoding fits 160 septets
(seven-bit units) in one segment, or 153 per part in a multi-segment
message. The UCS2 encoding applies when the body contains a character
outside the GSM 03.38 alphabet, including emoji, CJK, and some accented
characters. It fits 70 UTF-16 code units in one segment, or 67 per part.
Neither limit counts characters, and both alphabets have characters that
cost two units. Under GSM_7BIT there are ten such entries, and they are
the whole set: ^, {, }, \, [, ], ~, |, €, and the form
feed control. Eighty of those fill a single segment. Under UCS2 an emoji
outside the Basic Multilingual Plane is a surrogate pair costing two code
units, so 35 of those fill a single segment.
Possible values: GSM_7BIT, UCS2
data.segments.charactersCharacter count of the body, counted in Unicode code points under either encoding. This is not the segment measure: a GSM_7BIT extended-table character counts once here but costs two septets, and a UCS2 emoji outside the Basic Multilingual Plane counts once here but costs two of the segment's 70 code units.
data.costWhat the message cost, split into Bird's charge and any third-party fees passed through. Null until the message has been priced.
Show child attributes
data.cost.amountTotal charged, as a decimal string: the sum of the components below. Net of tax, which applies to your wallet balance rather than to an individual charge.
data.cost.currency_codeISO 4217 currency code. Every component is denominated in this currency.
data.cost.transaction_amountWhat we charged to carry the message, as a decimal string. null when this component was not priced; "0.00000" when it priced at zero.
data.cost.passthrough_amountThird-party fees we pass on, as a decimal string, such as US 10DLC carrier surcharges. null when this component was not priced; "0.00000" when it priced at zero.
data.tagsStructured {name, value} filter labels applied to this message.
Show child attributes
data.tags.nameTag name. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 32 characters.
data.tags.valueTag value. ASCII letters, digits, underscore, and hyphen only. Case-sensitive. Maximum 64 characters.
data.metadataArbitrary JSON metadata stored on the message and echoed in webhook payloads.
data.optionsThe settings applied to this message, with any option you omitted filled in with the default in force when you sent it. Absent on inbound messages, and on any outbound message for which no settings were recorded.
Show child attributes
data.options.smart_encodingWhether Bird replaced characters outside the GSM-7 alphabet in this message's body with their closest equivalent before sending it. When true, text is the body as sent and segments describes that body.
data.validity_periodPreview feature: how long, in seconds, the carrier may keep attempting delivery before the message is marked expired. Not returned yet.
data.carrierCarrier that handled the message. Absent until a delivery receipt identifies it, and on a received message the carrier reports it only where a carrier fee applies.
data.mcc_mncMobile country code and mobile network code of the carrier. Absent until the carrier is identified.
data.last_errorFailure detail on a message that failed, was rejected, was not delivered, or expired. Absent otherwise.
Show child attributes
data.last_error.codeStandardized failure reason:
invalid_destination: The number is unassigned, ported out, or malformed.unreachable: The handset is off or outside coverage.blocked_by_carrier: The carrier filtered the message.blocked_by_fraud_protection: Bird fraud protection blocked suspected SMS pumping.blocked_by_recipient: The recipient device blocked the sender.landline_unreachable: The destination is a landline that does not accept SMS.content_rejected: The carrier rejected the content.sender_unregistered: The sender is not registered for the destination.recipient_opted_out: The recipient is on a suppression list.provider_unavailable: The provider remained unavailable after retries.insufficient_balance: The workspace wallet could not fund the send.unknown: The failure could not be classified.
This is an open enum. Accept unrecognized values.
Possible values (may grow over time): invalid_destination, unreachable, blocked_by_carrier, blocked_by_fraud_protection, blocked_by_recipient, landline_unreachable, content_rejected, sender_unregistered, recipient_opted_out, provider_unavailable, insufficient_balance, unknown
data.last_error.descriptionThe failure in words: the provider's reason text, or Bird's explanation for a fraud protection block or a message refused before submission. Free-form, so branch on code and show this to a human.
data.last_error.carrier_error_codeRaw provider-supplied error code, finer-grained than the code that normalizes it. Not a Bird-defined value, so quote it to support when asking why a message failed. Null when the provider sent none, including any failure decided before one was reached.
data.last_error.occurred_atWhen the failure occurred.
data.created_atWhen the message was accepted (outbound) or received (inbound).
data.sent_atWhen the message was handed to the carrier. Null until then.
data.delivered_atWhen delivery was confirmed. Null until then.
summaryAggregate result for the batch.
Show child attributes
summary.accepted_countNumber of messages accepted in the batch. Acceptance is all-or-nothing, so this equals the number of messages submitted.
Related resources
Continue with the documentation, guides and examples for this topic.