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

# token_wrong_environment

> Token wrong environment: HTTP 401 from the Rask API v3. What it means, what to do and which operations return it.

| Status | `retry` | `recommendation` |
| - | - | - |
| 401 | `none` | `fix_request` |

## What happened

Token wrong environment. For example: A test key was sent to the production API.

## What to do

Use a raskai\_live\_ key with api.rask.ai and a raskai\_test\_ key with a test environment.

[Authentication](https://docs.api.rask.ai/authentication.md#what-each-401-means) covers every 401. Keys are created in the web app, under [**Settings -> API keys**](https://app.rask.ai/account/api-keys).

`fix_request`: change the request or its inputs; sent unchanged it fails again.

`none`: do not retry the request unchanged.

## Example

```json theme={null}
{
  "type": "https://docs.api.rask.ai/errors/token_wrong_environment",
  "title": "Token wrong environment",
  "status": 401,
  "detail": "A test key was sent to the production API.",
  "instance": "urn:uuid:7d5c0e9a-3f1b-4c2e-9a8d-6b4f2e1c0d93",
  "code": "token_wrong_environment",
  "retryable": false,
  "retry": "none",
  "recommendation": "fix_request",
  "hint": "Use a raskai_live_ key with api.rask.ai and a raskai_test_ key with a test environment.",
  "errors": [],
  "token_env": "test",
  "server_env": "live"
}
```

## Operations that return it

Most operations: 82 of 82 declare it. The reference page of each operation lists its errors.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.