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

# Refresh an Expired Access Token

When your current user access token expires, exchange the refresh token you received alongside it for a new one — no need to re-run the full credential flow.

<Info>
  **You'll need:** your `API Key` (use your Test API Key in the sandbox) and the `Refresh Token` returned when the access token was issued.
</Info>

<Steps>
  <Step title="Call refreshUserAccessToken">
    Replace `<YOUR_SANDBOX_API_KEY>` and `<YOUR_REFRESH_TOKEN>` with your credentials:

    ```bash theme={null}
    curl -X POST https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
      -H "Authorization: Basic <YOUR_SANDBOX_API_KEY>" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "mutation refreshUserAccessToken($refreshToken: String!) { refreshUserAccessToken(refreshToken: $refreshToken) { token refreshToken scopes } }",
        "variables": {
          "refreshToken": "<YOUR_REFRESH_TOKEN>"
        }
      }'
    ```
  </Step>

  <Step title="Store the new token">
    The response contains a fresh access token carrying the same scopes as the previously issued token:

    ```json theme={null}
    {
      "data": {
        "refreshUserAccessToken": {
          "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
          "refreshToken": "0cb671d0b1aaa727c96874270cd15c2f",
          "scopes": ["LIST_PURCHASES", ...]
        }
      }
    }
    ```

    Copy the `token` value and use it in the `Authorization: Bearer <YOUR_USER_ACCESS_TOKEN>` header for authenticated requests, exactly as before. Store the new `refreshToken` too — you'll need it for the next refresh.
  </Step>
</Steps>

<Tip>
  Refresh proactively, before the current token expires, rather than waiting for a `401` and refreshing reactively. It keeps requests from failing under load.
</Tip>

## Next steps

<Card title="Quickstart: your first gift card purchase" icon="gift" horizontal href="/quickstart">
  With a valid token in hand, run the full happy path end to end — deposit funds, buy a gift card, and reveal it in the sandbox.
</Card>
