> ## 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.

# CdpTokenRequest

> Configuration for generating CDP authentication tokens.

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

```java theme={null}
public record CdpTokenRequest(String requestMethod, String requestHost, String requestPath, boolean includeWalletAuthToken, Optional<Object> requestBody) extends Record
```

Configuration for generating CDP authentication tokens.

This unified request object supports generating both bearer tokens and optional wallet auth tokens in a single call.

Example usage:

```

 CdpTokenRequest request = CdpTokenRequest.builder()
     .requestMethod("POST")
     .requestPath("/v2/evm/accounts")
     .includeWalletAuthToken(true)
     .requestBody(Map.of("name", "my-account"))
     .build();
 
```

## Field Details

### `DEFAULT_HOST`

```java theme={null}
public static final String DEFAULT_HOST
```

Default API host.

**See Also:**

`Constant Field Values`

## Constructor Details

### `CdpTokenRequest`

```java theme={null}
public CdpTokenRequest(String requestMethod, String requestHost, String requestPath, boolean includeWalletAuthToken, Optional<Object> requestBody)
```

Validates the token request.

**Throws:**

`[IllegalArgumentException](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/IllegalArgumentException.html "class or interface in java.lang")` - if validation fails

**Parameters:**

`requestMethod` - `String`

`requestHost` - `String`

`requestPath` - `String`

`includeWalletAuthToken` - `boolean`

`requestBody` - `Optional<Object>`

## Method Details

### `builder`

```java theme={null}
public static CdpTokenRequest.Builder builder()
```

Creates a new builder for CdpTokenRequest.

**Returns:**

[CdpTokenRequest](/sdks/cdp-sdks-v2/java/com/coinbase/cdp/auth/CdpTokenRequest).`Builder` - a new builder instance

### `toString`

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

Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

**Specified by:**

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

**Returns:**

`String` - a string representation of this object

### `hashCode`

```java theme={null}
public final int hashCode()
```

Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

**Specified by:**

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

**Returns:**

`int` - a hash code value for this object

### `equals`

```java theme={null}
public final boolean equals(Object o)
```

Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with [`Objects::equals(Object,Object)`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Objects.html#equals\(java.lang.Object,java.lang.Object\) "class or interface in java.util"); primitive components are compared with '=='.

**Specified by:**

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

**Parameters:**

`o` (`Object`) - the object with which to compare

**Returns:**

`boolean` - `true` if this object is the same as the `o` argument; `false` otherwise.

### `requestMethod`

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

Returns the value of the `requestMethod` record component.

**Returns:**

`String` - the value of the `requestMethod` record component

### `requestHost`

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

Returns the value of the `requestHost` record component.

**Returns:**

`String` - the value of the `requestHost` record component

### `requestPath`

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

Returns the value of the `requestPath` record component.

**Returns:**

`String` - the value of the `requestPath` record component

### `includeWalletAuthToken`

```java theme={null}
public boolean includeWalletAuthToken()
```

Returns the value of the `includeWalletAuthToken` record component.

**Returns:**

`boolean` - the value of the `includeWalletAuthToken` record component

### `requestBody`

```java theme={null}
public Optional<Object> requestBody()
```

Returns the value of the `requestBody` record component.

**Returns:**

`Optional<Object>` - the value of the `requestBody` record component
