improved

Unified format for API errors

Big update for version 2025-01 and beyond: errors now have a consistent format compliant with the GraphQL specification!

This may be a breaking change for your application. Use version 2024-10 until you migrate your applications to handle the new error structure.

Errors will be returned in the following format:

  • HTTP status: Response will be 200 – OK for application-level errors. Other statuses will be returned for transport-layer errors, such as 429 - Too many requests or 400 - Bad request
  • JSON response: Body will contain an errors array with further details about each error
  • Partial data: Your query may return partial data and throw errors. In that case, you will receive both the data and errors objects. If a field throws an error, it will return null.

Examples:

{
  "data": [],
  "errors": [
    {
      "message": "User unauthorized to perform action",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "me"
      ],
      "extensions": {
        "code": "UserUnauthorizedException",
        "error_data": {},
        "status_code": 403
      }
    }
  ],
  "account_id": 123456
}
{
  "data": {
    "me": {
      "id": "4012689",
      "photo_thumb": null
    },
    "complexity": {
      "query": 12
    }
  },
  "errors": [
    {
      "message": "Photo unavailable.",
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ],
      "path": [
        "me",
        "photo_thumb"
       ],
      "extensions": {
        "code": "ASSET_UNAVAILABLE"
      }
    }
  ],
  "account_id": 18888528
}