# Refresh Access Token

Use this endpoint to exchange the Refresh Token you received during authorization for a new Access Token.

## Refresh Access Token

<mark style="color:green;">`POST`</mark> `https://auth.myeshopbox.com/api/v1/generateToken`

This endpoint allows you to generate a new access token.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name           | Type   | Description                                                                                           |
| -------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| grant\_type    | string | Denotes the flow you are using to generate Access Token. For Refresh Token Flow, use `refresh_token`. |
| client\_id     | string | Your application's Client ID.                                                                         |
| client\_secret | string | Your application's Client Secret.                                                                     |
| refresh\_token | string | The Refresh Token you received during authorization to obtain a new Access Token.                     |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "access_token": "eyJhbGci...kpXVCIsI",
    "id_token": "eUzI1Ni...I6IkpXsIm",
    "scope": "openid profile",
    "expires_in": 86400,
    "token_type": "Bearer"
}
```

{% endtab %}
{% endtabs %}

⚠️ Token Usage & Rate Limiting Notice\
To ensure reliable and uninterrupted access to our API, please note the following regarding authentication token handling:<br>

* Token Lifetime: Tokens have a validity of 30 days.
* Caching Required: You must cache the token per user and reuse it for subsequent requests until it expires.
* Token Renewal: Only call the token generation endpoint once the cached token has expired.
* Repeated, unnecessary requests to the token generation endpoint can lead to rate limiting and degraded performance. To prevent this, implement proper token caching and expiration checks in your integration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eshop.gitbook.io/eshopbox-developers/basics/authentication/refresh-access-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
