Docs > The API >

Responses

All API responses are JSON. Every response includes a status object and a csrf_token string.

Successes

The simplest possible response is:

{
  "status": {
    "code": 0
  },
  "csrf_token": "lgHZIDFjZmY0Nzlj..."
}

As you can guess, a status of 0 is success. Yeehah!

Errors

Extra info accompanies error codes. If an input is missing or formatted incorrectly, you'll get a generic "INPUT_ERROR" or "MISSING_PARAMETER", with a fields dictionary, describing all the errors.

{
  "status": {
    "name":    "INPUT_ERROR",
    "code":    100,
    "desc":    "missing or invalid input",
    "fields": {
      "email": "invalid email address"
    }
  },
  "csrf_token": "lgHZIDRlMjJjN..."
}

If the fields are good, but there's a logical error, expect a custom error code. The API documentation will show which ones to expect for each call.

{
  "status": {
    "name":   "BAD_SIGNUP_USERNAME_TAKEN",
    "code":   701,
    "desc":   "username taken",
    "fields": [ "username" ]
  },
  "csrf_token": "lgHZIDFjZmY0Nzlj..."
}