> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-24fef6d1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ApiError

> Reference for the ApiError class in the X API TypeScript SDK. Properties and methods for inspecting HTTP status, error codes, and X API error responses.

API Error class for handling X API errors

## Hierarchy

* `Error`

  ↳ **`ApiError`**

## Constructors

### constructor

• **new ApiError**(`message`, `status`, `statusText`, `headers`, `data?`): [`ApiError`](/xdks/typescript/reference/classes/ApiError)

#### Parameters

| Name | Type |
| :- | :- |
| `message` | `string` |
| `status` | `number` |
| `statusText` | `string` |
| `headers` | `Headers` |
| `data?` | `any` |

#### Returns

[`ApiError`](/xdks/typescript/reference/classes/ApiError)

#### Overrides

Error.constructor

[client.ts:123](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/client.ts#L123)

## Properties

<ResponseField name="status" type="number" required />

<ResponseField name="statusText" type="string" required />

<ResponseField name="headers" type="Headers" required />

<ResponseField name="data" type="any" />
