---
title: Passport Extraction
slug: api-marketplace/passport-extraction
createdAt: 2023-11-02T11:46:52.780Z
---

## Introduction

The Passport Extraction API is designed to extract data from passport images. You can input the URL of the passport image, and the API will return structured data extracted from the image, such as the passport holder's name, date of birth, passport number, address, and other pertinent details.



***

## API details

### Endpoint

:::CodeblockTabs
Production Environment

```jsx
POST https://api.signzy.app/api/v3/passport/extractions
```
:::

:::CodeblockTabs
UAT/Testing environment

```jsx
POST https://api-preproduction.signzy.app/api/v3/passport/extractions
```
:::

***

### Request headers&#x20;

| Name          | Value            | Required  | Description                                                                                                |
| ------------- | ---------------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| Content-Type  | application/json | Mandatory | The type of content that the request body contains.                                                        |
| Authorization | XXXXXXXXXXXXXXX  | Mandatory | An authentication token to authorize the request. Reach out to the Signzy support team to get one created. |

***

### Request body parameters

| **Parameter** | **Data type**    | **Description**                                           | **Required** |
| ------------- | ---------------- | --------------------------------------------------------- | ------------ |
| files         | Array of Strings | An array containing the URL of the files to be extracted. | Mandatory    |

```json
{
    "files": [
        "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
        "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
    ]
}
```

***

### Code samples

:::CodeblockTabs
```curl
curl --location 'https://api-preproduction.signzy.app/api/v3/passport/extractions' \
--header 'Content-Type: application/json' \
--header 'Authorization: <Your Access token>' \
--data '{
    "files": [
        "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
        "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
    ]
}'
```

```nodejs
const axios = require('axios');
let data = JSON.stringify({
  "files": [
    "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
    "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api-preproduction.signzy.app/api/v3/passport/extractions',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': '<Your Access token>'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

```python
import http.client
import json

