# request_rejected

> Rivr refused the request

- Status: 400 Bad Request
- Returned by: /api/public
- Operations: [createOrder](https://developers.rivr.io/reference/api-public/createOrder.md), [refundOrder](https://developers.rivr.io/reference/api-public/refundOrder.md), [cancelOrder](https://developers.rivr.io/reference/api-public/cancelOrder.md), [createSubscription](https://developers.rivr.io/reference/api-public/createSubscription.md)
- Retry (`retryWhen`): `after_fix`
- Did anything happen? (`outcome`): `unknown` (Unknown)
- The request
- Page in the portal: https://developers.rivr.io/errors/request_rejected
- Try it: `GET https://developers.rivr.io/errors/simulate/request_rejected` answers with the code's exact wire form; `?succeedAfter=N&attempt=K` gives a 200 once `attempt` passes `N`

## What it means

A rule at Rivr refused the request, for example a customer who is blocked from Rivr or a person who can't be identified. `message` says why, with the same text as before, and it can be in Swedish. The order or subscription was not saved, but the patient may already have been looked up, created or updated and run through the KYC screening. The code also covers other errors of the same kind, and those can come after the change was saved.

## What your system does

Read `message` and fix what can be fixed, for example the personal number. Read the order with `GET /api/public/orders/{orderId}` before you send the request again, so you know whether it was saved. The same call gets the same answer. Contact Rivr if you don't understand the reason.

## 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`: `unknown`. **Unknown.** The answer doesn't say whether what you asked for has happened, through this call or an earlier one. Read the state first.

For the refusals `message` names, no order or subscription was saved, but the patient may have been looked up, created or updated, with details from the population register, and run through the KYC screening. The code also covers other errors of the same kind, which can come after the order or subscription was saved.

Read the state (`resolveWith`):

- `createOrder` → [`GET /api/public/orders/{orderId}`](https://developers.rivr.io/reference/api-public/getOrder.md): `204`: no order exists. `200`: the order exists, and `amount`, `orderLines`, `version` and `modifiedDate` show whether this very call's create or rewrite went through.
- `createSubscription` → [`GET /api/public/subscriptions/{subscriptionId}`](https://developers.rivr.io/reference/api-public/getSubscription.md): When you have the id from an earlier `201`. There is no read per person, but the call updates the clinic's subscription for the person and skips payments whose `externalReference` it already has, so a corrected retry creates no second subscription.
- `refundOrder` → [`GET /api/public/orders/{orderId}`](https://developers.rivr.io/reference/api-public/getOrder.md): `status` 8 (Refunded), or 32 (Cancelled) for an unpaid order, means it was done. For a refund the code is in practice answered before anything is done.
- `cancelOrder` → [`GET /api/public/orders/{orderId}`](https://developers.rivr.io/reference/api-public/getOrder.md): `status` 32 (Cancelled) means it was done.

## Example: /api/public

```http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "propertyName": "argument",
  "message": "Kunden är blockerad från att använda Rivr.",
  "errorCode": "request_rejected",
  "code": "request_rejected",
  "type": "https://developers.rivr.io/errors/request_rejected"
}
```

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