Developer Guide: v1

URLs | Authentication | Objects | Results | Error Codes

API URLs

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}

Authentication

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.

Objects

ObjectDescriptionRequires Phone Number
clientGet the account your API credentials belong to.No
phoneNumbersWork with MojoTxt phone numbers.No
subscribersWork with subscriber data.Optional
donationsWork with donation keywords and download transactions.Yes
listsWork with subscription lists.Yes
messagesWork with messages to your subscribers.Yes
messageLogGet a list of incoming/outgoing messages.Yes

Results

API results are returned in JSON format. When a list has no matching records, "record_count" is 0 and "records" is null.

Example Successful API Call:

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
        }
    ]
}

Example Unsuccessful API Call:

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 Codes

Error CodeEndpointDescriptionNotes
1000API CoreNot authenticated.Authenticate using your API Username & Password with HTTP basic authentication.
1001API CoreAuthenication failed.Ensure your API Username and Password are correct.
1002API CoreNo endpoint specified.You didn't include an endpoint in your request. (i.e. /api/v1/+15555550100/donations/list)
1003API CoreInvalid endpoint.You included an endpoint, but it isn't valid. See API documentation.
1004API CoreNo verb specified.You didn't include a verb in your request (i.e. /api/v1/+15555550100/donations/list)
1005API CoreInvalid verb.You included a verb, but it isn't valid. See API documentation.
1010API CorePhone 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)
1011API CoreInvalid 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).
1012API CoreA database error occurred.Try again later. If problem persists, please contact us.
1013ListsThe person's mobile number is required.The subscribe verb needs a PhoneNumber parameter.
1014ListsThe person's mobile number is invalid.The PhoneNumber parameter isn't a valid 10-digit US or Canadian mobile number.
1015ListsThis person has opted-out of messages from this subscription list.This person can't be subscribed through the API.
1050AllInvalid 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.
1051AllInvalid SortDirection.SortDirection must be "ASC" for ascending sort or "DESC" for descending sort.
1101KeywordsInvalid 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.
1102KeywordsInvalid 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.
1103KeywordsReserved keyword.The opt-out words mobile carriers require us to handle can't be used as keywords. (stop, stopall, unsubscribe, end, cancel, quit, block)
1105KeywordsInvalid keyword.You used a keyword in place of an ID, and nothing on this phone number has that keyword.
1200-1299Donations(Multiple)See Donations Error Codes
1300-1399Lists(Multiple)See Lists Error Codes
1400-1499Messages(Multiple)See Messages Error Codes
9999MessagesDuplicate message.See Messages Error Codes