URLs | Authentication | Objects | Results | Error Codes
Any API endpoint can be accessed with either HTTP GET or POST. Objects that are associated with a phone number require the phone number as part of the URL, which must be expressed in international format (i.e. "+15555550100").
Objects that require a phone number use this URL scheme:
https://app.mojotxt.com/api/v1/{phone_number}/{object}/{verb}/{parameter}
Objects that do not require a phone number use this URL scheme:
https://app.mojotxt.com/api/v1/{object}/{verb}/{parameter}
Visit the Integrations page of your account (API Keys tab) to generate your MojoTxt API credentials. Once you have obtained your API credentials, authenticate your requests with them using HTTP basic authentication.
| Object | Description | Requires Phone Number |
|---|---|---|
| client | Get the account your API credentials belong to. | No |
| phoneNumbers | Work with MojoTxt phone numbers. | No |
| subscribers | Work with subscriber data. | Optional |
| donations | Work with donation keywords and download transactions. | Yes |
| lists | Work with subscription lists. | Yes |
| messages | Work with messages to your subscribers. | Yes |
| messageLog | Get a list of incoming/outgoing messages. | Yes |
API results are returned in JSON format. When a list has no matching records, "record_count" is 0 and "records" is null.
GET https://app.mojotxt.com/api/v1/+15555550100/donations/list?Sort=DonationID
{
"result": "success", /* Test for "success" to determine a successful result. */
"timestamp": 1793491200, /* The server's current UNIX timestamp. */
"request": { /* The server will echo back all received parameters. */
"Sort": "DonationID", /* Sort parameter (sent in querystring) */
"object": "donations", /* object (sent in URL) */
"verb": "list", /* verb (sent in URL) */
"phone": "+15555550100" /* phone_number (sent in URL) */
},
"record_count": 1, /* The number of records in this result set. */
"records": [ /* An array containing the record(s) requested. */
{
"DonationID": 103,
"KeywordID": 412,
"Keyword": "GIVE",
"FundName": "General Fund",
"DefaultAmount": null,
"RecurringScheduleID": 0,
"CCBFund": 1
}
]
}
In this example, a DonationID is not included at the end of the URL.
GET https://app.mojotxt.com/api/v1/+15555550100/donations/get
{
"result": "error", /* "error" indicates a problem occurred. */
"error_code": "1200", /* the error code */
"error_message": "No Donation object specified.", /* a human-readable error message */
"timestamp": 1793491200, /* the server's current UNIX timestamp */
"request": { /* all received parameters */
"object": "donations",
"verb": "get",
"phone": "+15555550100"
}
}
The "error_code" field is a number for codes below 1100 (for example, 1010) and a string for codes 1100 and above (for example, "1200").
| Error Code | Endpoint | Description | Notes |
|---|---|---|---|
| 1000 | API Core | Not authenticated. | Authenticate using your API Username & Password with HTTP basic authentication. |
| 1001 | API Core | Authenication failed. | Ensure your API Username and Password are correct. |
| 1002 | API Core | No endpoint specified. | You didn't include an endpoint in your request. (i.e. /api/v1/+15555550100/donations/list) |
| 1003 | API Core | Invalid endpoint. | You included an endpoint, but it isn't valid. See API documentation. |
| 1004 | API Core | No verb specified. | You didn't include a verb in your request (i.e. /api/v1/+15555550100/donations/list) |
| 1005 | API Core | Invalid verb. | You included a verb, but it isn't valid. See API documentation. |
| 1010 | API Core | Phone number not specified. | You requested an API endpoint which requires a phone number, but you didn't provide one. (i.e. /api/v1/+15555550100/donations/list) |
| 1011 | API Core | Invalid phone number specified. | The phone number you included in the request is either formatted incorrectly, or is not associated with your account. It should be in international format (i.e. +15555550100). |
| 1012 | API Core | A database error occurred. | Try again later. If problem persists, please contact us. |
| 1013 | Lists | The person's mobile number is required. | The subscribe verb needs a PhoneNumber parameter. |
| 1014 | Lists | The person's mobile number is invalid. | The PhoneNumber parameter isn't a valid 10-digit US or Canadian mobile number. |
| 1015 | Lists | This person has opted-out of messages from this subscription list. | This person can't be subscribed through the API. |
| 1050 | All | Invalid Sort parameter. | The Sort value isn't one of the options listed for this verb. The messageLog endpoint also uses this code for an invalid Direction, StartTime or EndTime. |
| 1051 | All | Invalid SortDirection. | SortDirection must be "ASC" for ascending sort or "DESC" for descending sort. |
| 1101 | Keywords | Invalid characters in keyword, or keyword already in use. | Please use only letters and numbers (no spaces or special characters). All keywords must be unique on a phone number. |
| 1102 | Keywords | Invalid keyword length. | Your keyword must be between 1 and 20 characters in length. This code is also returned when the Keyword parameter is missing or empty. |
| 1103 | Keywords | Reserved keyword. | The opt-out words mobile carriers require us to handle can't be used as keywords. (stop, stopall, unsubscribe, end, cancel, quit, block) |
| 1105 | Keywords | Invalid keyword. | You used a keyword in place of an ID, and nothing on this phone number has that keyword. |
| 1200-1299 | Donations | (Multiple) | See Donations Error Codes |
| 1300-1399 | Lists | (Multiple) | See Lists Error Codes |
| 1400-1499 | Messages | (Multiple) | See Messages Error Codes |
| 9999 | Messages | Duplicate message. | See Messages Error Codes |