> ## Documentation Index
> Fetch the complete documentation index at: https://docs.huemn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration guide

> From signup and an API key to detection, comparison and a complete collection lifecycle.

Use this page to integrate Huemn from your server. You need permission to process every image you submit. Similarity is not identity proof or liveness; no embedding or biometric template is returned to your application.

## 1. Sign up and create a key

Open the [dashboard](https://platform.huemn.com/), choose **Sign in or create an account**, and verify your email. Create or select an organization, then create or select an environment and processing purpose. Organization owners and admins can create environments. Eligible verified users may receive the configured \$1 trial once; the dashboard reports eligibility and the actual balance.

In **API keys**, choose **Create API key**. Select only the permissions your service needs and an expiry. Save the key directly into your server's secret manager when it is shown once. Inject it at runtime as `HUEMN_API_KEY`; never include it in browser/mobile code, URLs or source control. Rotation immediately revokes the previous key. See [accounts and permissions](https://docs.huemn.com/account-guide.md).

The examples below assume a key with detection, comparison, collection creation/read/delete, face write/search/delete and operation-read permissions. Use narrower keys for production services.

## 2. Make your first call

The API base is `https://api.huemn.com`; requests use `Authorization: Bearer <API key>`. Pricing is public at `GET https://api.huemn.com/v1/pricing`.

Start with an authorized JPEG or PNG no larger than 1 MiB. This command creates a local request file containing the image; keep it out of source control and logs and remove it after use.

```bash theme={null}
printf '{"image":{"base64":"%s"}}' "$(base64 < face.jpg | tr -d '\n')" > detect.json
curl --fail-with-body 'https://api.huemn.com/v1/faces/detect' \
  -H "Authorization: Bearer $HUEMN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @detect.json
rm detect.json
```

A successful detection returns `requestId`, `modelVersion` and `faces`, each with a normalized `boundingBox` and `confidence`. No faces is a successful empty list. The [quickstart](https://docs.huemn.com/quickstart.md) explains image orientation and admission identities.

## 3. Create a collection and enroll

Use a collection per end customer or isolated dataset. Tenant, environment and purpose come from the key; metadata cannot override those boundaries.

```bash theme={null}
curl --fail-with-body 'https://api.huemn.com/v1/collections' \
  -H "Authorization: Bearer $HUEMN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"name":"Integration example"}'
```

Save the returned `collection.id` as `COLLECTION_ID`. Omitting `retentionDays`, or passing null, creates a collection whose faces persist until deleted unless an individual face has an expiry. To apply a retention period, pass a positive `retentionDays`. There is no product retention cap, but the value and resulting expiry must fit the supported integer and date ranges. The returned `collection.retentionDays` is null for a persistent collection.

Prepare `enroll.json`, replacing every placeholder. Use a new non-nil UUID for `faceId` and retain it before sending:

```json theme={null}
{
  "faceId": "<your UUID>",
  "image": {"base64": "<standard base64 JPEG or PNG>"},
  "metadata": {"customerId": "customer-example", "recordId": "record-example"}
}
```

```bash theme={null}
curl --fail-with-body "https://api.huemn.com/v1/collections/$COLLECTION_ID/faces" \
  -H "Authorization: Bearer $HUEMN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @enroll.json
```

`subjectRef` and `consentRef` are independently optional; omit them or pass null when unused. When supplied, keep them as opaque references of 1–256 characters without control characters, and retain the authorization evidence identified by `consentRef` in your own system. Omitting a reference does not remove your responsibility to have permission to process the image.

`expiresAt` is optional. If omitted or null, a persistent collection keeps the face until deletion; a collection with a retention period computes its expiry from enrollment time. An explicit expiry must be a future RFC 3339 timestamp and cannot exceed a finite collection retention period. Responses use null `expiresAt` for faces without expiry and null `subjectRef` when no subject reference was supplied.

Enrollment requires exactly one face. HTTP 202 with `indexingState: "pending"` means accepted for asynchronous indexing, not immediately searchable. Retain the exact request for a deliberate retry after an uncertain outcome. Reuse the same face ID and payload; changing them can create a conflict or a different enrollment. Remove local image-bearing files when your authorized retry workflow no longer needs them.

Optional `metadata` is a flat string-to-string object: at most 50 keys, 40 characters per key and 500 per value. Keys use letters, digits, `_`, `.` or `-`. Do not include names, contact details, government identifiers, health or biometric data. Metadata is returned on enrollment, listing and search; it is not searchable, filterable or an authorization control.

## 4. Search and list faces

Prepare `search.json` with one query face:

```json theme={null}
{"image":{"base64":"<query image base64>"},"operatingPoint":"default","limit":20}
```

```bash theme={null}
curl --fail-with-body "https://api.huemn.com/v1/collections/$COLLECTION_ID/search" \
  -H "Authorization: Bearer $HUEMN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @search.json
curl --fail-with-body "https://api.huemn.com/v1/collections/$COLLECTION_ID/faces?limit=20" \
  -H "Authorization: Bearer $HUEMN_API_KEY"
```

Search returns `matches`, `threshold`, `modelVersion` and `operatingPointVersion`. Each match includes `faceId`, `subjectRef`, `metadata` and `score`. An empty result is valid, including while indexing is pending; never force a match. If your application checks again, use a bounded delay and deadline and account for each new successful search being billable.

Listing returns `records` and `nextCursor`. When the cursor is non-null, pass it as `after` for the next page. Limits are 1–100; pagination is a live view. Listing does not expose images or templates.

## 5. Compare two images

Prepare `compare.json` with exactly one face in each image:

```json theme={null}
{
  "sourceImage": {"base64": "<source image base64>"},
  "targetImage": {"base64": "<target image base64>"},
  "operatingPoint": "default"
}
```

```bash theme={null}
curl --fail-with-body 'https://api.huemn.com/v1/faces/compare' \
  -H "Authorization: Bearer $HUEMN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @compare.json
```

Read the returned `match`, `score`, `threshold`, `modelVersion` and `operatingPointVersion`. Huemn uses a cosine score, not a probability. The `default` threshold is inherited and uncalibrated; see [operating-point details](https://docs.huemn.com/quickstart.md#the-default-operating-point) and [evaluation guidance](https://docs.huemn.com/evaluation.md) before making consequential decisions.

## 6. Delete data

Delete a face using its saved ID:

```bash theme={null}
curl --fail-with-body -X DELETE "https://api.huemn.com/v1/collections/$COLLECTION_ID/faces/$FACE_ID" \
  -H "Authorization: Bearer $HUEMN_API_KEY"
```

HTTP 202 `deletion_pending` suppresses authoritative visibility and schedules erasure. It has no operation ID and is not proof of physical purge.

To remove the collection, call `DELETE /v1/collections/{collectionId}`, save `operation.id`, and inspect `GET /v1/operations/{operationId}` until `completed` or `failed`, with bounded polling. Pending/running states do not establish completion.

For deletion across collections, [face lifecycle](https://docs.huemn.com/face-lifecycle.md) documents subject erasure and consent withdrawal, their scopes and the required erasure idempotency key. Reads and authorized deletion do not require inference credits, including at zero balance.

## Errors and retries

Errors include a safe `error.code`, `error.message` and `error.requestId`. Keep request IDs for support without logging image bodies, keys, subject references or biometric results.

| Status | Action |
| - | - |
| 400 / 413 | Correct the request or reduce image size; do not retry unchanged. |
| 401 / 403 | Check the key, expiry, scope, environment and processing authorization. |
| 402 | Check available credits; privacy deletion remains available. |
| 404 | Check the ID and authorized collection/environment. |
| 409 | Inspect the conflict or existing admission; do not silently create a new identity. |
| 422 | Supply the required single face for compare, enrollment or search. |
| 429 | Back off with a bounded deadline; avoid unbounded retry loops. |
| 503 / transport timeout | Treat mutation outcomes as uncertain; preserve request identity and reconcile before repeating. |

An optional `Idempotency-Key` on image operations deduplicates accounting; it does not replay inference results. An identical admitted retry can return 409 `ADMISSION_ALREADY_EXISTS` with accounting status. See [retry semantics](https://docs.huemn.com/quickstart.md#admission-identity-and-credits) before enabling retries.

## SDKs, limits and pricing

TypeScript SDK source is in `huemn-web/packages/api-client`; Python source is in `huemn-backend-services/sdk/python`. These repositories are private; there is no public npm/PyPI installation step in this guide. Use the HTTP examples above to integrate without SDK access. Both SDKs default to `https://api.huemn.com`, validate responses, use bounded deadlines and avoid automatic retries.

If you have SDK source access, reuse a client. TypeScript `prepareImage` and Python `prepare_image` choose inline data or a private upload reference. Images over 1 MiB require that reference flow. See [SDK examples](https://docs.huemn.com/quickstart.md#private-sdk-sources).

JPEG/PNG only: at most 5 MiB decoded per image, 8192 pixels per side and 20 million pixels. Inline base64 has no data-URL prefix. Do not submit arbitrary remote URLs. Compare, enrollment and search require one face per image.

Only successful image operations are charged. Failed requests, reads and deletion are free. Check the [pricing page](https://www.huemn.com/pricing/) and the public [pricing API](https://api.huemn.com/v1/pricing) for current operation rates and tiers. A checkout return does not prove settlement; use the dashboard's authoritative billing status.

## Face storage pricing

Planned price: \$0.01 per 1,000 stored face-months, prorated. Storage billing is not active; no storage credits are deducted yet. Catalog version: `2026-12-02-storage-preview-1`. See the [pricing page](https://www.huemn.com/pricing/) for request tiers.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.