---
title: "Cadastre e autentique seu rosto"
product: "Lacuna Bio"
slug: "enroll-and-authenticate-your-face"
language: "pt"
canonical_url: "https://try.lacunasoftware.com/pt/lacuna-bio/enroll-and-authenticate-your-face"
docs_url: "https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/bio-sessions"
samples: []
samples_repo: "https://github.com/LacunaSoftware/RestBioSamples"
trace_recorded: "2026-10-12"
last_generated: "2026-10-12T15:24:28Z"
---

# Cadastre e autentique seu rosto

Cadastre seu rosto com a sua câmera no widget de captura da Lacuna, direto no navegador, e depois autentique-o um a um: o Rest PKI Core, o serviço em nuvem da Lacuna, faz os dois no servidor.

Live demo: [https://try.lacunasoftware.com/pt/lacuna-bio/enroll-and-authenticate-your-face](https://try.lacunasoftware.com/pt/lacuna-bio/enroll-and-authenticate-your-face). It runs against Lacuna's real products; this page describes it for AI coding agents.

## Call sequence

Recorded on 2026-10-12 against the real products with Lacuna's public test certificates and data. Keys, tokens, sessions, ids, file contents and personal data are masked.

### 1. Rest PKI Core starts a Face enrollment session for the Demo's random Subject identifier, with the page's origin as trusted origin and Datavalid off; the browser gets the session URL alone.

On the server: `IRestBioService.StartEnrollmentSessionAsync`

`POST https://core.pki.rest/api/bio/sessions/enrollment` → 200

Request:

```json
{
  "SubjectIdentifier": "***",
  "CaptureIdentificationDocument": false,
  "DangerousOverrideIfAlreadyEnrolled": false,
  "VerifyFaceIdentityExternally": false,
  "TrustedOrigin": "https://try.lacunasoftware.com/",
  "PlatformPreference": 2
}
```

Response:

```json
{
  "sessionType": "Enrollment",
  "sessionId": "***",
  "sessionUrl": "***"
}
```

### 2. Lacuna's capture widget opens the session URL over the page and gives back a ticket to complete the enrollment with; it needs a person, so the rest, authentication included, is not recorded.

In the browser: `widget.performBioSession(sessionUrl)`

## Patterns to copy

- Enrollment and authentication are two separate sessions, each start (server), capture (browser widget), complete (server), tied together only by the Subject identifier: trim it and keep it within 200 characters.
- On an enrollment, always set `VerifyFaceIdentityExternally` explicitly: left unset, the subscription's default decides whether Datavalid runs.
- `RestPkiExceptionV2` with `BioSubjectAlreadyEnrolled` (enroll) or `BioSubjectNotFound` (authenticate) is an expected answer with no session started: send the user to the other step. The Demo never sends the override that replaces an enrollment.
- The identifier names a person: never log it, and log only Rest PKI Core's error code, never the client's exception message. Treat the session URL and the widget's ticket as credentials too.

## Links

- Live demo: https://try.lacunasoftware.com/en/lacuna-bio/enroll-and-authenticate-your-face (Portuguese: https://try.lacunasoftware.com/pt/lacuna-bio/enroll-and-authenticate-your-face)
- Docs: https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/bio-sessions
- Samples: https://github.com/LacunaSoftware/RestBioSamples
- Every demo: https://try.lacunasoftware.com/llms.txt and https://try.lacunasoftware.com/demos.json
