Text messages
Send a text message to a mobile number: a login code, a password, a reminder or an alert. You follow it with its status, a timeline of what happened to it, and webhooks. The messages are sent by Bird; you only deal with us.
| Operation | Endpoint | What it does |
|---|---|---|
sms.send |
POST /v1/sms |
Checks the number, the sender and the length, then sends the message. |
sms.read |
GET /v1/sms, GET /v1/sms/{id}, GET /v1/sms/senders |
Where your messages stand, and the senders you may use. Free. |
A key needs the scope sms, or the operation itself (see
scopes).
Availability. In preview: the status of the operations in
GET /v1/pricing is preview. Test keys work for everyone, and never send
anything; see test mode.
Only messages a person expects. Login and verification codes, passwords, reminders, confirmations
and alerts; no marketing. Say which with category: authentication, transactional or service.
Sending a message
Section titled “Sending a message”POST /v1/smsAuthorization: Bearer ac_live_…Idempotency-Key: login-8842-1Content-Type: application/json
{ "to": "+31612345678", "text": "Your login code is 493021. It is valid for 10 minutes.", "category": "authentication", "reference": "login-8842"}to: a mobile number, in international format, or national withcountry("to": "0612345678", "country": "NL"). A landline or an invalid number is422.- The country is the number’s own. Text messages go to
NLandBEfor now; another country is422sms_destination_not_available, with thecountrieswe send to. from: one of the senders ofGET /v1/sms/senders(see senders); empty: the default there.text: at most 12 segments. 160 characters fit in one segment and 153 per segment above that, when every character is in the GSM alphabet (^ { } \ [ ] ~ | €count twice). With one character outside it, such as an emoji orł, 70 and 67. The answer says how manysegmentsit takes.validity: how long the network keeps trying to deliver it, in seconds (60 to 172800).referenceandmetadata: yours, returned with the message and its webhooks.
Everything is checked before anything is sent or reserved. The answer is 202 with the message,
queued until the provider took it. Use an Idempotency-Key to retry safely: the same key never
sends twice.
Statuses
Section titled “Statuses”| Status | Meaning |
|---|---|
queued |
Accepted by us, on its way to the provider. |
accepted |
The provider took it. |
sent |
Handed to the mobile network. |
delivered |
The network reported it delivered. |
undelivered |
It reached the network but was not delivered, for example because the phone stayed off until the message expired. See failure_code. |
failed |
Refused before it was sent, by the provider or the network. See failure_code. |
failure_code is one of, among others: unreachable, expired, invalid_destination,
blocked_by_carrier, recipient_opted_out, landline_unreachable, sender_not_configured,
provider_unavailable. reason has the provider’s words for it.
Follow a message with GET /v1/sms/{id}, or the webhooks sms.sent, sms.delivered,
sms.undelivered and sms.failed. A webhook carries the message without the number and the text;
get the message for those.
Senders
Section titled “Senders”The sender is the name the recipient sees above the message. You cannot put just any name there: nobody may send as someone else.
- Ask for a sender in the portal, under Text messages > Senders: 3 to 11 letters, digits,
spaces,
-,_or., with at least one letter. A name that fits your company in the business register (its name or a trade name, or the start of it, such asInformerfor Informer Online Nederland B.V.) is approved at once. We check any other name first, and also a name that looks like a bank’s, a government’s or a well-known brand’s. Owners, admins and developers can ask. - Set up at our provider. After approval we set the name up at our text message provider; until then your messages go out as the default below. The portal shows where each sender stands.
- Until you have a sender of your own, your messages go out as
ACC, our own sender. Say in the text who it is from, for example “Bakkerij Jansen: your code is 493021”. GET /v1/sms/senderslists the senders a message may get now, the one it gets withoutfromfirst (default: true).ACChasshared: true.
A sender that is not one of those is 422
sms_sender_not_allowed, with the senders you may use.
You pay what the provider charges for the message, plus a markup per segment: the price of sms.send
in GET /v1/pricing. The provider prices a message only after sending it, so:
- When the message is accepted, an estimate is reserved from your credit: per segment the
highest cost we saw for the country in the last 30 days, plus a margin, plus the markup. The
answer shows it in
price.estimate. - When the message is final and priced, the provider’s cost plus the markup is charged
(
charge.status:captured), and the rest of the reservation is released. - A message that
failedbefore it was sent is free (released). A message that wasundeliveredused the network and is charged.
price.provider_cost shows what the provider charged, once it priced the message.
Test mode
Section titled “Test mode”A test key never sends anything and is never charged. A test message is checked like a live one, then plays a life its number decides:
| Number | What happens |
|---|---|
Any mobile number, or +31655500001 |
accepted, after ~2 s sent, after ~5 s delivered |
+31655500002 |
sent, then undelivered with failure_code unreachable |
+31655500003 |
failed with failure_code blocked_by_carrier |
The webhooks come as for a live message.
Privacy
Section titled “Privacy”The text of a message is kept for 30 days, then wiped: it may hold a code or a password. The status, the segments and the price stay. Our team never sees the text.
In the portal
Section titled “In the portal”Text messages in the portal lists the messages of your account per environment, with their status, timeline and price, and your senders, where you also ask for new ones. Search on the message id, your reference or the number. The text is shown there for 30 days after sending, like in the API.