> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CdpClientApiException

> This exception type will be thrown for any non-2XX API responses.

Package: [`com.coinbase.cdp.core`](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/core/index)

```java theme={null}
public class CdpClientApiException extends CdpClientException
```

This exception type will be thrown for any non-2XX API responses.

## Constructor Details

### `CdpClientApiException`

**Overload 1**

```java theme={null}
public CdpClientApiException(String message, int statusCode, Object body)
```

**Parameters:**

`message` - `String`

`statusCode` - `int`

`body` - `Object`

**Overload 2**

```java theme={null}
public CdpClientApiException(String message, int statusCode, Object body, okhttp3.Response rawResponse)
```

**Parameters:**

`message` - `String`

`statusCode` - `int`

`body` - `Object`

`rawResponse` - `okhttp3.Response`

## Method Details

### `statusCode`

```java theme={null}
public int statusCode()
```

**Returns:**

`int` - the `statusCode`

### `body`

```java theme={null}
public Object body()
```

**Returns:**

`Object` - the body

### `headers`

```java theme={null}
public Map<String,List<String>> headers()
```

**Returns:**

`Map<String,List<String>>` - the headers

### `toString`

```java theme={null}
public String toString()
```

**Overrides:**

`[toString](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Throwable.html#toString\(\) "class or interface in java.lang")` in class `[Throwable](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Throwable.html "class or interface in java.lang")`

**Returns:**

`String`
