This guide takes you from a new API key to a sent message. You need a MessagePort account and a terminal with curl.
Create an API key
Sign in to MessagePort, open Settings in the sidebar, then API Keys. Click Create API Key and give it a name.
The key has two parts: an Access Token (the username) and a Token ID (the password). Keep both somewhere safe. See Authentication for details.
Check your credentials
Call the account endpoint. It returns your account details and doesn’t send anything.
curl -u "ACCESS_TOKEN:TOKEN_ID" https://app.messageport.com.au/api/v2/accountA
401response means the key is wrong or disabled. See Get account details.Find a sender ID
Every message needs a
fromvalue your account is allowed to use. List them with:curl -u "ACCESS_TOKEN:TOKEN_ID" https://app.messageport.com.au/api/v2/account/sender-idsTo send from the shared number pool, use
SHARED_NUMBER.Send a message
Send to the test number
+61491578888first. It behaves like a real send but no SMS goes out.curl -u "ACCESS_TOKEN:TOKEN_ID" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST https://app.messageport.com.au/api/v2/sms \ -d '{ "messages": [ { "to": "+61491578888", "from": "SHARED_NUMBER", "body": "Hello from the MessagePort API" } ] }'When that works, replace
towith your own mobile number in E.164 format.Check the result
The response lists accepted messages in
data.messagesand rejected ones indata.errors:{ "data": { "messages": [ { "status": "VALID", "to": "61491578888", "from": "SHARED_NUMBER", "body": "Hello from the MessagePort API", "meta": { "parts": 1, "is_unicode": false, "cost": 1, "country": "AU" } } ], "errors": [] } }A message in
errorshas anerror_codeand anerror_helpexplaining what to fix. Accepted messages are queued for sending. To find out whether they were delivered, subscribe to themessage_dlrwebhook.
Next steps
- Sending messages: batching, scheduling, metadata and MMS.
- Webhooks: receive replies and delivery receipts.
- API reference: every endpoint and field.