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:

Code Explanation
200 OK Common OK status code. Request was successful.
201 Created A resource has been created or updated successfully.
202 Accepted Request accepted and is being processed.
204 No content Resource deleted successfully.
302 Found Redirect. Your code should follow the address specified in the Location header.
400 Bad request Invalid 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 found Resource not found.
429 Too many requests Request limit reached. Please try again later.
500 Internal server error Internal server error has occurred. Please try again later.
503 Service unavailable Service 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.

Field Example Description
code 400 HTTP error code.
message Resource does not exist Brief 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:

Field Example Description
common Array 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 strings Associative 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:

Field Example Description
id 515 Resource ID.
href /api/v2/messages/515 A 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.