# Refusals: every code of a device owner's calls

Every refusal is JSON with `code`, `cause` and `fix`, and its HTTP status is not 200 or 201. The `fix` of the answer you hold is the service's own word for what to do: where this page and that `fix` differ, the answer wins. This page adds who acts, you or your person, and the step to return to. A refusal that names a time carries `retryAt` and a `Retry-After` header: wait until then.

A block of these guides prints `code`, `cause` and `fix` when a call is refused. If a block prints a jq error instead, read the file it wrote, or send the call again without jq: the answer is a refusal.

## The calls

- `GET /app/api/signup/challenge` and `POST /app/api/signup`: a new account.
- `POST /app/api/login`: sign in with the access code.
- `GET /app/api/agreement`, `GET /app/api/consent` and `POST /app/api/consent`: read and sign the partner agreement.
- `POST /app/api/devices` and `GET /app/api/devices`: enrol a device, and list the devices.
- `GET /app/api/earnings`, `GET /app/api/payouts` and `POST /app/api/payouts`: the statement and a payout.
- `POST /app/api/devices/{deviceId}/withdraw`: the account withdraws a device.
- `GET /app/api/devices/{deviceId}/self` and `POST /app/api/devices/{deviceId}/self/withdraw`: a device reads and withdraws itself.

## The calls' refusals

| Code | Answered by | Who acts | Do |
|---|---|---|---|
| `registration_closed` | sign-up | your person | new accounts are not made now: they give you the access code of their account, in `coronium-account.json` |
| `signups_paused` | sign-up | you | the hour's new accounts are spent: wait until `retryAt`, then ask a new challenge |
| `challenge_required` | sign-up | you | send the `challenge` and a `nonce`, as enrolment step 1 does |
| `challenge_invalid`, `challenge_expired`, `challenge_used`, `challenge_wrong_use` | sign-up | you | ask a new challenge and solve that one; a challenge is spent by one sign-up |
| `proof_insufficient` | sign-up | you | the nonce does not solve the challenge: solve it again as the block does |
| `challenge_too_easy` | sign-up | you | ask a new challenge from the network you send from |
| `rate_limited` | sign-up, sign-in, a device's own two calls | you | wait until `retryAt`, or a few minutes when none is given; do not loop |
| `bad_credentials` | sign-in | your person | the access code is wrong or was replaced: they give you the current one |
| `sign_in_required` | every call with a session | you | sign in again, as enrolment step 1 does; the session cookie belongs to the site you signed in on |
| `session_required` | every call | you | a call with a session takes the cookie and no `Authorization` header; a device's own call takes its header and no cookie |
| `consent_not_approved` | the agreement, signing, enrolment | nobody yet | the text is a draft on this service: nothing can be signed or enrolled until `approved` reads true |
| `confirmation_required` | signing, enrolment, withdrawal | your person | their yes is missing: send `agreed` or `confirm` as true only after they said it |
| `consent_outdated` | signing, enrolment | your person | the text changed: read it again, show it, sign the text in force |
| `invalid_signer` | signing | your person | the name is not a full legal name as the call takes it: write `coronium-signer.json` again |
| `bad_signed_at` | signing | you | the device's clock is off: set it, delete `coronium-signature.json`, sign again |
| `bad_signature` | signing | you | the fingerprint does not match the fields: delete `coronium-signature.json` and run the signing block again |
| `already_signed` | signing | nobody | this version is signed already, with other values: that signature stands; go on to enrolment |
| `signing_not_configured` | signing, enrolment | the operator | the service cannot take a signature now: tell your person and the contact below |
| `agreement_unsigned` | enrolment | your person | sign the text in force first: enrolment steps 2 and 3 |
| `device_cap_reached` | enrolment | your person | the account holds as many devices as `terms.deviceLimit` allows: withdraw one for good, or ask for a higher limit |
| `enrol_rate_reached` | enrolment | you | the account's day of enrolments is spent: send again after `retryAt` |
| `enrolment_repeated` | enrolment | you | this `requestId` enrolled `deviceId` already and its secret was shown once: withdraw that device, delete `coronium-enrol.json` and `coronium-device.json`, enrol again |
| `invalid` | any call with a body or a query | you | a field is missing, unknown or out of range: `cause` names it |
| `proof_required` | a payout | your person | the access code sent as proof is not the current one |
| `not_whole_cents`, `below_minimum`, `nothing_available` | a payout | your person | correct the amount: whole cents, at least `payoutMinimumUsdMicros`, at most `available.usdMicros` |
| `payout_pending` | a payout | nobody | one request waits at a time: wait until it is paid or declined |
| `amount_changed` | a payout | you | this `requestId` was sent before with other values: send the first values, or a new `requestId` |
| `buyer_in_debt` | a payout | your person | the account owes for traffic it sent as a buyer: they add funds on the buyer site |
| `payout_held` | a payout | your person | a password or access code of the account was set through an emailed link, or a change was reported as not theirs, a short while ago: send the payout again after `retryAt` |
| `device_not_found` | withdrawal, a device's own two calls | you | the id is not a device of this account, or the header is not this device's secret |

## From the gateway

These come from the web server in front of the service, before any call is read.

| Code | Means | Do |
|---|---|---|
| `rate_limited` | too many requests or connections from this address | wait a few seconds |
| `not_found` | nothing is served at this address | read [/llms.txt](/llms.txt) for the addresses of this site |
| `method_not_allowed` | the address takes another method | read [/openapi.json](/openapi.json) for the call |
| `body_too_large` | the body is over the size the address takes | send a shorter body |
| `wrong_origin` | a request named another site as its origin | send no `Origin` header from a program |
| status `503`, with any code | the service behind the address did not answer | try again in a minute |

## Enrolment by token

`POST /app/api/enrol-tokens`, `GET /app/api/enrol-tokens`, `POST /app/api/enrol-tokens/{tokenId}/revoke`, `PUT /app/api/devices/{deviceId}` and `PUT /app/api/devices` answer `503` with `enrol_tokens_off`, before they read anything, while the operator keeps enrolment by token closed. Then each device is enrolled with `POST /app/api/devices`. [Many devices](/guides/device-tokens.md) describes the calls for when they answer.

## The contact

<!-- facts:begin supply.contact -->
The one contact for device owners is support@coronium.ai: a question, more devices, or a withdrawal the account cannot make itself.
<!-- facts:end supply.contact -->
