> ## 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.

# Enrollment, search and consent

These interfaces operate inside the tenant and purpose attached to your API key. Send requests to `https://api.huemn.com`. For browser evaluation, use the [dashboard](https://platform.huemn.com/): **Collections** for enrollment/search/deletion and **Privacy & erasure** for consent withdrawal or scoped erasure. Dashboard operations use your session and selected organization, environment and purpose.

| Operation | Scope | Successful status |
| - | - | - |
| `POST /v1/collections/{collectionId}/faces` | `faces:write` | 202, indexing pending |
| `POST /v1/collections/{collectionId}/search` | `faces:search` | 200 |
| `DELETE /v1/collections/{collectionId}/faces/{faceId}` | `faces:delete` | 202, deletion pending |
| `POST /v1/consents/withdraw` | `faces:delete` | 202, withdrawn with erasure pending |

## Enroll an authorized face

Supply a non-nil UUID `faceId` that you retain for retries and an authorized image. `subjectRef` and `consentRef` are independently optional: omit them or pass null when unused. Supplied references are 1–256 characters, nonblank and without control characters. The consent reference points to authorization evidence you hold; the API does not independently verify legal consent. Use pseudonymous references instead of names, email addresses or other direct personal identifiers.

```typescript theme={null}
const enrolled = await client.enrollFace(collectionId, {
  faceId,
  image: { base64: authorizedImageBase64 },
  subjectRef,
  consentRef,
  expiresAt,
  metadata: { tenantId: "t_123", tenantUserId: "u_9" },
});
```

The image must contain exactly one face. A successful response is `{ requestId, face: { id, subjectRef, expiresAt, metadata }, indexingState: "pending" }`. Acceptance means the encrypted template was durably accepted for asynchronous indexing. It does not guarantee immediate search visibility.

`expiresAt` is optional. When omitted or null, a persistent collection keeps the face until deletion; a finite collection retention period computes expiry from enrollment time. An explicit RFC 3339 expiry must be in the future and within a finite collection retention period. Faces without expiry return null `expiresAt`; an omitted subject reference returns null `subjectRef`. The server normalizes expiry to UTC microsecond precision. To retry an uncertain submission, reuse the same `faceId`, exact image bytes and metadata. A changed request or a deleted face identity conflicts; do not generate a new ID automatically after a timeout. The SDK does not automatically retry.

## Face metadata

`metadata` is optional and works like Stripe metadata: a flat object of up to 50 keys, each 1–40 characters from `A-Z`, `a-z`, `0-9`, `_`, `.` and `-`, mapped to string values of at most 500 characters without control characters. `{}` is allowed. Nested objects, arrays, numbers, booleans and `null` are rejected with 400 `INVALID_REQUEST`. Use it for your own identifiers, such as your tenant and user IDs.

**Do not put sensitive personal data in metadata.** Names, email addresses, phone numbers, government identifiers and health or biometric details do not belong there.

Metadata is returned on the enrollment response, on every listed face and on every search match, always as an object (`{}` when none was given). It is not searchable or filterable and never changes which faces a search can return. It is part of the enrollment request: a retry with different metadata conflicts. It is deleted with the face by face deletion, consent withdrawal, subject erasure, retention expiry and collection deletion.

To separate your own customers, use one collection per end customer or tenant rather than metadata. Collections are free logical containers, like AWS Rekognition collections, and the server enforces their isolation.

When credit admission is enabled, enrollment accepts the optional admission `Idempotency-Key` described in [quickstart](https://docs.huemn.com/quickstart.md). Its durable effect also binds the authenticated tenant, purpose, collection and `faceId`: changing or omitting the header does not make an identical face enrollment a new charged execution. A committed identical face returns its ordinary current metadata after authorization and identity checks. A failed or unknown admitted effect returns safe accounting status and cannot rerun with the same `faceId`; a deliberate new attempt requires a new face ID. Never generate that new ID automatically after an uncertain response.

## Search within a collection

```typescript theme={null}
const result = await client.searchFaces(
  collectionId,
  { base64: authorizedQueryImageBase64 },
  operatingPoint,
  { limit: 20 },
);
```

The request requires one query face and a configured operating point compatible with the collection's model. `limit` is 1–100, default 20. The response contains `requestId`, `modelVersion`, `operatingPointVersion`, `threshold` and `matches`. Each match contains `faceId`, `subjectRef`, `metadata` and `score`; raw embeddings are not returned.

Search accepts the same optional admission `Idempotency-Key`. Without it, each search is a fresh attempt. An identical admitted retry returns 409 accounting status, not cached matches or a new inference run. See [admission identity and credits](https://docs.huemn.com/quickstart.md) for charging and error codes.

Search is approximate. Authoritative lifecycle filtering removes expired, deleted and withdrawn candidates. An empty result or fewer matches than requested is valid and must not be converted to a forced identity decision. An operating-point version identifies calibration configuration, not independently demonstrated accuracy. Similarity is not liveness or identity proof.

## Delete one face

```typescript theme={null}
const deletion = await client.deleteFace(collectionId, faceId);
```

A successful response is `{ requestId, state: "deletion_pending" }`. Authoritative visibility is suppressed and index erasure is scheduled. Repeated deletion is accepted. The response does not contain an operation ID and does not prove that physical erasure is complete. Obtain completion evidence through the operator's erasure/reconciliation process; do not use the collection-operation endpoint with a face ID.

## Withdraw a consent reference

```typescript theme={null}
const withdrawal = await client.withdrawConsent(consentRef);
```

Withdrawal applies across all collections in the authenticated tenant and purpose that use this reference. It immediately suppresses search visibility and blocks new enrollment with that reference. A successful response is `{ requestId, state: "withdrawn", erasureState: "pending" }`. Withdrawal is repeatable; physical erasure remains asynchronous. There is no operation ID or client-side endpoint that establishes erasure completion in this response.

In the dashboard, withdrawal has a separate explicit confirmation because its scope is broader than one collection. The checkbox records operator intent only; it is not a substitute for lawful processing, data-subject consent or retained authorization evidence.

## List enrolled face metadata

`GET /v1/collections/{collectionId}/faces` requires `collections:read`. Supply optional `after` UUID and `limit` (1–100, default 20). The response is `{ requestId, records: [{ id, subjectRef, expiresAt, metadata }], nextCursor }`. Pass a non-null cursor as `after` for the next page. Pagination is live, not a snapshot; expired, withdrawn or erased records are excluded. No image, consent reference, embedding or template blob is returned.

```typescript theme={null}
const page = await client.listFaces(collectionId, { limit: 20 });
```

## Request subject or consent erasure

`POST /v1/erasure-requests` accepts exactly one selector: `{ subjectId }` matching enrollment `subjectRef`, or `{ consentReference }` matching `consentRef`. Send a nonnil UUID in `Idempotency-Key`. Subject requests require `subjects:erase`; consent requests require `faces:delete`. Both apply across collections within the authenticated tenant and purpose.

```typescript theme={null}
const accepted = await client.requestErasure({ subjectId }, crypto.randomUUID());
const progress = await client.getOperation(accepted.operation.id);
```

Preserve the key and selector before sending; an explicit retry must reuse both. A changed target conflicts. The 202 response contains `{ requestId, operation: { id, state, createdAt } }`; pending is not proof of completed purge. Subject erasure captures the current enrollment generation. Retrying it does not erase later re-enrollments, which still require valid consent. Consent erasure permanently withdraws that reference. Acceptance requires the external erasure journal and credential revalidation; a timeout can leave the outcome unknown.

The [dashboard](https://platform.huemn.com/) includes face metadata listing inside a collection and deletion by subject ID or consent reference in **Data deletion**, which also checks a deletion by ID. Its same-origin session API preserves the required erasure idempotency identity. These implemented controls support operator-controlled evaluation; their existence does not establish hosted availability. Hosted release remains subject to the release gates.

## Zero-balance privacy access

Face and collection deletion, consent withdrawal, scoped subject/consent erasure and operation status do not require inference credits. A zero credit balance does not remove these privacy paths. Authentication, scopes, purpose boundaries, consent rules and dependencies still apply; this is not a promise that an unavailable dependency can complete erasure. The required nonnil UUID identity on `/v1/erasure-requests` is unchanged and distinct from the optional inference admission header.

## Failure handling and privacy

Expect 422 for images without exactly one face, 409 for model/enrollment conflicts, 403 for insufficient scope or withdrawn consent, and 404 for inaccessible scoped resources. Respect 429 capacity/rate limits and bounded deadlines. A 503 or transport timeout can leave enrollment's outcome unknown: retain the exact request identity before retrying.

Keep request identifiers for diagnostics. Do not log credentials, images, embeddings, subject/consent references or biometric results. Use **Cancel pending request** to stop waiting in the dashboard; navigating away clears the current view and **Clear result** removes a displayed result. It does not undo an operation the server already accepted. Retain enrollment IDs and exact retry inputs in your authorized system before clearing the page. Raw image buffers are transient in the page; JavaScript memory management does not provide cryptographic zeroization guarantees.

## 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.