The ApiError object contains detailed error information returned by the API when a request fails. This object is part of the error response envelope and provides structured information about what went wrong.
| Field | Type | Description |
|---|---|---|
code | string | A specific error code that identifies the type of error. This can be used for programmatic error handling. Common values include: "unauthorized", "bad_request", "not_found", "rate_limited", and "internal_error". See the Error codes documentation for a complete list. |
message | string | A human-readable error message that describes what went wrong. This message is suitable for displaying to end users or for logging purposes. |
details | object | An object containing additional context-specific error information. The structure of this object varies depending on the error type. It may be empty ({}) or contain fields such as field, reason, resource, id, retryAfter, etc. See the details examples below. |
Note
The ApiError object is always present in error responses (when success is false) and is null in successful responses.
The details object structure is dynamic and depends on the error type. Some errors may include validation information, resource identifiers, or retry instructions.
Related:
The details object structure varies by error type. Here are common examples:
Validation errors typically include information about which field failed and why:
{
"code": "bad_request",
"message": "Invalid product ID format",
"details": {
"field": "productId",
"reason": "Expected a valid Shopify product REST ID"
}
}Resource not found errors include information about what resource was missing:
{
"code": "not_found",
"message": "Product not found",
"details": {
"resource": "product",
"id": "123"
}
}Rate limit errors may include retry information:
{
"code": "rate_limited",
"message": "Too Many Requests",
"details": {
"retryAfter": 60
}
}Some errors may have empty details objects:
{
"code": "unauthorized",
"message": "Unauthorized",
"details": {}
}The ApiError object is part of the error response envelope:
{
"success": false,
"data": null,
"error": {
"code": "bad_request",
"message": "Invalid product ID format",
"details": {
"field": "productId",
"reason": "Expected a valid Shopify product REST ID"
}
},
"meta": {},
"requestId": "req_abc123"
}