# Error codes

> Every code the Bioprints palm API refuses a call with, the HTTP status it comes back under, and what it means.

A refused call answers with a [problem details](https://www.rfc-editor.org/rfc/rfc9457) body, `Content-Type: application/problem+json`:

```json
{
  "status": 404,
  "title": "Request refused",
  "code": "subject_not_found"
}
```

Branch on `code`. `title` and `detail` are for people, and other fields may appear beside these. Every problem with a key, whether missing, unknown, revoked, expired or used from an address it is not allowed from, answers the same `key_invalid`.

## 400 Bad Request

| Code | Meaning |
|---|---|
| `capture_malformed` | A part is missing, a part is for a hand the call does not name, an image is not a 720 × 1024 JPEG or PNG, or the request is over 2 MiB. |
| `idempotency_key_invalid` | The `Idempotency-Key` is not printable ASCII, holds a space, or is over 200 characters. |
| `idempotency_key_missing` | No `Idempotency-Key` header was sent. |
| `request_invalid` | The body cannot be read, a required field is missing or `null`, or a value is not one this call takes. |

## 401 Unauthorized

| Code | Meaning |
|---|---|
| `key_invalid` | No key, a key Bioprints does not know, a revoked or expired key, or a call from an address the key is not allowed from; every key problem answers this same code. |

## 403 Forbidden

| Code | Meaning |
|---|---|
| `sensor_not_allowed` | `sensorSerial` is missing, not a reader sold to your tenant, or a frozen reader. |
| `tenant_suspended` | The key is valid, and Bioprints has suspended its tenant. |

## 404 Not Found

| Code | Meaning |
|---|---|
| `hand_not_enrolled` | The person has no enrolled hand of this side. |
| `no_match` | The capture matches nobody in your tenant; `identificationId` names this identification. |
| `not_verified` | The capture is not that person, or the hand is frozen or being removed; `verificationId` names this verification. |
| `reader_not_found` | The serial is not a reader on your tenant. |
| `subject_not_found` | No live person has this reference. |

## 409 Conflict

| Code | Meaning |
|---|---|
| `gallery_full` | Your tenant's gallery is full. |
| `hand_already_enrolled` | The person already has this hand enrolled; revoke it first. |
| `idempotency_key_in_flight` | A call with the same key and request is still running; retry after `Retry-After`. |
| `palm_already_enrolled` | The palm already belongs to another live person in your tenant; `existingSubjectReference` names them when Bioprints knows whose palm it is. |
| `reader_unavailable` | The serial belongs to another tenant. |
| `tenant_busy` | Another enroll or revoke of your tenant held on longer than this call could wait; retry after `Retry-After`. |

## 422 Unprocessable Entity

| Code | Meaning |
|---|---|
| `capture_quality_too_low` | The image failed the engine's quality check, or the engine could not use it. |
| `idempotency_key_mismatch` | The key was already used with a different body or path. |

## 429 Too Many Requests

| Code | Meaning |
|---|---|
| `rate_limited` | Your tenant is over its palm calls a second; retry after `Retry-After`. |

## 503 Service Unavailable

| Code | Meaning |
|---|---|
| `engine_busy` | The engine is busy for everyone; retry after `Retry-After`. |
| `engine_unavailable` | The engine did not answer, or Bioprints is not calling it for the moment; retry after `Retry-After`. |

Source: https://docs.bioprints.io/errors
