> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/eventos/extractionfinish.md).

# extractionFinish

Facial extraction has completed successfully.

## Details

Emitted when facial pattern extraction is complete and the biometric template has been generated.

**Event:** `extractionFinish`

**Type:** `FacephiSelphiWidgetCustomEvent<SelphiExtractionFinishEvent>` | `CustomEvent<SelphiExtractionFinishEvent>`

### Syntax

```typescript
selphi.addEventListener('extractionFinish', onExtractionFinish);
```

### Received object

The useful payload is of type `SelphiExtractionFinishDetail` and is available in `event.detail.detail`:

* `eventType` (`string`): Type of event emitted.
* `cameraId` (`string`): ID of the camera used.
* `extractionData` (`object`): Extraction data.
  * `template` (`object`): Extracted Biometric Template.
    * `data` (`string` | `ArrayBuffer` | `Uint8Array`): Template data.
    * `templateFormat` (`string`): Format of the extracted template.
  * `templateRaw` (`object`): Template in raw format.
    * `data` (`string` | `ArrayBuffer` | `Uint8Array`): Raw template data.
    * `templateFormat` (`string`): Raw template format.
  * `bestImage` (`object`): Best image captured.
    * `data` (`string`): Highest-quality image.
    * `width` (`number`): Image width.
    * `height` (`number`): Image height.
    * `imageFormat` (`string`): Image format.
  * `bestImageTokenized` (`string`): Tokenized version of the best image.
  * `bestImageCropped` (`object`): Face crop of the best image.
    * `data` (`string`): Cropped face image.
    * `width` (`number`): Crop width.
    * `height` (`number`): Crop height.
    * `imageFormat` (`string`): Crop format.
  * `images` (`ImageData[]` | `[]`): Additional images from the process (optional).
  * `faceStabilizedStatus` (`number` | `undefined`): Stabilization status, if enabled.
  * `encryptedLivenessRaw` (`Blob` | `File` | `boolean` | `null`): Encrypted IAD payload (`false` if antispoof is disabled).
  * `encryptedLiveness` (`string` | `ArrayBuffer` | `boolean` | `null`): Tokenized version of liveness (`false` if antispoof is disabled).
  * `yaw` (`number`): Horizontal head rotation.
  * `pitch` (`number`): Vertical head rotation.
* `videoRecorded` (`Record<string, string>` | `null`): Recorded video of the process, if applicable.
* `livenessMoveResult` (`string`): Tokenized Active Liveness results (optional).
* `advancedTracking` (`Uint8Array` | `null`): Encoded advanced Tracking (optional).
* `coordinates` (`object` | `null`): User coordinates (`latitude`, `longitude` and `accuracy`). It is always present whenever [geolocation](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/sdk-provider/propiedades/geolocation.md) is not `DISABLED`, and is `null` when the location has not been obtained, either because permission was denied or because there has not yet been a response. The result of the request, including its reason, is reported in [geolocationFinish](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/sdk-provider/eventos/geolocationfinish.md). In TypeScript, `coordinates` is typed in `SelphiExtractionFinishDetail` from `@facephi/sdk-web-wc` and `@facephi/sdk-web-react`; the types in the `@facephi/selphi-web-component` package do not include it.

## Description

Contains the Biometric Template, images, and optional Liveness and Tracking data.

### Considerations

The useful payload is in `event.detail.detail` (see [event format](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/eventos.md#formato-de-los-eventos)).

Facephi recommends using `bestImage` and `templateRaw`, or `bestImageTokenized`, for the next steps in Onboarding or authentication processes.

If `antispoof` is active, send `encryptedLivenessRaw` to the Identity API IAD Endpoint (see [antispoof](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/propiedades/antispoof.md)).

***

## Example

```jsx
<facephi-selphi-widget
    onExtractionFinish={(event) => {
      const { extractionData, advancedTracking } = event.detail.detail;
      console.log('Template:', extractionData.templateRaw);
      console.log('Best image:', extractionData.bestImage.data);
    }}
/>
```

```typescript
import { type SelphiExtractionFinishDetail } from '@facephi/sdk-web-wc';

selphi.addEventListener('extractionFinish', (event) => {
  const detail: SelphiExtractionFinishDetail = event.detail.detail;
});
```
