# token_invalid

> The token is not valid

- Status: 401 Unauthorized
- Returned by: /api/public
- Operations: [createOrder](https://developers.rivr.io/reference/api-public/createOrder.md), [getOrder](https://developers.rivr.io/reference/api-public/getOrder.md), [getOrderStatus](https://developers.rivr.io/reference/api-public/getOrderStatus.md), [getOrderReceipt](https://developers.rivr.io/reference/api-public/getOrderReceipt.md), [refundOrder](https://developers.rivr.io/reference/api-public/refundOrder.md), [cancelOrder](https://developers.rivr.io/reference/api-public/cancelOrder.md), [sendOrderToDevice](https://developers.rivr.io/reference/api-public/sendOrderToDevice.md), [getDevices](https://developers.rivr.io/reference/api-public/getDevices.md), [getHealthSecure](https://developers.rivr.io/reference/api-public/getHealthSecure.md), [listMerchants](https://developers.rivr.io/reference/api-public/listMerchants.md), [getMerchant](https://developers.rivr.io/reference/api-public/getMerchant.md), [getOnboardingProgress](https://developers.rivr.io/reference/api-public/getOnboardingProgress.md), [createOnboardingLink](https://developers.rivr.io/reference/api-public/createOnboardingLink.md), [getOnboardingLinks](https://developers.rivr.io/reference/api-public/getOnboardingLinks.md), [getOnboardingLink](https://developers.rivr.io/reference/api-public/getOnboardingLink.md), [refreshOnboardingLink](https://developers.rivr.io/reference/api-public/refreshOnboardingLink.md), [listOrderSettlements](https://developers.rivr.io/reference/api-public/listOrderSettlements.md), [getOrderSettlement](https://developers.rivr.io/reference/api-public/getOrderSettlement.md), [getNextUnreadSettlement](https://developers.rivr.io/reference/api-public/getNextUnreadSettlement.md), [createSubscription](https://developers.rivr.io/reference/api-public/createSubscription.md), [getSubscription](https://developers.rivr.io/reference/api-public/getSubscription.md)
- Retry (`retryWhen`): `after_fix`
- Did anything happen? (`outcome`): `none` (It did not happen)
- Access and organisation
- Page in the portal: https://developers.rivr.io/errors/token_invalid
- Try it: `GET https://developers.rivr.io/errors/simulate/token_invalid` answers with the code's exact wire form; `?succeedAfter=N&attempt=K` gives a 200 once `attempt` passes `N`

## What it means

The token was not accepted: it is malformed, has the wrong signature or the wrong audience (`aud`). In `/api/public`, the members the answer carried before stay: `title`, `status` and `detail`, or `error` and `error_description` for a token from rivr-auth. `detail` is a fixed text that starts with `The token is invalid: `; in production the identity library's own message follows it until the platform's next release.

## What your system does

Get a new token and send it as `Authorization: Bearer`. The same token gets the same answer again.

## Is it worth retrying?

No, not without changing the call.

`retryWhen`: `after_fix`. Change the request first, as the code's page says: a value, the token, a header or a new key. Then send it.

## Did anything happen?

`outcome`: `none`. **It did not happen.** This call did not do what you asked for and changed nothing else that you can see or that concerns money. Where the code has an `outcomeNote`, it takes precedence.

## Example: /api/public

```http
HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
  "title": "Unauthorized",
  "status": 401,
  "detail": "The token is invalid: The token was not accepted.",
  "propertyName": null,
  "message": "The token was not accepted. Get a new token and send it in the Authorization header, after Bearer.",
  "errorCode": "token_invalid",
  "code": "token_invalid",
  "type": "https://developers.rivr.io/errors/token_invalid"
}
```

The `title`, `detail`, `message` and `error_description` texts are exactly as the API writes them today.