conn = http.client.HTTPSConnection("api-preproduction.signzy.app")
payload = json.dumps({
  "files": [
    "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
    "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': '<Your Access token>'
}
conn.request("POST", "/api/v3/passport/extractions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api-preproduction.signzy.app/api/v3/passport/extractions"
  method := "POST"

  payload := strings.NewReader(`{
    "files": [
        "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
        "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
    ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "<Your Access token>")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```
:::

***

### Response body parameters

| **Parameter**                           | **Data Type**    | **Description**                                                                                                          |
| --------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
| files                                   | Array of strings | URL of files being extracted.                                                                                            |
| id                                      | Integer          | Unique ID for the request.                                                                                               |
| result                                  | Object           | Contains the result of extraction.                                                                                       |
| result.parentsGuardianName              | String           | Name of the parent or guardian.                                                                                          |
| result.issueDate                        | String           | Date of issue in DD/MM/YYYY format.                                                                                      |
| result.expiryDate                       | String           | Expiry date in DD/MM/YYYY format.                                                                                        |
| result.birthDate                        | String           | Birth date in DD/MM/YYYY format.                                                                                         |
| result.name                             | String           | Full name of the individual.                                                                                             |
| result.country                          | Array of strings | Country of the individual.                                                                                               |
| result.nationality                      | String           | Nationality of the individual.                                                                                           |
| result.sex                              | String           | Gender of the individual.<br />The possible response value could be: **F** for Female and<br />**M&#x20;**&#x66;or Male. |
| result.address                          | String           | Full address of the individual.                                                                                          |
| result.pincode                          | String           | Pincode.                                                                                                                 |
| result.passportNumber                   | String           | Passport number.                                                                                                         |
| result.fileNumber                       | String           | File number associated with the document.                                                                                |
| result.placeOfBirth                     | String           | Place of birth.                                                                                                          |
| result.placeOfIssue                     | String           | Place where the document was issued.                                                                                     |
| result.splitAddress                     | Object           | Contains the address in split format.                                                                                    |
| result.splitAddress.district            | Array of strings | District.                                                                                                                |
| result.splitAddress.state               | Array of arrays  | State.                                                                                                                   |
| result.splitAddress.city                | Array of strings | City.                                                                                                                    |
| result.splitAddress.pincode             | String           | Pincode.                                                                                                                 |
| result.splitAddress.country             | Array of strings | Country.                                                                                                                 |
| result.splitAddress.addressLine         | String           | Address line.                                                                                                            |
| result.summary                          | Object           | Summary of extracted details.                                                                                            |
| result.summary.number                   | String           | Passport number.                                                                                                         |
| result.summary.name                     | String           | Full name.                                                                                                               |
| result.summary.dob                      | String           | Date of birth in DD/MM/YYYY format.                                                                                      |
| result.summary.address                  | String           | Full address.                                                                                                            |
| result.summary.splitAddress             | Object           | Contains the address in split format.                                                                                    |
| result.summary.splitAddress.district    | Array of Strings | District.                                                                                                                |
| result.summary.splitAddress.state       | Array of Strings | State.                                                                                                                   |
| result.summary.splitAddress.city        | Array of Strings | City.                                                                                                                    |
| result.summary.splitAddress.pincode     | String           | Pincode.                                                                                                                 |
| result.summary.splitAddress.country     | Array of Strings | Country.                                                                                                                 |
| result.summary.splitAddress.addressLine | String           | Address line.                                                                                                            |
| result.summary.gender                   | String           | Gender of the individual.<br />Possible response value could be:<br />F- Female<br />M-Male.                             |
| result.summary.guardianName             | String           | Guardian's name.                                                                                                         |
| result.summary.issueDate                | String           | Issue date in DD/MM/YYYY format.                                                                                         |
| result.summary.expiryDate               | String           | Expiry date in DD/MM/YYYY format.                                                                                        |

:::CodeblockTabs
200

```json
{
    "files": [
        "https://preproduction-persist.signzy.tech/api/files/39674811/download/XXXXXXXX.jpg",
        "https://preproduction-persist.signzy.tech/api/files/39675789/download/XXXXXXXX.jpg"
    ],
    "id": 3168,
    "result": {
        "parentsGuardianName": "<Guardian name>",
        "issueDate": "DD/MM/YYYY",
        "expiryDate": "DD/MM/YYYY",
        "birthDate": "DD/MM/YYYY",
        "name": "<Passport holder name>",
        "country": [
            "IN",
            "IND",
            "India"
        ],
        "nationality": "INDIAN",
        "sex": "F",
        "address": "GUJARAT 382640 AHDA35124306",
        "pincode": "382640",
        "passportNumber": "X0000000",
        "fileNumber": "XXXX00000000",
        "placeOfBirth": "PANSAR GANDHINAGAR GUJARAT",
        "placeOfIssue": "AHMEDABAD",
        "splitAddress": {
            "district": [
                "GANDHI NAGAR"
            ],
            "state": [
                [
                    "GUJARAT",
                    "GJ"
                ]
            ],
            "city": [
                "JALUND"
            ],
            "pincode": "382640",
            "country": [
                "IN",
                "IND",
                "INDIA"
            ],
            "addressLine": "GUJARAT AHDA"
        },
        "summary": {
            "number": "X0000000",
            "name": "<Passport holder name>",
            "dob": "DD/MM/YYYY",
            "address": "Address",
            "splitAddress": {
                "district": [
                    "GANDHI NAGAR"
                ],
                "state": [
                    [
                        "GUJARAT",
                        "GJ"
                    ]
                ],
                "city": [
                    "JALUND"
                ],
                "pincode": "382640",
                "country": [
                    "IN",
                    "IND",
                    "INDIA"
                ],
                "addressLine": "GUJARAT AHDA"
            },
            "gender": "F",
            "guardianName": "<Guardian name>",
            "issueDate": "DD/MM/YYYY",
            "expiryDate": "DD/MM/YYYY"
        }
    }
}
```

400

```json
// Invalid image URL
{
    "error": {
        "statusCode": 400,
        "name": "Error",
        "message": "Only image(s)/pdf(s) are allowed, one of the urls does not respond like an image"
    }
}

// required param missing
{
    "error": {
        "statusCode": 400,
        "status": "Bad Request",
        "message": "\"requestBody.files\" is required",
        "id": "dbc02814-b100-43ca-a236-1a5cf4faacb2"
    }
}
```

401

```json
{
    "message": "Invalid authentication credentials"
}
```

409

```json
{
    "error": {
        "reason": "Error From Upstream",
        "status": 409,
        "message": "Upstream Down",
        "type": "Conflict",
        "statusCode": 409,
        "name": "error"
    }
}
```
:::

***

### Document related constraints

:::hint{type="info"}
The size of the document should not exceed **10 MB**.

Both the front and back sides of the Passport document are mandatory to extract all data.

For best results, ensure the image you use fits tightly in the camera view and horizontally aligned.

Supported document types:

- Image - JPEG, JPG, PNG and TIFF/TIF.
- Single page PDF - In the case of multipage PDF input the API will only consider the first page for extraction
:::

***

**Contact Us for Any Assistance**

If you have any questions or need assistance, please reach out to our customer support team. You can contact us via email at <font color="#2166ae">**help\@signzy.com**</font>. We strive to provide prompt and reliable assistance, ensuring your queries are addressed effectively.

We value your feedback and are committed to making your experience smooth and enjoyable. Our team is dedicated to assisting you with any needs you may have. Thank you for choosing our services. We look forward to helping you!
