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

# JwtOptions

> Configuration options for JWT generation.

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

```java theme={null}
public record JwtOptions(String keyId, String keySecret, String requestMethod, String requestHost, String requestPath, Optional<Long> expiresIn, Optional<List<String>> audience) extends Record
```

Configuration options for JWT generation.

Supports both EC (ES256) and Ed25519 (EdDSA) keys. For REST API requests, all request parameters (method, host, path) must be provided. For WebSocket JWTs, all request parameters should be null.

Example usage:

```

 // REST API JWT
 JwtOptions options = JwtOptions.builder("key-id", "key-secret")
     .requestMethod("GET")
     .requestHost("api.cdp.coinbase.com")
     .requestPath("/platform/v1/wallets")
     .expiresIn(120)
     .build();

 // WebSocket JWT (no URI claims)
 JwtOptions wsOptions = JwtOptions.builder("key-id", "key-secret").build();
 
```

## Field Details

### `DEFAULT_EXPIRES_IN`

```java theme={null}
public static final long DEFAULT_EXPIRES_IN
```

Default JWT expiration time in seconds.

**See Also:**

`Constant Field Values`

## Constructor Details

### `JwtOptions`

```java theme={null}
public JwtOptions(String keyId, String keySecret, String requestMethod, String requestHost, String requestPath, Optional<Long> expiresIn, Optional<List<String>> audience)
```

Validates the JWT options.

**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:**

`keyId` - `String`

`keySecret` - `String`

`requestMethod` - `String`

`requestHost` - `String`

`requestPath` - `String`

`expiresIn` - `Optional<Long>`

`audience` - `Optional<List<String>>`

## Method Details

### `builder`

```java theme={null}
public static JwtOptions.Builder builder(String keyId, String keySecret)
```

Creates a new builder for JwtOptions.

**Parameters:**

`keyId` (`String`) - the API key ID

`keySecret` (`String`) - the API key secret (PEM EC key or base64 Ed25519 key)

**Returns:**

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

### `getEffectiveExpiresIn`

```java theme={null}
public long getEffectiveExpiresIn()
```

Returns the effective expiration time in seconds.

**Returns:**

`long` - the expiration time, or the default if not set

### `isRestRequest`

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

Returns whether this is a REST API request (vs WebSocket).

**Returns:**

`boolean` - true if request parameters are provided

### `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. All components in this record class 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").

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

### `keyId`

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

Returns the value of the `keyId` record component.

**Returns:**

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

### `keySecret`

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

Returns the value of the `keySecret` record component.

**Returns:**

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

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

### `expiresIn`

```java theme={null}
public Optional<Long> expiresIn()
```

Returns the value of the `expiresIn` record component.

**Returns:**

`Optional<Long>` - the value of the `expiresIn` record component

### `audience`

```java theme={null}
public Optional<List<String>> audience()
```

Returns the value of the `audience` record component.

**Returns:**

`Optional<List<String>>` - the value of the `audience` record component
