Send an SMS

In this SMS API Quickstart, you'll learn how to send an SMS from your web application using the SMS API.

Step 1: Sign up for free

Before we get started, log in to the MessageBird Connectivity Platform and collect your live API key from the Developer Dashboard.

Step 2: Send your first SMS

Next, enter your credentials and mobile number - as both the originator and recipient - to the snippet below and copy it to your terminal.

curl -X POST https://rest.messagebird.com/messages \
-H 'Authorization: AccessKey YOUR-API-KEY' \
-d "recipients=+31XXXXXXXXX" \
-d "originator=+31XXXXXXXXX" \
-d "body=Hi! This is your first message."

Next, simply hit enter in your terminal.

Good job! You’ve sent your first SMS with the MessageBird SMS API using cURL!

Step 3: View the response

Now, let’s view MessageBird’s HTTP response to your API call. If the set up was correct, you'll receive a response similar to this:

{
"id": "9a9c83bc90d34a49b57fbc79e33bc5cd",
"href": "https://rest.messagebird.com/messages/9a9c83bc90d34a49b57fbc79e33bc5cd",
"direction": "mt",
"type": "sms",
"originator": "31XXXXXXXXX",
"body": "Hi! This is your first message.",
"reference": null,
"validity": null,
"gateway": 10,
"typeDetails": {},
"datacoding": "plain",
"mclass": 1,
"scheduledDatetime": null,
"createdDatetime": "2019-02-19T11:56:17+00:00",
"recipients": {
"totalCount": 1,
"totalSentCount": 1,
"totalDeliveredCount": 0,
"totalDeliveryFailedCount": 0,
"items": [
{
"recipient": 31XXXXXXXXX,
"status": "sent",
"statusDatetime": "2019-02-19T11:56:17+00:00"
}
]
}}

If something went wrong, you’ll receive an error response from the MessageBird API. Don't worry, simply head over to the SMS API Troubleshooting to understand the error.

Congrats! You can now programmatically send SMS with the MessageBird SMS API using cURL.

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings