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

# Authentication Tokens

> Authentication token lifecycle: automatic generation, using X-Jelou-Token, CLI management, and practical examples.

## What are runtime tokens?

Runtime tokens (prefix `jfn_rt_`) are credentials that authenticate requests to your functions in production.

## Automatic generation

The first deploy generates a token automatically:

```bash theme={null}
jelou functions deploy
# ✓ Deployed
# ⚠ A default runtime token was created for this function.
#   Save it now — it will not be shown again.
# ▸ Token    jfn_rt_abc123...
```

<Warning>
  The token is shown **only once**. Subsequent deploys don't show it. If you lose it, create a new one with `jelou tokens create`.
</Warning>

## How to use

Send the token in the `X-Jelou-Token` header:

```bash theme={null}
curl -X POST https://my-function.fn.jelou.ai \
  -H "Content-Type: application/json" \
  -H "X-Jelou-Token: jfn_rt_abc123..." \
  -d '{"phone": "593987654321"}'
```

| Rule          | Detail                                        |
| ------------- | --------------------------------------------- |
| Header        | `X-Jelou-Token` (not `Authorization: Bearer`) |
| Format        | Header only — not query param, not body       |
| Max size      | 4 KB                                          |
| Missing token | `401 { "error": "Unauthorized" }`             |

## CLI management

```bash theme={null}
# List tokens
jelou tokens list my-function

# Create additional token
jelou tokens create my-function --name ci-deploy
```

<Warning>
  Creating a token triggers an **automatic redeploy** of your function. The code doesn't change, but the platform needs to update the available tokens in the runtime environment.
</Warning>

```bash theme={null}
# Revoke token
jelou tokens revoke my-function <token-id> -y
```

<Warning>
  Revoking a token also triggers an **automatic redeploy**. Clients using that token will start receiving `401` once the redeploy completes.
</Warning>

## Multiple tokens

You can have multiple active tokens per function — one per environment, service, or team. Revoking one doesn't affect others.

## Lost token?

Create a new one: `jelou tokens create my-function --name new-token`. The old token stays active.

## Brain Studio

| Field        | Value                                 |
| ------------ | ------------------------------------- |
| URL          | `https://my-function.fn.jelou.ai/mcp` |
| Header name  | `X-Jelou-Token`                       |
| Header value | `jfn_rt_abc123...`                    |
