All pages
Powered by GitBook
1 of 5

Loading...

Loading...

Loading...

Loading...

Loading...

API Basics

Learn more about REST APIs and how to interact with them.

What is an API?

API stands for Application Programming Interface. APIs enable communication between two software components, typically a client and a server. The application sending the request is the client, and the application sending the response is the server. When interacting with the Mobile Text Alerts API, the Mobile Text Alerts database is the server, and you send requests as the client.

There are different types of APIs, the MTA API is a REST API.

REST APIs

REST stands for Representational State Transfer, a REST API is a way for software systems to communicate using HTTP. The main principle of REST APIs is statelessness, which means each request from a client to a server must contain all the information needed (no session stored on the server). The server processes the request and returns the necessary data as plain text.

HTTP Methods in REST

HTTP methods indicate the action the client would like to perform on a given resource. Examples of possible actions when calling the Mobile Text Alerts API: send a message, add/delete a subscriber, create a drip campaign, and many more.

Each HTTP method is mapped to a specific operation and is included with every request to the API.

HTTP Methods:

  • GET - Retrieves data from the server.

    • Example: A GET request to the /subscribers endpoint would return a list of all subscribers.

  • POST - Sends data to the server to create something new.

REST API Responses

After making a request to the API, it will return a response that contains the following information:

  • - This three-digit code indicates the outcome of the request

    • Example: 200

  • - This provides metadata about the response.

  • Example: A POST request to the /send endpoint would create a new message(s).

  • PATCH - Updates existing data on the server.

    • Example: A PATCH request to the /threads/{threadId}/read endpoint would update the thread specified with {threadId}as Read.

  • DELETE - Removes existing data on the server.

    • Example: A DELETE request to the /groups/{groupId} endpoint would remove the group specified with {groupId}.

  • Example: Content-Type, Date

  • Response Body/Payload- This is the actual data content of the response.

    • Example:

  • HTTP status code
    Response Headers
    {
      "data": {
        "messageId": "uuid",
        "totalSent": 1,
        "totalFailedInternationalRecipients": 0
      },
      "message": "Message Sent to 1 Recipient."
    }

    Request Parameters

    Learn the types of parameters used in a request to the Mobile Text Alerts API.

    Header Parameters

    Header parameters are included in the request header, all requests to the Mobile Text Alerts API require a valid Authorization header. See Request Headers to learn more.

    Path Parameters

    Path parameters (sometimes called path variables) are part of the endpoint itself and are not optional when making a request to certain endpoints.

    For example, when calling the Update Drip Campaign endpoint:

    The {dripCampaignId} is a string that identifies the id of the campaign to be updated.

    Request Bodies

    The request body contains the actual data being transferred. This is particularly important in methods such as POST, PATCH, and DELETE, where data is sent to the server. This data is typically sent as JSON.

    For example, when calling the Update Drip Campaign endpoint, the name and endDate of a campaign can be updated in the request body:

    Example request to Update Drip Campaign endpoint:

    Error Response Codes

    The Mobile Text API returns HTTP status codes and JSON-based error codes and messages.

    HTTP Status Codes

    Each request to the API will return an HTTP status code, a three-digit code that indicates the outcome of the request.

    Code
    Description

    200

    Rate Limits

    Information on Rate Limits

    An API rate limit is a restriction on the number of requests a client can make to an API within a given period of time.

    General Rate Limit

    Most Mobile Text Alerts API endpoints have a general rate limit of 30 requests per minute per IP address. However, some individual endpoints may override the general rate limit (see below).

    Success

    Indicates a successful request and will contain response headers with addition details about the request.

    400

    BadRequestError

    Indicates that the request was malformed or invalid.

    401

    UnauthorizedError

    Indicates that the client is not authorized to access the requested resource. Make sure you are including a valid API Key in the request header.

    403

    ForbiddenError

    Indicates the client is authenticated but not authorized to access the requested resource.

    429

    RateLimitError

    Indicates too many requests to the server within a window of time, exceeding the allowed rate limit for that endpoint.

    500

    InternalServerError

    Indicates the server encountered an unexpected error that prevented it from fulfilling the request. This usually means there is an issue with the server, not the request.

    Note that Rate Limits are not the same as Message throughput, which is measured in message segments per second (MPS). MPS throughput is determined based on the sender's Brand type, Campaign type (use case), and Trust Score (for Standard Brands).

    Your rate limit usage can be tracked in the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset response headers.

    Account Based Rate Limiting

    Some endpoints use account based rate limiting, where the rate limit is determined by the authenticated account instead of the IP address.

    Endpoint
    Rate Limit

    25 requests every 15 seconds

    5 requests every 15 seconds. A maximum of 1,000 records in a single request.

    5 requests every 15 seconds. A maximum of 1,000 records in a single request.

    15 requests every 15 seconds

    15 requests every 15 seconds

    15 requests every 15 seconds

    https://api.mobile-text-alerts.com/v3/drip-campaigns/{dripCampaignId}

    Request / Response Headers

    Learn which headers are used in MTA API calls and responses.

    Request Headers

    Request headers contain information about the client request. Learn more about the header types used by the Mobile Text Alerts API.

    Authorization

    The Authorization header is used for authentication purposes in HTTP requests. This is a token or credentials used to prove the client's identity. The Mobile Text Alerts API uses Bearer Token Authentication with an API Key.

    Header structure: "Authorization: Bearer {myAPIKey}"

    Example request:

    See to learn how to generate and send this key in a request.

    Content-Type

    Content-Type is an HTTP header that indicates the data type of the request’s message body. This is needed for the server to understand how to process the request data.

    Header structure: "Content-Type: application/json"

    Example request:

    Response Headers

    Response headers provide metadata about the response to the client. Most of the MTA API response headers provide information about your individual account's usage.

    Parameter
    Type
    Description
    {
        "name": "<string>",
        "endDate": "<YYYY-MM-DD HH:mm:ss>"
    }
    curl --location --request PATCH 'https://api.mobile-text-alerts.com/v3/drip-campaigns/12345' \
    --header 'Content-Type: application/json' \
    --data '{
        "name": "Example Campaign Name"
    }'

    GET, POST /subscribers

    15 requests every 15 seconds.

    For large scale subscriber changes Bulk Create/Update Subscribers endpoints are recommended.

    GET, PATCH, DELETE /subscribers/:idOrNumber

    15 requests every 15 seconds

    POST, PATCH /subscribers/bulk

    15 requests every 15 seconds. A maximum of 1,000 records in a single request.

    POST /send
    POST /groups/{groupId}/subscribers/bulk-create
    POST /groups/{groupId}/subscribers/bulk-delete
    GET /custom-fields
    GET, POST /account-variables
    GET, PATCH, DELETE /account-variables/{idOrTitle}

    X-RateLimit-Limit

    integer

    The maximum number of requests that the consumer is permitted to make per window.

    X-RateLimit-Remaining

    integer

    The number of requests remaining in the current rate limit window.

    X-RateLimit-Reset

    integer

    The remaining window before the rate limit resets (in milliseconds).

    X-Request-ID

    string

    A unique identifier for the request.

    RateLimit-Limit

    integer

    The maximum number of requests that the consumer is permitted to make per window.

    RateLimit-Remaining

    integer

    The number of requests remaining in the current rate limit window.

    RateLimit-Reset

    integer

    The remaining window before the rate limit resets (in milliseconds).

    Retry-After

    integer

    The number of seconds to wait before retrying the request.

    Get an API Key
    rate limit
    curl -L \
      -H 'Authorization: Bearer 89fa747a-e01b-5940-99c2-4e96fa996258' \
      'https://api.mobile-text-alerts.com/v3/auth/verify-api-key'// 
    curl --location 'https://api.mobile-text-alerts.com/v3/groups/12345/subscribers/bulk-create' \
    --header 'Content-Type: application/json' \
    --data '{
        "subscriberIds": [
            123
        ]
    }'

    Update Drip Campaign

    patch
    Authorizations
    AuthorizationstringRequired
    Bearer authentication header of the form Bearer <token>.
    Path parameters
    dripCampaignIdstringRequired
    Body
    namestringOptional
    endDatestringOptional
    Responses
    200

    Success

    application/json
    400

    BadRequestError

    application/json
    401

    UnauthorizedError

    application/json
    403

    ForbiddenError

    application/json
    500

    InternalServerError

    application/json
    patch
    /drip-campaigns/{dripCampaignId}
    {
      "success": true,
      "error": "text",
      "message": "text",
      "data": {
        "id": 1,
        "name": "text",
        "endDate": "2025-12-15T01:15:56.559Z",
        "created": "2025-12-15T01:15:56.559Z",
        "groupIds": [
          1
        ],
        "campaignMessages": [
          {
            "id": 1,
            "accountId": 1,
            "title": "text",
            "content": "text",
            "attachment": "text",
            "added": "2025-12-15T01:15:56.559Z",
            "sequence": 1,
            "delay": 1,
            "timeOfDay": "text",
            "dripCampaignId": 1,
            "isMms": 1,
            "memberCount": 1
          }
        ]
      }
    }
    PATCH /v3/drip-campaigns/{dripCampaignId} HTTP/1.1
    Host: api.mobile-text-alerts.com
    Authorization: Bearer YOUR_SECRET_TOKEN
    Content-Type: application/json
    Accept: */*
    Content-Length: 32
    
    {
      "name": "text",
      "endDate": "text"
    }