> For the complete documentation index, see [llms.txt](https://docs.sentiance.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sentiance.com/sdk/api-reference/android/token.md).

# Token

A token can be used to communicate with the [Sentiance API](https://developers.sentiance.com/docs/rest).

## Token API

### `getExpiryDate()`

> ```java
> Date getExpiryDate()
> ```
>
> Returns a [`Date`](https://developer.android.com/reference/java/util/Date) object indicating the token expiry date.
>
> The SDK will always attempt to return a valid token, granted proper network connectivity exists to allow token refresh.

### `getTokenId()`

> ```java
> String getTokenId()
> ```
>
> Returns the token ID.

### `isExpired()`

> ```java
> boolean isExpired()
> ```
>
> Returns true if the token is expired.

### `setExpiryDate()`

> ```java
> void setExpiryDate(Date expiryDate)
> ```
>
> Sets the token expiryDate

| Parameters |                                                                                                             |
| ---------- | ----------------------------------------------------------------------------------------------------------- |
| expiryDate | A [`Date`](https://developer.android.com/reference/java/util/Date) object indicating the token expiry date. |

### `setTokenId()`

> ```java
> void setTokenId(String tokenId)
> ```
>
> Sets the token ID.

| Parameters |               |
| ---------- | ------------- |
| tokenId    | The token ID. |
