Create an SMS message
/v1/sms/messagesconst msg = await bird.sms.send({
from: "+15557654321",
to: "+14155550100",
text: "Your verification code is 123456.",
category: "authentication",
});
console.log(msg.id, msg.status);msg = client.sms.send(
from_="+15557654321",
to="+15551234567",
text="Your verification code is 123456.",
category="authentication",
)
print(msg.id, msg.status)msg, err := client.Sms.Send(context.Background(), bird.SmsSendParams{
From: "+15557654321",
To: "+15551234567",
Text: "Your verification code is 123456.",
Category: bird.SMSCategoryAuthentication,
})
if err != nil {
log.Fatal(err)
}
fmt.Println(msg.Id, *msg.Status)$message = $bird->sms->send(
from: '+15557654321',
to: '+15551234567',
text: 'Your verification code is 123456.',
category: 'authentication',
);
echo $message->getId(), ' ', $message->getStatus();bird sms send --body-file - <<'JSON'
{
"to": "+14155550100",
"from": "+15557654321",
"text": "Your verification code is 123456.",
"category": "authentication",
"options": {
"smart_encoding": true
},
"tags": [
{
"name": "campaign",
"value": "signup"
}
],
"metadata": {
"user_id": "usr_12345"
}
}
JSONcurl -X POST "https://us1.platform.bird.com/v1/sms/messages" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "+14155550100",
"from": "+15557654321",
"text": "Your verification code is 123456.",
"category": "authentication",
"options": {
"smart_encoding": true
},
"tags": [
{
"name": "campaign",
"value": "signup"
}
],
"metadata": {
"user_id": "usr_12345"
}
}'{
"id": "sms_01krdgeqcxet5s7t44vh8rt9mg",
"direction": "outbound",
"status": "scheduled",
"to": "+15551234567",
"from": "+15557654321",
"text": "Your order has shipped and is on its way.",
"binary": {
"udh": "0605041582158A",
"data": "C0FFEE"
},
"category": "transactional",
"requested_language": "pt-BR",
"resolved_language": "pt-BR",
"template_id": "smt_01krdgeqcxet5s7t44vh8rt9mg",
"template_version_id": "smv_01krdgeqcxet5s7t44vh8rt9mg",
"template_content_hash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"messaging_profile_id": "mpr_01krdgeqcxet5s7t44vh8rt9mg",
"segments": {
"count": 1,
"encoding": "GSM_7BIT",
"characters": 41
},
"cost": {
"amount": "0.00990",
"currency_code": "USD",
"transaction_amount": "0.00790",
"passthrough_amount": "0.00200"
},
"tags": [
{
"name": "category",
"value": "welcome"
}
],
"options": {
"smart_encoding": true
},
"reference": "INV-1234",
"cost_center": "CC001234",
"carrier": "Verizon",
"mcc_mnc": "311480",
"last_error": {
"code": "invalid_destination",
"description": "Carrier filtered as spam"
},
"country_code": "US",
"in_reply_to_message": {
"id": "sms_01krdgeqcxet5s7t44vh8rt9mg",
"text": "Reply YES to confirm your appointment on Friday.",
"sent_at": "2026-10-22T10:14:04.001Z"
},
"created_at": "2026-05-21T12:00:00Z"
}
Sends one SMS to one recipient with exactly one content form: text, which
requires category and from, or a stored template, which supplies its
category. A workspace template requires from, while a built-in template
selects its sender. To submit up to 100 independent messages in one request, use
Send a batch of SMS messages
instead.
The 202 Accepted response means the API durably accepted the message for
asynchronous delivery. Delivery remains pending; follow it with
Get an SMS message or by subscribing
to sms.* webhook events.
An invalid field, more than 12 segments, a disabled destination country, or
a sender not permitted for the destination returns 422. Insufficient
wallet balance returns 402.
请求载荷
toRecipient phone number in E.164 format (for example +14155550100), or in national format when you also pass to_country_code. One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a 422 SMSInvalidRecipient.
to_country_codeThe ISO 3166-1 alpha-2 country whose national numbering plan to is written in, such as NL for 0612345678. Bird converts to to E.164 before checking the destination, price and sender. An E.164 to is still accepted when its country calling code matches this country; a mismatch, or a national number that is not valid in this country, returns a 422 SMSInvalidRecipient. Omit it to send to in E.164.
fromSender the workspace holds: a number it owns in E.164, such as +15557654321, a short code, such as 24680, or an alphanumeric sender ID it has claimed, such as MyBrand. Any other sender returns 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 a workspace-template send, unless the profile in messaging_profile_id selects a sender for the destination country or has a default sender; omitting it otherwise returns 422. A built-in template selects its sender itself and rejects from.
textFree-text message body, required unless template is set; the two are mutually exclusive. From 1 character up to 12 segments, roughly 1836 GSM-7 or 804 UCS-2 characters, since the two encodings fit different numbers of characters in a segment. Bird does not truncate: a longer body returns 422.
categoryContent classification: why you are sending. Required on a free-text send unless the messaging profile in messaging_profile_id sets a default category; 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.
Possible values: transactional, marketing, authentication, service
validity_periodHow long, in seconds (60-172800), the message may wait for delivery after acceptance. Bird does not submit it to the carrier after that deadline, and passes the remaining time to the carrier where the route supports it. A message that misses the deadline before reaching the carrier ends rejected or failed; expired comes only from a carrier report. Omit it to use the validity period of the profile in messaging_profile_id, or the carrier's own rules when the profile sets none.
referenceAn identifier you want to find this message by, such as an order or ticket number, matched exactly by the message list's reference filter. Set it only when you need to search on it, and put any other data in metadata. Stored on the message, returned on reads and echoed in webhook payloads. Several messages can share one.
cost_centerYour accounting identifier for this message, such as a department code. Stored on the message and its usage record, returned on reads, and echoed in webhook payloads. Omit it to use the cost center of the messaging profile in messaging_profile_id. Accepting it does not change how the message is priced.
tagsStructured {name, value} labels, up to 20 per send. You can filter the list endpoint by tag name, slice analytics by tag, and read them in webhook payloads. Use them for low-cardinality dimensions such as category or experiment_variant, and metadata for context you do not filter by.
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.
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.
media_urlsPreview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messaging_profile_idThe messaging profile that supplies this message's sender and defaults. Without from, Bird sends from the profile's sender for the destination country, or its default sender. An omitted category on a free-text send, smart_encoding, cost_center, validity_period, options.callback_url and options.ignore_suppression take the profile's settings, and values set on the message take precedence. A built-in template sends from Bird's system sender and ignores the profile's senders. A profile that does not exist in this workspace returns 422 SMSMessagingProfileNotFound, and a from bound to a different profile returns 422 SMSMessagingProfileSenderBound.
scheduled_atPreview feature: send-later scheduling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
broadcast_idPreview feature: broadcast correlation. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
campaign_idPreview feature: campaign correlation for analytics. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
audience_idPreview feature: audience-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
contact_idPreview feature: contact-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
topic_idPreview feature: topic-gated sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
personalizationPreview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
toRecipient phone number in E.164 format (for example +14155550100), or in national format when you also pass to_country_code. One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a 422 SMSInvalidRecipient.
to_country_codeThe ISO 3166-1 alpha-2 country whose national numbering plan to is written in, such as NL for 0612345678. Bird converts to to E.164 before checking the destination, price and sender. An E.164 to is still accepted when its country calling code matches this country; a mismatch, or a national number that is not valid in this country, returns a 422 SMSInvalidRecipient. Omit it to send to in E.164.
fromSender the workspace holds: a number it owns in E.164, such as +15557654321, a short code, such as 24680, or an alphanumeric sender ID it has claimed, such as MyBrand. Any other sender returns 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 a workspace-template send, unless the profile in messaging_profile_id selects a sender for the destination country or has a default sender; omitting it otherwise returns 422. A built-in template selects its sender itself and rejects from.
categoryContent classification: why you are sending. Required on a free-text send unless the messaging profile in messaging_profile_id sets a default category; 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.
Possible values: transactional, marketing, authentication, service
validity_periodHow long, in seconds (60-172800), the message may wait for delivery after acceptance. Bird does not submit it to the carrier after that deadline, and passes the remaining time to the carrier where the route supports it. A message that misses the deadline before reaching the carrier ends rejected or failed; expired comes only from a carrier report. Omit it to use the validity period of the profile in messaging_profile_id, or the carrier's own rules when the profile sets none.
referenceAn identifier you want to find this message by, such as an order or ticket number, matched exactly by the message list's reference filter. Set it only when you need to search on it, and put any other data in metadata. Stored on the message, returned on reads and echoed in webhook payloads. Several messages can share one.
cost_centerYour accounting identifier for this message, such as a department code. Stored on the message and its usage record, returned on reads, and echoed in webhook payloads. Omit it to use the cost center of the messaging profile in messaging_profile_id. Accepting it does not change how the message is priced.
tagsStructured {name, value} labels, up to 20 per send. You can filter the list endpoint by tag name, slice analytics by tag, and read them in webhook payloads. Use them for low-cardinality dimensions such as category or experiment_variant, and metadata for context you do not filter by.
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.
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.
media_urlsPreview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messaging_profile_idThe messaging profile that supplies this message's sender and defaults. Without from, Bird sends from the profile's sender for the destination country, or its default sender. An omitted category on a free-text send, smart_encoding, cost_center, validity_period, options.callback_url and options.ignore_suppression take the profile's settings, and values set on the message take precedence. A built-in template sends from Bird's system sender and ignores the profile's senders. A profile that does not exist in this workspace returns 422 SMSMessagingProfileNotFound, and a from bound to a different profile returns 422 SMSMessagingProfileSenderBound.
scheduled_atPreview feature: send-later scheduling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
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.
broadcast_idPreview feature: broadcast correlation. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
campaign_idPreview feature: campaign correlation for analytics. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
audience_idPreview feature: audience-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
contact_idPreview feature: contact-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
topic_idPreview feature: topic-gated sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
personalizationPreview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
toRecipient phone number in E.164 format (for example +14155550100), or in national format when you also pass to_country_code. One recipient per message. The number is stored and returned in canonical E.164; a recipient that cannot be routed returns a 422 SMSInvalidRecipient.
to_country_codeThe ISO 3166-1 alpha-2 country whose national numbering plan to is written in, such as NL for 0612345678. Bird converts to to E.164 before checking the destination, price and sender. An E.164 to is still accepted when its country calling code matches this country; a mismatch, or a national number that is not valid in this country, returns a 422 SMSInvalidRecipient. Omit it to send to in E.164.
fromSender the workspace holds: a number it owns in E.164, such as +15557654321, a short code, such as 24680, or an alphanumeric sender ID it has claimed, such as MyBrand. Any other sender returns 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 a workspace-template send, unless the profile in messaging_profile_id selects a sender for the destination country or has a default sender; omitting it otherwise returns 422. A built-in template selects its sender itself and rejects from.
binarySend an 8-bit binary payload instead of text or template. Requires category transactional and refuses options.smart_encoding. It is sent and charged as one segment.
显示子参数
binary.udhUser data header as hexadecimal, 1-16 octets. Required on a send: a binary send without it returns 422. Its first octet must count the octets after it, every information element must fit inside it, and concatenation elements (00, 08) are refused because the message is one segment.
binary.dataThe payload after the header, as hexadecimal.
categoryContent classification: why you are sending. Required on a free-text send unless the messaging profile in messaging_profile_id sets a default category; 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.
Possible values: transactional, marketing, authentication, service
validity_periodHow long, in seconds (60-172800), the message may wait for delivery after acceptance. Bird does not submit it to the carrier after that deadline, and passes the remaining time to the carrier where the route supports it. A message that misses the deadline before reaching the carrier ends rejected or failed; expired comes only from a carrier report. Omit it to use the validity period of the profile in messaging_profile_id, or the carrier's own rules when the profile sets none.
referenceAn identifier you want to find this message by, such as an order or ticket number, matched exactly by the message list's reference filter. Set it only when you need to search on it, and put any other data in metadata. Stored on the message, returned on reads and echoed in webhook payloads. Several messages can share one.
cost_centerYour accounting identifier for this message, such as a department code. Stored on the message and its usage record, returned on reads, and echoed in webhook payloads. Omit it to use the cost center of the messaging profile in messaging_profile_id. Accepting it does not change how the message is priced.
tagsStructured {name, value} labels, up to 20 per send. You can filter the list endpoint by tag name, slice analytics by tag, and read them in webhook payloads. Use them for low-cardinality dimensions such as category or experiment_variant, and metadata for context you do not filter by.
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.
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.
media_urlsPreview feature: multimedia (MMS) attachments. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
messaging_profile_idThe messaging profile that supplies this message's sender and defaults. Without from, Bird sends from the profile's sender for the destination country, or its default sender. An omitted category on a free-text send, smart_encoding, cost_center, validity_period, options.callback_url and options.ignore_suppression take the profile's settings, and values set on the message take precedence. A built-in template sends from Bird's system sender and ignores the profile's senders. A profile that does not exist in this workspace returns 422 SMSMessagingProfileNotFound, and a from bound to a different profile returns 422 SMSMessagingProfileSenderBound.
scheduled_atPreview feature: send-later scheduling. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
broadcast_idPreview feature: broadcast correlation. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
campaign_idPreview feature: campaign correlation for analytics. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
audience_idPreview feature: audience-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
contact_idPreview feature: contact-targeted sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
topic_idPreview feature: topic-gated sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
personalizationPreview feature: per-recipient substitution for batch sends. Currently unavailable; supplying this field returns 422 SMSUnsupportedFeature.
响应载荷
idID of the message, assigned when the send is accepted. Pass it as message_id to the get-message endpoint.
directionWhether the message was sent from a Bird sender (outbound) or received from a subscriber (inbound).
Possible values: outbound, inbound
statusDelivery status:
accepted: Accepted and awaiting carrier handoff.sent: Handed to the carrier and awaiting a delivery receipt.delivered: Confirmed as delivered.undelivered: The carrier reported delivery as failed for a reason that may clear later, such as a handset out of coverage or a carrier at capacity. Final all the same: the message is not retried, so reaching the recipient means sending again.failed: The carrier reported delivery as failed for a reason that will not clear, such as an unassigned number, a recipient who has opted out, or content the carrier refused.rejected: Refused before carrier handoff.expired: Reached its validity limit without a final receipt.received: Received as an inbound message.
scheduled and canceled are declared ahead of the send-later scheduling
feature that produces them, so their arrival is not a breaking change. No
message carries either status today.
Possible values: scheduled, accepted, sent, delivered, undelivered, failed, rejected, canceled, expired, received
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.
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.
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, and on a binary message, which returns binary instead. For a template send, this is the rendered text after parameter substitution. System template messages preserve the surrounding text and mask sensitive codes with one asterisk per digit. Authentication messages without declared sensitive variables return **REDACTED**. The recipient receives the real code; message history retains only its masked representation.
categoryContent classification supplied for free text or derived from the template. Null for inbound messages.
requested_languageThe template language requested by the send, in canonical form. Null when the send named no language or used no template.
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.
template_idThe template rendered for this message, or null for a free-text message.
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.
template_content_hashThe rendered language's source fingerprint, or null for a free-text message.
messaging_profile_idThe messaging profile this message was sent or received under. Absent when no messaging profile applied.
costWhat the message cost, split into Bird's charge and any third-party fees passed through. Null until the message has been priced.
metadataArbitrary JSON metadata stored on the message and echoed in webhook payloads.
optionsThe settings applied to this message, with any option you omitted filled in with the default in force when you sent it. Absent on received messages, and on any outbound message for which no settings were recorded.
validity_periodThe validity_period applied to the message, in seconds: the send's own, or else its messaging profile's. Absent when neither set one.
referenceThe reference from the send request. Absent when the send set none, and on inbound messages.
cost_centerThe cost_center applied to the message: the send's own, or else its messaging profile's. Absent when neither set one, and on inbound messages.
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.
mcc_mncMobile country code and mobile network code of the carrier. Absent until the carrier is identified.
last_errorFailure detail on a message that failed, was rejected, was not delivered, or expired. Absent otherwise.
country_codeOn an outbound message, the country of the recipient's number. On a received message, the country of the sender's number, or of your number that received it when the sender is not a phone number, such as a short code or an alphanumeric sender. The same value as the message's sms.* events' country_code. Absent when not known.
in_reply_to_messageOn a received message, the outbound message it was paired with through its messaging profile's outbound matching. Absent on outbound messages and on received messages that were not paired.
created_atWhen the message was accepted (outbound) or received (inbound).
sent_atWhen the message was handed to the carrier. Null until then.
delivered_atWhen delivery was confirmed. Null until then.
相关资源
继续查看此主题的文档、指南和示例。