Response Codes

All the possible response codes that you can get from the TextMagic API are described on this page.

HTTP response codes

When you make a request to the TextMagic REST API, you will receive a response that represents the new or modified object state (when you use GET/ POST/ PUT methods) or a success message (when you DELETE a resource). But if something goes wrong, instead of 20x, you will get a different status code. Here are all the possible response codes:

200 OKCommon OK status code. Request was successful.
201 CreatedA resource has been created or updated successfully.
202 AcceptedRequest accepted and is being processed.
204 No contentResource deleted successfully.
302 FoundRedirect. Your code should follow the address specified in the Location header.
400 Bad requestInvalid parameters specified, some required parameters are missing or malformed. Check the corresponding command documentation.
401 Unauthorized Current user has no rights to perform the specified action. For example, regular users cannot view Invoices or Sub-Accounts.
404 Not foundResource not found.
429 Too many requestsRequest limit reached. Please try again later.
500 Internal server errorInternal server error has occurred. Please try again later.
503 Service unavailableService is unavailable due to maintenance.

Error responses

In case of an error, the TextMagic API responds with one of the HTTP error codes (4xx-5xx as shown below) and returns these common error responses.

code400HTTP error code.
message Resource does not existBrief error message. You could display this message to your user or save it in a log.
errors null errors structure If it was a POST or PUT request (and the message returned is Validation Failed), this field may contain errors that describe the errors grouped by the input parameter name.

The errors structure are:

commonArray of strings Array of messages with errors related to the entire request. For example, you did not specify either the text or templateId when sending the message.
fields Associative array of stringsAssociative array. The keys are the POST/PUT parameters names and the values are arrays with error messages for these parameters.

Example error response (for POST /api/v2/templates due to an empty name and content parameters):

  "code": 400,
  "message": "Validation Failed",
  "errors": {
    "fields": {
      "name": [
        "Please enter a template name."
      "content": [
        "Please enter a message for your template."

Link responses

When you create or update some resource (via  POST and  PUT requests) you will get a link response:

id515Resource ID.
href /api/v2/messages/515A link to this resource. If you want to fetch it, just GET this address.

Delete responses

When you delete something, a delete response will be returned. The response body will be empty and the HTTP code will show 204 No Content.

The next step

Now you’ve learned more about Response Codes, the next section will show you Restrictions.