Error Handling

Requests made to our APIs can result in error responses. This guide will help you understand what to expect in an error response.

Error Response

The following represents a common error response resulting from a failed API request:

{
    "result": {
        "error": {
            ...
            "message": "<EXCEPTION_MESSAGE>",
            "code": <ERROR_CODE>,
            "error_subcode": <ERROR_SUBCODE>,
            "error_user_title": "<ERROR_TITLE>",
            "error_user_msg": "<ERROR_MESSAGE>",
            "fbtrace_id": "<REQUEST_ID>"
            ...
        }
    },
    "error_code": <ERROR_CODE>,
    "status": "FAILED",
    "exception": "<EXCEPTION_MESSAGE>",
    "id": "<ASYNC_SESSION_ID>"
}
    

Response Parameters

NameDescription

code

numeric

An error code. Same as error_code field. This is NOT guaranteed to be unique.
For details, look at the corresponding API call's error codes section.

error_code

numeric

An error code. Same as code field. This is NOT guaranteed to be unique.
For details, look at the corresponding API call's error codes section.

error_subcode

numeric

Based on the error occurred, this field would provide additional information about the error. It is NOT guaranteed that this field would always be available. If available then it is guaranteed to be unique.


For details, look at the corresponding API call's error codes section.

error_user_msg

string

If error_subcode is available then this field would provide an error message with contextual information.


For details, look at the corresponding API call's error codes section.

error_user_title

string

If error_subcode is available then this field would provide a short title about the error.

exception

string

A human-readable description of the error. Same as message field.

fbtrace_id

string

Internal support identifier. When reporting a bug related to a Graph API call, include the fbtrace_id to help us find log data for debugging.

id

numeric string

The ID of the async request.
Also known as the ASYNC_SESSION_ID.

message

string

A human-readable description of the error. Same as exception field.

status

enum string

The status of the async job. In case of an error this would always be equal to FAILED.

How to read an error response?

  • If error_subcode is available, then use the error_user_msg field to get details about the error occurred.
  • If only error_code is available, then use the exception OR message field to get details about the error occurred.