# Enroll a palm and identify it

> With a test tenant's key, enroll one hand of a person, identify a second capture of it, and remove the person again.

In this tutorial you enroll one hand of a person in your test tenant, identify a second capture of the same hand, and
then remove the person so the test leaves nothing behind. It takes about 15 minutes once you have a key and a reader.

## Before you start

Ask us for a test tenant on WhatsApp at [+966 55 563 0629](https://wa.me/966555630629) or by email at
[h.alsohaibi@handpay.sa](mailto:h.alsohaibi@handpay.sa). Tell us the public IP address your computer or server will call
from, because a key works only from the addresses agreed for it. We send you:

- a test tenant key, starting `bpk_`;
- the serial of a reader your test tenant may use.

You also need two captures of the same hand, taken on that reader. Each capture is a pair of images from the reader: a
colour image and an infrared image, each a JPEG or PNG of exactly 720 × 1024 pixels. Save them as `first_rgb.jpg`,
`first_ir.jpg`, `second_rgb.jpg` and `second_ir.jpg`.

You need `curl` and a Bash shell. Set your key, your reader's serial and a reference for the person:

```bash
export BIOPRINTS_KEY='bpk_your_key'
export READER_SERIAL='VS2405110001'
export PERSON="tutorial-$(date +%s)"
```

The reference is yours: Bioprints answers it on every match, and never asks for a name or a phone number. A new
`PERSON` for each run keeps the runs apart.

## 1. Check your key

```bash
curl -s https://api.bioprints.io/palm/v1/status \
  -H "Authorization: Bearer $BIOPRINTS_KEY"
```

Bioprints answers `200 OK` with your tenant's health, limits and usage:

```json
{
  "status": "up",
  "engine": "up",
  "gallery": { "hands": 0, "limit": 100 },
  "rate": { "palmCallsPerSecond": 2 },
  "usage": { "month": "2026-11", "enrolls": 0, "identifies": 0, "verifies": 0, "activeHands": 0 }
}
```

A `401` `key_invalid` means the key is wrong or you are calling from an address it is not allowed from.

## 2. Enroll the hand

Send the first capture as the person's left hand:

```bash
curl -s https://api.bioprints.io/palm/v1/people/$PERSON/hands \
  -H "Authorization: Bearer $BIOPRINTS_KEY" \
  -H "Idempotency-Key: $PERSON-enroll" \
  -F "metadata={\"sensorSerial\": \"$READER_SERIAL\", \"hands\": [\"left\"]};type=application/json" \
  -F "left_rgb=@first_rgb.jpg;type=image/jpeg" \
  -F "left_ir=@first_ir.jpg;type=image/jpeg"
```

Bioprints answers `201 Created` with the person's hands:

```json
{
  "subjectReference": "tutorial-1795705200",
  "hands": [
    { "hand": "left", "state": "enrolled", "enrolledAt": "2026-11-27T09:14:03+00:00" }
  ]
}
```

The `Idempotency-Key` makes the call safe to repeat: the same request with the same key gets this answer back, and the
hand is never enrolled twice. [Retrying a call](https://docs.bioprints.io/index.md#retrying-a-call) says when to use a new key.

| If the answer is | It means |
|---|---|
| `422` `capture_quality_too_low` | The engine could not use the image. Take the capture again. |
| `403` `sensor_not_allowed` | The serial is not a reader your test tenant may use. Check `READER_SERIAL`. |
| `400` `capture_malformed` | A part is missing, or an image is not a 720 × 1024 JPEG or PNG. |
| `409` `palm_already_enrolled` | This palm already belongs to another person in your test tenant. `existingSubjectReference` names them when Bioprints knows whose palm it is. |

## 3. Identify the second capture

```bash
curl -s https://api.bioprints.io/palm/v1/people:identify \
  -H "Authorization: Bearer $BIOPRINTS_KEY" \
  -F "metadata={\"hand\": \"left\", \"sensorSerial\": \"$READER_SERIAL\"};type=application/json" \
  -F "left_rgb=@second_rgb.jpg;type=image/jpeg" \
  -F "left_ir=@second_ir.jpg;type=image/jpeg"
```

Bioprints answers `200 OK` with the person the palm belongs to:

```json
{
  "identificationId": "019ac3e1-6f3c-7b8d-9a1e-2c4f5e6a7b8c",
  "match": {
    "subjectReference": "tutorial-1795705200",
    "hand": "left",
    "scores": [0.98, 0.97, 0.99, 0.96, 0.95, 0.97, 0.98, 0.99, 0.96, 0.97],
    "thresholds": [0.729, 0.756, 0.729, 0.76, 0.7336, 0.739, 0.7579, 0.75, 0.72, 0.7312]
  }
}
```

A `200` is a match: the engine's own verdict passed, so you do not compare the scores yourself. A capture that matches
nobody answers `404` `no_match`, with an `identificationId` you can quote to us.

A test tenant allows only a few palm calls a second, and the enroll used two of them: one to search the gallery and one
to add the hand. Sent within that second, identify answers `429` `rate_limited` with `Retry-After: 1`. Wait a second and
send it again.

## 4. Remove the person

```bash
curl -s -X DELETE https://api.bioprints.io/palm/v1/people/$PERSON \
  -H "Authorization: Bearer $BIOPRINTS_KEY" \
  -H "Idempotency-Key: $PERSON-remove"
```

Bioprints answers `200 OK` once the engine has confirmed the delete, which usually takes a moment:

```json
{
  "subjectReference": "tutorial-1795705200",
  "hands": [
    { "hand": "left", "state": "removed", "enrolledAt": "2026-11-27T09:14:03+00:00" }
  ]
}
```

If the engine has not confirmed yet, the answer is `202 Accepted` with the hand `removing`.

From this moment the hand is never matched again, and Bioprints finishes the delete on its own. Run step 3 again and it
answers `404` `no_match`.

## Next steps

- [Verify a palm](https://docs.bioprints.io/how-to/verify-a-palm.md): check a capture against the person you expect.
- [Read the deletions list](https://docs.bioprints.io/how-to/read-the-deletions-list.md): the record of the hand you just removed.
- [Galleries](https://docs.bioprints.io/concepts/galleries.md): what a match means and why two people can never share a palm.

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