> For the complete documentation index, see [llms.txt](https://help.citrusad.com/retail-media-interface/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.citrusad.com/retail-media-interface/partner/partner-api-authentication/user-key-authentication.md).

# User key token

## Requesting tokens

To receive your required access token, make a request to the `/user-key-token` endpoint by adding the following parameters using the `application/x-www-form-urlencoded` format with a character encoding of UTF-8 in the HTTP request body.

```http
POST https://auth.<env>.citrusad.com/v2/user-key-token
Content-Type: application/x-www-form-urlencoded
user_key=<USER_KEY>
```

You will receive a response with an `accessToken`,`expiresIn`, and `tokenType`.

```json
{
    "accessToken": "ACCESS_TOKEN",
    "expiresIn": 84000,
    "tokenType": "Bearer"
}
```

{% hint style="info" %}
Your **access** token is used to access the Epsilon Retail Media API.
{% endhint %}

## Refresh token

When your access token expires, you will receive an invalid token error from the campaign API. In this case, you will make a request to the `/token` endpoint with your refresh token as illustrated in the diagram below:

<figure><img src="https://110176934-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyPijakfWdNW5OjxjMGoY%2Fuploads%2Fgit-blob-4c11a28eb55016394366c69497940023a2df8f0f%2FAuthentication_refresh_flow.png?alt=media" alt="Authentication refresh flow.png" width="100%"><figcaption></figcaption></figure>

Usually, a user will only need a new access token when the previous one expires, or when they gain or lose access to resources that are attached to their claims. It is bad practice to call the endpoint to get a new access token for every request to our API.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.citrusad.com/retail-media-interface/partner/partner-api-authentication/user-key-authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
