---
title: PAN face extraction V2
slug: api-marketplace/pan-face-extraction-v2
description: Learn how to extract faces from PAN card images using the PAN Face Extraction API. This API takes a JPEG image of a PAN card as input and returns a cropped PNG image of the detected face. Discover how to use the API, view examples, and handle error messag
createdAt: 2023-04-19T11:38:58.000Z
---

### Introduction

The PAN Face Extraction API is a service provided by Signzy Technologies Private Limited that allows developers to extract a face from a PAN card image. This API takes as input a PAN card image in JPEG format, and returns a cropped image of the face detected in the PAN card. The output image is in PNG format and contains only the face region, which can be used for further processing or analysis. The API is designed to work with horizontally-aligned images only, and it returns an error if the input image is not horizontally-aligned. The API provides a simple and efficient way for developers to extract faces from PAN card images and use them in their applications. In this documentation, we will explain how to use the PAN Face Extraction API, provide examples of requests and responses, and list the possible error messages that the API can return.

# API description

### API Endpoint's

### Identity Object

:::CodeblockTabs
UAT Endpoint

```text
POST https://preproduction.signzy.tech/api/v2/patrons/<patron-id>/identities
```
:::

:::CodeblockTabs
Production Endpoint

```text
POST https://signzy.tech/api/v2/patrons/<patron-id>/identities
```
:::

### Headers

| Key           | Value                                                |
| ------------- | ---------------------------------------------------- |
| Authorization | access token (returned as id field of login request) |
| Content-type  | application/json                                     |

### Request Data

```json
{
    "type": "individualPan",
    "email": "admin@signzy.com",
    "callbackUrl": "https://your-domain.com/your-callback-system",
    "images": [
        "<urls-to-uploaded-files>"
    ]
}
```

| PARAMETERS  | DESCRIPTION                                                                                                                                                                             | TYPE   | VALUE (COMPULSORY OR OPTIONAL) |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------------------ |
| type        | **Supported type parameter for creation of Identity objects**<br />- individualPan<br />- businessPan<br />- aadhaar<br />- passport<br />- drivingLicence<br />- cheque<br />- voterid | String | COMPULSORY                     |
| email       | E-mail can't be empty                                                                                                                                                                   | String | COMPULSORY                     |
| callbackUrl | callbackUrl is where the data is posted on each activity performed on this Identity object.                                                                                             | String | COMPULSORY                     |
| images      | urls's to be extracted                                                                                                                                                                  | List   | COMPULSORY                     |

### Response

```json
{
              "type": "individualPan",
              "email": "admin@signzy.com",
              "callbackUrl": "https://your-domain.com/your-callback-system",
              "images": [
                "<urls-to-uploaded-files>"
              ],
              "autoRecognition": [],
              "verification": [],
              "forgeryCheck": [],
              "accessToken": "..access-token-for-the-snoop-request..",
              "id": "..itemId-for-the-snoop-request....",
              "patronId": "..your-id-into-signzy-system-(userId-returned-from-the-login-call).."
            }

```

***

### Snoops

:::CodeblockTabs
UAT Endpoint

```text
POST https://preproduction.signzy.tech/api/v2/snoops
```
:::

:::CodeblockTabs
Production Endpoint

```text
POST https://signzy.tech/api/v2/snoops
```
:::

### Headers

| Key           | Value                                                |
| ------------- | ---------------------------------------------------- |
| Authorization | access token (returned as id field of login request) |
| Content-type  | application/json                                     |

### Request Data

```json
{
    "service": "Identity",
    "itemId": "<..itemId-from-the-Identity-Object-request....>",
    "task": "faceExtraction",
    "accessToken": "<..access-token-from-the-Identity-Object-request..>",
    "essentials": {
        "url": "..url-of-image-from-where-face-needs-to-be-extracted"
    }
}
```

## Details of the request properties

| Parameter      | Type   | Required | Description                                                                                      |
| -------------- | ------ | -------- | ------------------------------------------------------------------------------------------------ |
| service        | string | Yes      | The name of the service being used. For this API, the value should be "Identity".                |
| itemId         | string | Yes      | The unique ID of the item being processed.                                                       |
| accessToken    | string | Yes      | The access token for the API.                                                                    |
| task           | string | Yes      | The name of the task being performed. For this API, the value should be "faceExtraction".        |
| essentials.url | string | Yes      | The URL of the image to be processed. The image should be a horizontally-aligned PAN card image. |

### Response

```json
{
    "service": "Identity",
    "itemId": "<Identity-object-id>",
    "task": "autoRecognition",
    "essentials": {},
    "accessToken": "<Identity-access-token>",
    "id": "ID-of-the-snoop-request",
    "response": {
        "files": [
            "<url-to-the-front-side>"
        ],
        "type": "individualPan | businessPan",
        "id": ...integer...,
        "instance": {},
        "result": {
          "cropped": "...extracted face image url..."
        }
    }
}
```

The response object contains the following sub-properties:

## Details of the response properties

| Property | Example Value              | Description                          |
| -------- | -------------------------- | ------------------------------------ |
| cropped  | "\<url of face extracted>" | The URL of the extracted face image. |

## Error Codes

| Error Code | Description                                                                                       |
| ---------- | ------------------------------------------------------------------------------------------------- |
| 400        | Could not process this request, please recheck parameters and try another one.                    |
| 401        | Unauthorized access. Please ensure that you are using valid credentials.                          |
| 404        | The requested resource was not found. Please ensure that the endpoint and parameters are correct. |
| 500        | An unexpected error occurred on the server. Please try again later.                               |

## Troubleshooting

| Issue                        | Description                                                         | Troubleshooting                                                                                                                                                       |
| ---------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Incorrect image format       | The API only supports PNG, JPG, and JPEG image formats.             | Ensure that the image you are providing is in one of the supported formats.                                                                                           |
| Image orientation            | The image should be horizontally aligned.                           | Rotate the image if needed to ensure it is horizontally aligned.                                                                                                      |
| Invalid access token         | The access token provided in the request is invalid or has expired. | Generate a new access token and use it in the request.                                                                                                                |
| Missing or invalid parameter | One or more required parameters are missing or have invalid values. | Check that all required parameters are included in the request and have valid values. Refer to the API documentation for more information on the required parameters. |
| Server error                 | An unexpected error occurred on the server.                         | Wait for some time and try the request again later. If the issue persists, contact the API provider for assistance.                                                   |

