Skip to content

Quickstart

Create an API key and send your first SMS with curl in a few minutes.

This guide takes you from a new API key to a sent message. You need a MessagePort account and a terminal with curl.

  1. 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.

  2. 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/account

    A 401 response means the key is wrong or disabled. See Get account details.

  3. Find a sender ID

    Every message needs a from value your account is allowed to use. List them with:

    curl -u "ACCESS_TOKEN:TOKEN_ID" https://app.messageport.com.au/api/v2/account/sender-ids

    To send from the shared number pool, use SHARED_NUMBER.

  4. Send a message

    Send to the test number +61491578888 first. 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 to with your own mobile number in E.164 format.

  5. Check the result

    The response lists accepted messages in data.messages and rejected ones in data.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 errors has an error_code and an error_help explaining what to fix. Accepted messages are queued for sending. To find out whether they were delivered, subscribe to the message_dlr webhook.

Next steps

Type to search…

↑↓ navigate↵ selectEsc close