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

# Authentication

Get an OAuth Bearer token with the client credentials flow, and send it with each request.

Most operations need an OAuth Bearer token. Your server gets the token with the OAuth client credentials flow, with no user. The token gives full read and write access to the API of your environment.

## Get your credentials

To get a `client_id` and a `client_secret`, contact [Limio Support](mailto:support@limio.com?subject=Request%20for%20API%20client%20credentials). Give the URL of your Limio environment, for example `https://acme.prod.limio.com`.

Keep the `client_secret` on your server. Do not put it in code that runs in a browser or in a mobile app.

## Get a token

Send a `POST` request to `https://<hostname>/oauth2/token`, as `application/x-www-form-urlencoded`. `<hostname>` is the hostname of your environment, for example `acme.prod.limio.com` (EU hosting) or `acme.prod-us.limio.com` (US hosting).

| Form parameter  | Value                |
| --------------- | -------------------- |
| `grant_type`    | `client_credentials` |
| `client_id`     | Your `client_id`     |
| `client_secret` | Your `client_secret` |

```bash
curl --request POST \
  --url https://acme.prod.limio.com/oauth2/token \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials \
  --data client_id="$LIMIO_CLIENT_ID" \
  --data client_secret="$LIMIO_CLIENT_SECRET"
```

The response gives the token and its lifetime in seconds:

```json
{
  "access_token": "<token>",
  "token_type": "Bearer",
  "expires_in": 3600
}
```

When the token expires, send the same request again to get a new token.

## Send the token

Send the token in the `Authorization` header of each request:

```
Authorization: Bearer <token>
```

If the token is missing, not valid or expired, the API returns `401`.

## API keys (legacy)

Three deprecated catalog reads, `/products`, `/pages` and `/segments`, also accept a publishable API key. Limio is moving all operations to OAuth Bearer tokens, so use a Bearer token for a new integration.

A publishable API key gives read-only access to the catalog, so code that runs in a browser can use it. Send the key in the `Authorization` header with no `Bearer` prefix.

To make a key, log in to Limio and go to **Profile > Developers > Limio Keys**. Then click **Generate New**. Each account can have two keys. To delete a key, click **Delete** next to it. A deleted key stops working at once, and you cannot restore it.


---

# 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://docs.limio.com/api/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.
