> 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

## Details

It is emitted when the facial pattern extraction is completed and the Biometric Template is generated.

**Event:** `extractionFinish`

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

### Syntax

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

### Received object

The useful payload is of type `SelphiExtractionFinishDetail` and is 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 captured image.
    * `data` (`string`): Best quality image.
    * `width` (`number`): Image width.
    * `height` (`number`): Image height.
    * `imageFormat` (`string`): Image format.
  * `bestImageTokenized` (`string`): Tokenized version of the best image.
  * `bestImageCropped` (`object`): Facial 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).

## Description

Contains the biometric template, images, and optional Liveness and Tracking data.

### Considerations

The useful payload is in `event.detail.detail` (see [event format](/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 following steps in Onboarding or authentication processes.

If `antispoof` is active, it sends `encryptedLivenessRaw` to the Endpoint IAD of Identity API (see [antispoof](/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;
});
```
