Back

TextMagic SMS API Essential Guide

Aug 14, 20246 minute read

What type of API does TextMagic SMS provide?

TextMagic SMS uses a REST API. The key points are:

API Type

TextMagic SMS uses a REST API.

Key Points

  1. The API endpoint is https://rest.textmagic.com/api/v2/.

  2. TextMagic offers two ways to use their API:

    • REST API - provides full access to TextMagic's messaging gateway features
    • Email to SMS API - allows setting up two-way SMS communication without writing additional code
  3. The API uses HTTP headers for authentication:

    • X-TM-Username: Your TextMagic username
    • X-TM-Key: Your API key
  4. To use the API, you need to generate API credentials (username and API key).

  5. The API documentation is available at docs.textmagic.com.

REST API Characteristics

While not specific to TextMagic, REST APIs generally have the following characteristics:

  • Based on resources and HTTP methods
  • Use JSON or XML as the data format
  • Stateless communication
  • Widely supported and popular for web and mobile applications
  • Can be more simple to implement and use compared to other API types like SOAP or GraphQL

Summary

TextMagic SMS provides a REST API for developers to integrate SMS messaging capabilities into their applications. This API offers full access to TextMagic's messaging gateway features and follows standard REST principles. Developers need to generate API credentials and use HTTP headers for authentication when making requests to the API endpoint.

Does the TextMagic SMS API have webhooks?

The official TextMagic SMS API does not appear to have native webhook functionality. However, TextMagic can be integrated with webhooks through third-party services such as Zapier.

The Zapier integration allows you to create automated workflows that involve TextMagic and webhook functionality. When using Zapier, you can set up actions that send data from TextMagic to a webhook URL. The events you can use as triggers include new incoming calls, new missed calls, and new unsubscribers.

It's important to note that while TextMagic does not offer native webhook support, its API documentation mentions other methods for querying information about messages and contacts, which may be used as alternatives to webhooks in some cases.

Rate Limits and other limitations

Based on the search results provided, here are the key points about the API Rate Limits of the TextMagic SMS API:

Request Frequency Limit

The TextMagic SMS API has a request frequency limit of 20 requests per second. If this limit is exceeded, a 429 Too Many Requests error will be returned [1].

Maximum "limit" Parameter Value

For commands that return an array of resources (e.g., GET /api/v2/messages), the "limit" parameter can be set between 1 and 100. If not specified, the default value is 10 [1].

Number Format Restriction

The API requires phone numbers to be in the E.164 format. Local phone formats are not accepted to ensure accurate delivery [1].

Other Key Points

  1. There are no explicit daily or monthly limits mentioned in the search results.

  2. The API allows for sending multiple messages simultaneously per request using contacts, lists, and templates [1].

  3. The API provides detailed statistics and reporting features, including messaging statistics and spending statistics [4].

  4. While not directly related to rate limits, the API offers features like mass texting, SMS chat, and integrations [2].

Best Practices

  1. Use the E.164 phone number format in all API requests to ensure proper delivery [1].

  2. When fetching large amounts of data, use the "limit" parameter effectively to control the number of results returned per request [1].

  3. Monitor your request frequency to avoid hitting the 20 requests per second limit [1].

  4. Utilize the API's reporting features to track your usage and costs [4].

  5. Consider using contacts, lists, and templates for sending multiple messages simultaneously to optimize your API usage [1].

In summary, the TextMagic SMS API has a primary rate limit of 20 requests per second, along with some parameter and format restrictions. While there are no explicit daily or monthly limits mentioned, users should be aware of these constraints and follow best practices to optimize their API usage.

Latest API Version

Based on the search results provided, here is the most up-to-date information about the TextMagic SMS API version:

The most recent version of the TextMagic SMS API is V2 (Version 2).

Key points to consider:

  1. TextMagic has two SMS API versions: V1 and V2 [2].

  2. The current API endpoint for V2 is: https://rest.textmagic.com/api/v2/ [2].

  3. V1 API keys are not compatible with the V2 version of the TextMagic REST API [2].

  4. To use the V2 API, users need to generate a new API key specifically for the V2 endpoint [2].

  5. The V2 API provides full access to TextMagic's messaging gateway features [1].

It's important to note that TextMagic recommends using the V2 API for new integrations and development. The V1 API is considered legacy and is maintained for reference purposes only [2].

For developers looking to integrate with TextMagic's SMS API, it's recommended to use the V2 endpoint and generate the appropriate API credentials through their account settings.

How to get a TextMagic SMS developer account and API Keys?

  1. Sign up for a TextMagic account:

    • Go to the TextMagic website and sign up for a free trial account if you don't already have one.
  2. Generate API credentials:

    • Log in to your TextMagic account
    • Go to the API settings page
    • Click on "Add new API key"
    • Enter a name/label for the API key
    • Click "Generate new key"
    • You will see your new API key displayed
  3. Note your API credentials:

    • Your TextMagic username will be used as the X-TM-Username
    • The generated API key will be used as the X-TM-Key
  4. Connect to the API endpoint:

    • The base URL is: https://rest.textmagic.com/api/v2/
  5. Start using the API:

    • You can now make API requests using your credentials
    • Use the Sandbox to test API calls before implementing
    • Refer to the API documentation for available endpoints and methods
  6. Implement in your code:

    • Use the API credentials and endpoint in your application code
    • TextMagic provides code libraries for many languages to help with integration

What can you do with the TextMagic SMS API?

Here are the key data models you can interact with using the TextMagic SMS API, along with what is possible for each:

Messages

  • Send SMS and MMS messages
  • Schedule messages to be sent at a later date/time
  • Check delivery status of sent messages
  • Query information about outbound messages
  • Set up callback URLs for delivery reports

Contacts

  • Create, update, and delete contacts
  • Import contacts from CSV/Excel files
  • Organize contacts into distribution lists
  • Add custom fields to contacts

Lists

  • Create and manage distribution lists
  • Add/remove contacts from lists
  • Send bulk messages to entire lists

Templates

  • Create reusable message templates
  • Use templates when sending messages

Inbound Messages

  • Receive and view incoming SMS messages
  • Set up automation rules for inbound messages
  • Query information about inbound messages

Numbers

  • Purchase and manage dedicated virtual numbers
  • Set up number routing and forwarding

Account

  • Check account balance and usage
  • Manage sub-accounts
  • View messaging statistics and reports

Scheduling

  • Schedule one-time or recurring messages
  • Manage scheduled messages

Chat Sessions

  • Create and manage two-way SMS chat sessions

Attachments

  • Upload and send attachments via MMS

Sender IDs

  • Manage approved sender IDs for messaging

This covers the main data models and capabilities exposed through the TextMagic API. The API provides comprehensive access to TextMagic's messaging features and allows developers to integrate SMS functionality into their own applications.