> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/pricing-advisor-api/pricing-advisor-api/error-handling/error-response-structure.md).

# Error Response Structure

## Error Response Structure

All error responses from the Pricing Advisor API use the RFC 7807 `ProblemDetails` schema:

```json
{
  "type": "string | null",
  "title": "string | null",
  "status": 400,
  "detail": "string | null",
  "instance": "string | null"
}
```

| Field      | Type         | Description                                                         |
| ---------- | ------------ | ------------------------------------------------------------------- |
| `type`     | string (URI) | A URI reference identifying the problem type                        |
| `title`    | string       | Short, human-readable summary of the problem                        |
| `status`   | integer      | The HTTP status code                                                |
| `detail`   | string       | Human-readable explanation specific to this occurrence of the error |
| `instance` | string (URI) | URI reference identifying the specific occurrence of the problem    |

### Example Error Response

```http
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "Bad Request",
  "status": 400,
  "detail": "The tenantCode parameter cannot be null or empty.",
  "instance": "/api/4.0/StandardAdvice/  "
}
```

### Safe Error Parsing

{% code expandable="true" %}

```javascript
async function parseError(response) {
  try {
    const problem = await response.json();
    return {
      status: problem.status ?? response.status,
      title: problem.title ?? "Unknown Error",
      detail: problem.detail ?? null,
      type: problem.type ?? null,
      instance: problem.instance ?? null,
      // Capture any extra fields the API may include
      extensions: Object.fromEntries(
        Object.entries(problem).filter(
          ([k]) => !["type", "title", "status", "detail", "instance"].includes(k)
        )
      )
    };
  } catch {
    // Body wasn't JSON (e.g. a gateway-level 401/403 with no body)
    return {
      status: response.status,
      title: response.statusText,
      detail: null
    };
  }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.esw.com/pricing-advisor-api/pricing-advisor-api/error-handling/error-response-structure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
