Guide
Authentication
Every request carries an API key as a bearer token. Keys are made in the dashboard and belong on your server.
Send your key#
Put the key in the Authorization header of every request:
Authorization: Bearer sb_...An API key: sb_ followed by 32 letters, digits, - and _. Create keys in the dashboard at Settings → Developers (only a person logged in to the dashboard can create or revoke them). A key is shown once; revoking it takes effect at once. Requests with a missing, unknown or revoked key get 401 unauthorized.
A quick way to check a key is to fetch your account:
curl https://app.smsblast.net/v1/account \
-H "Authorization: Bearer $SMSBLAST_API_KEY"const res = await fetch('https://app.smsblast.net/v1/account', {
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
},
});
console.log(res.status, await res.json());import os
import requests
res = requests.get(
"https://app.smsblast.net/v1/account",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
},
)
print(res.status_code, res.json())Create and revoke keys#
- In the dashboard, open Settings → Developers and choose Create API key. Name it after where it will be used, such as “Website” or “Zapier”.
- Only the account owner or an admin can create or revoke keys. An API key cannot create or revoke keys.
- The key is shown once, when it is created. Copy it then; afterwards the dashboard only shows its first and last characters.
- An account can have up to 25 active keys. Revoking one takes effect at once: the next request with it is refused.
Keep keys on your server#
A key acts for your whole account: it can send texts (which spend credits), read and change contacts, and do everything else in this reference.
- Call the API from your own server. Never put a key in a web page, a mobile app or a public repository.
- Keep it in an environment variable or a secrets manager. The samples in these docs read
SMSBLAST_API_KEY. - Give each app or integration its own key, so you can revoke one without breaking the others.
- If a key may have leaked, create a new one, switch your app over, then revoke the old one.
Calls that need no key#
2 endpoints are meant for web pages, so they need no key. Everything else does.
GET /v1/public/forms/{publicId}: Show a form (public).POST /v1/public/forms/{publicId}: Sign up with a form (public).
When a key is refused#
A missing, unknown or revoked key gets 401 with the code unauthorized:
{
"error": {
"code": "unauthorized",
"message": "That API key is not valid. Check it, or create a new one in Settings → Developers.",
"requestId": "req_8Fk2LqZ9xW1v"
}
}Each key also has its own rate limit.