# Introduction

> What the Bioprints palm API is, where to send calls, and how each call proves it comes from your tenant.

The Bioprints palm API stores palms for your tenant and tells your backend whose palm a capture is. You enroll a
person's hands under your own reference for them, then identify or verify later captures against your tenant's palms.
Your backend calls it server to server over HTTPS, with JSON bodies and camelCase names. The three calls that carry a
capture send it as `multipart/form-data`.

Bioprints asks for no name or phone number, and takes no payments. What a match means, and what your app does with it,
is yours to decide.

## Server

| Server | Address |
|---|---|
| Production | `https://api.bioprints.io` |

Every path starts with `/palm/v1`. There is no separate test server: a test tenant's key works against the same address,
and the palms it enrolls stay in a gallery of their own. [Tenants and test tenants](https://docs.bioprints.io/concepts/tenants-and-test-tenants.md)
explains how the two are kept apart.

To get a test key, or for help with anything these pages do not answer, message us on WhatsApp at
[+966 55 563 0629](https://wa.me/966555630629) or email [h.alsohaibi@handpay.sa](mailto:h.alsohaibi@handpay.sa).

## Authentication

Send your tenant's key on every call:

```text
Authorization: Bearer bpk_<key id>_<secret>
```

A key belongs to one client on one tenant, and works only from the IP addresses agreed with us for that client. When you
ask for a key, tell us the public addresses your servers call from. A key never belongs on a phone or in a browser.

Every problem with a key answers `401` `key_invalid`, whether the key is missing, unknown, revoked, expired or sent from
another address, so the answer never says which part was wrong.

To replace a key, ask us for a new one. Both keys work for 7 days, and then the old one is refused.

The reader calls take a registry key instead: see [Add a reader](https://docs.bioprints.io/how-to/add-a-reader.md). The contract itself,
`GET /palm/v1/openapi.json`, needs no key.

## Limits

Your tenant has a rate of palm calls a second and a gallery limit, both agreed with us. `GET /palm/v1/status` shows them.
Enroll, identify and verify count toward the rate, and no other call does. An enroll counts once for each hand it
searches and once for each hand it adds, so a two-hand enroll uses four. Over the rate, a call is refused `429`
`rate_limited` with `Retry-After`.

## Retrying a call

The calls that change a person, which are enroll, remove, freeze and unfreeze, take an `Idempotency-Key` header. It
names the action, so Bioprints can tell a retry from a new request:

| What happened | A retry with the same key and body gets |
|---|---|
| The first call succeeded, up to 24 hours ago | The first answer again. Nothing is done twice. |
| The first call is still running | `409` `idempotency_key_in_flight` with `Retry-After`. Wait, then retry. |
| The first call was refused | The call runs again, because a refusal is not remembered. |
| The key arrives with a different body or path | `422` `idempotency_key_mismatch`. Nothing is done. |

Make one key per action, such as a UUID, and keep it until the action has an answer. A capture's body is compared
without its multipart boundary, so your HTTP client may pick a new boundary on every retry.

Identify, verify and the calls that only read take no key: send them again as they are.

## Errors

A refused call answers with a [problem details](https://www.rfc-editor.org/rfc/rfc9457) body. Branch on its `code`,
which [Error codes](https://docs.bioprints.io/errors.md) lists with the HTTP status it comes back under.

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