For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get an API Key

Learn how to generate API keys to create authenticated requests to the Mobile Text Alerts API.

In order to receive an API Key, you must have a Mobile Text Alerts account. Click here to sign up for one!

Generate an API Key

API Keys can be generated in the Mobile Text Alerts platform dashboard.

  1. Visit Settings for your account. This is under the three-dot menu in the top right of the platform dashboard.

  2. Select the Developer tab or scroll down to Developer Resources.

  3. Click the GENERATE A NEW KEY button. Enter a name for the new API Key.

This API Key is used to make authenticated calls to the Mobile Text Alerts API.

Bearer Token Authentication

This API Key is used as a bearer token when making requests to the API. A bearer token is included in the request header to grant a user or application access to a protected endpoint.

Header structure: "Authorization: Bearer {myAPIKey}"

Example request to verify the API Key

The examples below send a request with a bearer token to the /verify-api-key endpoint. This verifies the API Key is valid:

curl -L \
  -H 'Authorization: Bearer <APIKey>' \
  'https://api.mobile-text-alerts.com/v3/auth/verify-api-key'
// Run with: node --env-file=.env verify.js
async function main() {
  const apiKey = process.env.MTA_API_KEY;

  const response = await fetch(
    "https://api.mobile-text-alerts.com/v3/auth/verify-api-key",
    {
      method: "GET",
      headers: {
        "Authorization": `Bearer ${apiKey}`,
        "Accept": "*/*",
      },
    }
  );

  console.log("STATUS:", response.status);
  console.log("CONTENT-TYPE:", response.headers.get("Content-Type"));

  const contentType = response.headers.get("Content-Type");
  if (contentType && contentType.includes("application/json")) {
    const data = await response.json();
    console.log(data);
  } else {
    const text = await response.text();
    console.log(text);
  }
}

main().catch((err) => {
  console.error("Request failed:", err);
  process.exitCode = 1;
});

Example verify.py file (requires pip install requests python-dotenv):

If the key is valid, the API returns the message: "API Key verified"

A 200 indicates success. See Error Response Codes for possible error codes.

Verify API Key

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Responses
200

Success

application/json
get/auth/verify-api-key
GET /v3/auth/verify-api-key HTTP/1.1
Host: api.mobile-text-alerts.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "success": true,
  "error": "text",
  "message": "text",
  "data": {
    "name": "text",
    "email": "text"
  }
}

With a verified API key, you’re ready to send real messages. See Send a Message to learn more.

Last updated

Was this helpful?