> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.staple.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.staple.ai/_mcp/server.

# Extract Passport

POST https://api.staple.io/v1/documents/extract/passport
Content-Type: multipart/form-data

Extract the structured data from a document using the Passport model in Staple. The document would NOT be left in the queue specified for any further manipulation.

Reference: https://docs.staple.ai/api-reference/v1/documents/extract-passport

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/documents/extract/passport:
    post:
      operationId: extractPassport
      summary: Extract Passport
      description: >-
        Extract the structured data from a document using the Passport model in
        Staple. The document would NOT be left in the queue specified for any
        further manipulation.
      tags:
        - documents
      parameters:
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Documents_extractPassport_Response_200'
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: string
                  format: binary
                  description: File to upload
              required:
                - files
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    Documents_extractPassport_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Documents_extractPassport_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples



**Request**

```json
{
  "files": "<file: string>"
}
```

**Response**

```json
{
  "Code": {
    "UICategory": "Basic Information",
    "UIName": "Code",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          896,
          2142,
          1493,
          2222,
          1194,
          2182,
          "<< <<<<<<0",
          "<< <<<<<<0"
        ],
        "match": "<< <<<<<<0",
        "matchmulti": null,
        "page": 0,
        "value": [
          896,
          2142,
          1493,
          2222,
          1194,
          2182,
          "<< <<<<<<0",
          "<< <<<<<<0"
        ]
      }
    ]
  },
  "CountryCode": {
    "UICategory": "Basic Information",
    "UIName": "Country Code",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          1039,
          1713,
          1179,
          1729,
          1109,
          1721,
          "Code",
          "Κωδικός /Kodu/Code"
        ],
        "match": "CYP",
        "matchmulti": null,
        "page": 0,
        "value": [
          1040,
          1731,
          1076,
          1749,
          1058,
          1740,
          "CYP",
          "CYP"
        ]
      }
    ]
  },
  "DOB": {
    "UICategory": "Basic Information",
    "UIName": "DOB",
    "UIType": "Date",
    "matches": [
      {
        "keyword": [
          1340,
          1829,
          1439,
          1845,
          1389.5,
          1837,
          "Date of Birth ( 7 )",
          "Date of Birth ( 7 )"
        ],
        "match": "20/03/1991",
        "matchmulti": null,
        "page": 0,
        "value": [
          1340,
          1844,
          1427,
          1868,
          1383.5,
          1856,
          "20/03/1991",
          "20/03/1991"
        ]
      }
    ]
  },
  "DocSize": [
    [
      2339,
      1654
    ]
  ],
  "ExpiryDate": {
    "UICategory": "Basic Information",
    "UIName": "Expiry Date",
    "UIType": "Date",
    "matches": [
      {
        "keyword": [
          1339,
          1812,
          1409,
          1830,
          1374,
          1821,
          "Date Gen.",
          "Ημερ . Γένν ."
        ],
        "match": "20/03/1991",
        "matchmulti": null,
        "page": 0,
        "value": [
          1340,
          1844,
          1427,
          1868,
          1383.5,
          1856,
          "20/03/1991",
          "20/03/1991"
        ]
      }
    ]
  },
  "FirstName": {
    "UICategory": "Basic Information",
    "UIName": "First Name",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          891,
          1826,
          1094,
          1843,
          992.5,
          1834.5,
          "Names / Adi / Given Names (2)",
          "Ονόματα /Adi/Given Names ( 2 )"
        ],
        "match": "ΑΔΩΝΙΣ",
        "matchmulti": null,
        "page": 0,
        "value": [
          890,
          1845,
          959,
          1864,
          924.5,
          1854.5,
          "ΑΔΩΝΙΣ",
          "ΑΔΩΝΙΣ"
        ]
      }
    ]
  },
  "Gender": {
    "UICategory": "Basic Information",
    "UIName": "Gender",
    "UIType": "Text",
    "matches": [
      {
        "keyword": null,
        "match": null,
        "page": null,
        "value": null
      }
    ]
  },
  "IssueDate": {
    "UICategory": "Basic Information",
    "UIName": "Issue Date",
    "UIType": "Date",
    "matches": [
      {
        "keyword": [
          1338,
          1894,
          1421,
          1912,
          1379.5,
          1903,
          "Issued on ( 6 )",
          "Issued on ( 6 )"
        ],
        "match": "24/04/2013",
        "matchmulti": null,
        "page": 0,
        "value": [
          1339,
          1915,
          1430,
          1934,
          1384.5,
          1924.5,
          "24/04/2013",
          "24/04/2013"
        ]
      }
    ]
  },
  "LastName": {
    "UICategory": "Basic Information",
    "UIName": "Last Name",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          891,
          1759,
          1091,
          1778,
          991,
          1768.5,
          "Endvulo / Surname / Surname (1)",
          "Endvulo/Soyadı /Surname ( 1 )"
        ],
        "match": "Gender ",
        "matchmulti": null,
        "page": 0,
        "value": [
          1340,
          1760,
          1493,
          1777,
          1416.5,
          1768.5,
          "Gender / Sex (5)",
          "Φύλο /Cinsiyeti/Sex ( 5 )"
        ]
      }
    ]
  },
  "Nationality": {
    "UICategory": "Basic Information",
    "UIName": "Nationality",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          890,
          1893,
          1112,
          1911,
          1001,
          1902,
          "Citizenship / Tabliyet / Nationality (3)",
          "Ιθαγένεια /Tabliyet/Nationality ( 3 )"
        ],
        "match": "CYPRIOT",
        "matchmulti": null,
        "page": 0,
        "value": [
          889,
          1936,
          971,
          1954,
          930,
          1945,
          "CYPRIOT",
          "CYPRIOT"
        ]
      }
    ]
  },
  "PassportNumber": {
    "UICategory": "Basic Information",
    "UIName": "Passport Number",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          1229,
          1714,
          1514,
          1732,
          1371.5,
          1723,
          "No . Passport No / Passport No.",
          "Αρ . Διαβατηρίου /Pasaport No/Passport No."
        ],
        "match": "K0012129",
        "matchmulti": null,
        "page": 0,
        "value": [
          1230,
          1731,
          1324,
          1751,
          1277,
          1741,
          "K00121296",
          "K00121296"
        ]
      }
    ]
  },
  "PlaceOfBirth": {
    "UICategory": "Basic Information",
    "UIName": "Place Of Birth",
    "UIType": "Text",
    "matches": [
      {
        "keyword": [
          889,
          1959,
          1188,
          1979,
          1038.5,
          1969,
          "Τόπος γέννησης / Dodum veri / Place of Birth (4)",
          "Τόπος γέννησης /Dodum veri/Place of Birth ( 4 )"
        ],
        "match": "LIMASSOL",
        "matchmulti": null,
        "page": 0,
        "value": [
          886,
          1978,
          977,
          1998,
          931.5,
          1988,
          "LIMASSOL",
          "ΛΕΜΕΣΟΣ"
        ]
      }
    ]
  },
  "SmallBoxes": [
    {
      "box": [
        628,
        1514,
        652,
        1483,
        640,
        1498.5,
        "For",
        "Για"
      ],
      "page": 0
    },
    {
      "box": [
        628,
        1476,
        653,
        1402,
        640.5,
        1439,
        "official",
        "επίσημη"
      ],
      "page": 0
    },
    {
      "box": [
        628,
        1396,
        654,
        1338,
        641,
        1367,
        "use",
        "χρήση"
      ],
      "page": 0
    },
    {
      "box": [
        650,
        1514,
        680,
        1447,
        665,
        1480.5,
        "Formal",
        "Resmi"
      ],
      "page": 0
    },
    {
      "box": [
        651,
        1447,
        681,
        1377,
        666,
        1412,
        "usage",
        "kullanış"
      ],
      "page": 0
    },
    {
      "box": [
        653,
        1371,
        682,
        1339,
        667.5,
        1355,
        "for",
        "için"
      ],
      "page": 0
    },
    {
      "box": [
        684,
        1495,
        705,
        1463,
        694.5,
        1479,
        "For",
        "For"
      ],
      "page": 0
    },
    {
      "box": [
        684,
        1457,
        706,
        1394,
        695,
        1425.5,
        "official",
        "official"
      ],
      "page": 0
    },
    {
      "box": [
        685,
        1390,
        707,
        1358,
        696,
        1374,
        "use",
        "use"
      ],
      "page": 0
    },
    {
      "box": [
        718,
        1645,
        1504,
        1667,
        1111,
        1656,
        "REPUBLIC OF CYPRUS KIBRIS CUMHURIYETI REPUBLIC OF CYPRUS",
        "ΚΥΠΡΙΑΚΗ ΔΗΜΟΚΡΑΤΙΑ KIBRIS CUMHURIYETI REPUBLIC OF CYPRUS"
      ],
      "page": 0
    },
    {
      "box": [
        735,
        1676,
        973,
        1693,
        854,
        1684.5,
        "AIABATHPIO / PASSPORT / PASSPORT",
        "AIABATHPIO/PASAPORT/PASSPORT"
      ],
      "page": 0
    },
    {
      "box": [
        892,
        1713,
        1000,
        1730,
        946,
        1721.5,
        "Type",
        "Είδος /Tip/Type"
      ],
      "page": 0
    },
    {
      "box": [
        1039,
        1713,
        1179,
        1729,
        1109,
        1721,
        "Code",
        "Κωδικός /Kodu/Code"
      ],
      "page": 0
    },
    {
      "box": [
        892,
        1731,
        901,
        1749,
        896.5,
        1740,
        "P",
        "P"
      ],
      "page": 0
    },
    {
      "box": [
        1040,
        1731,
        1076,
        1749,
        1058,
        1740,
        "CYP",
        "CYP"
      ],
      "page": 0
    },
    {
      "box": [
        891,
        1759,
        1091,
        1778,
        991,
        1768.5,
        "Endvulo / Surname / Surname (1)",
        "Endvulo/Soyadı /Surname ( 1 )"
      ],
      "page": 0
    },
    {
      "box": [
        892,
        1777,
        995,
        1796,
        943.5,
        1786.5,
        "PANAGIDIS",
        "ΠΑΝΑΓΙΔΗΣ"
      ],
      "page": 0
    },
    {
      "box": [
        892,
        1802,
        991,
        1821,
        941.5,
        1811.5,
        "PANAGIDIS",
        "PANAGIDIS"
      ],
      "page": 0
    },
    {
      "box": [
        891,
        1826,
        1094,
        1843,
        992.5,
        1834.5,
        "Names / Adi / Given Names (2)",
        "Ονόματα /Adi/Given Names ( 2 )"
      ],
      "page": 0
    },
    {
      "box": [
        890,
        1845,
        959,
        1864,
        924.5,
        1854.5,
        "ΑΔΩΝΙΣ",
        "ΑΔΩΝΙΣ"
      ],
      "page": 0
    },
    {
      "box": [
        890,
        1868,
        959,
        1885,
        924.5,
        1876.5,
        "ADONIS",
        "ADONIS"
      ],
      "page": 0
    },
    {
      "box": [
        890,
        1893,
        1112,
        1911,
        1001,
        1902,
        "Citizenship / Tabliyet / Nationality (3)",
        "Ιθαγένεια /Tabliyet/Nationality ( 3 )"
      ],
      "page": 0
    },
    {
      "box": [
        891,
        1912,
        984,
        1931,
        937.5,
        1921.5,
        "CYPRUS",
        "ΚΥΠΡΙΑΚΗ"
      ],
      "page": 0
    },
    {
      "box": [
        889,
        1936,
        971,
        1954,
        930,
        1945,
        "CYPRIOT",
        "CYPRIOT"
      ],
      "page": 0
    },
    {
      "box": [
        889,
        1959,
        1188,
        1979,
        1038.5,
        1969,
        "Τόπος γέννησης / Dodum veri / Place of Birth (4)",
        "Τόπος γέννησης /Dodum veri/Place of Birth ( 4 )"
      ],
      "page": 0
    },
    {
      "box": [
        886,
        1978,
        977,
        1998,
        931.5,
        1988,
        "LIMASSOL",
        "ΛΕΜΕΣΟΣ"
      ],
      "page": 0
    },
    {
      "box": [
        891,
        2003,
        978,
        2022,
        934.5,
        2012.5,
        "LEMESOS",
        "LEMESOS"
      ],
      "page": 0
    },
    {
      "box": [
        890,
        2025,
        1099,
        2046,
        994.5,
        2035.5,
        "Signature (10)",
        "Υπογραφή /Imza/Signature ( 10 )"
      ],
      "page": 0
    },
    {
      "box": [
        1229,
        1714,
        1514,
        1732,
        1371.5,
        1723,
        "No . Passport No / Passport No.",
        "Αρ . Διαβατηρίου /Pasaport No/Passport No."
      ],
      "page": 0
    },
    {
      "box": [
        1230,
        1731,
        1324,
        1751,
        1277,
        1741,
        "K00121296",
        "K00121296"
      ],
      "page": 0
    },
    {
      "box": [
        1340,
        1760,
        1493,
        1777,
        1416.5,
        1768.5,
        "Gender / Sex (5)",
        "Φύλο /Cinsiyeti/Sex ( 5 )"
      ],
      "page": 0
    },
    {
      "box": [
        1339,
        1780,
        1432,
        1800,
        1385.5,
        1790,
        "APPENIM",
        "APPENIM"
      ],
      "page": 0
    },
    {
      "box": [
        1339,
        1812,
        1409,
        1830,
        1374,
        1821,
        "Date Gen.",
        "Ημερ . Γένν ."
      ],
      "page": 0
    },
    {
      "box": [
        1415,
        1812,
        1514,
        1830,
        1464.5,
        1821,
        "| Date of birth I",
        "| Dogum tarihi I"
      ],
      "page": 0
    },
    {
      "box": [
        1340,
        1829,
        1439,
        1845,
        1389.5,
        1837,
        "Date of Birth ( 7 )",
        "Date of Birth ( 7 )"
      ],
      "page": 0
    },
    {
      "box": [
        1340,
        1844,
        1427,
        1868,
        1383.5,
        1856,
        "20/03/1991",
        "20/03/1991"
      ],
      "page": 0
    },
    {
      "box": [
        1338,
        1878,
        1455,
        1897,
        1396.5,
        1887.5,
        "Date Ed. / Verilis",
        "Ημερ . Έκδ . /Verilis"
      ],
      "page": 0
    },
    {
      "box": [
        1338,
        1894,
        1421,
        1912,
        1379.5,
        1903,
        "Issued on ( 6 )",
        "Issued on ( 6 )"
      ],
      "page": 0
    },
    {
      "box": [
        1339,
        1915,
        1430,
        1934,
        1384.5,
        1924.5,
        "24/04/2013",
        "24/04/2013"
      ],
      "page": 0
    },
    {
      "box": [
        1339,
        1946,
        1469,
        1963,
        1404,
        1954.5,
        "Expires / Müddeti /",
        "Λήγει την /Müddeti/"
      ],
      "page": 0
    },
    {
      "box": [
        1341,
        1964,
        1424,
        1979,
        1382.5,
        1971.5,
        "Expires on ( 8 )",
        "Expires on ( 8 )"
      ],
      "page": 0
    },
    {
      "box": [
        1336,
        1981,
        1427,
        2003,
        1381.5,
        1992,
        "24/04/2023",
        "24/04/2023"
      ],
      "page": 0
    },
    {
      "box": [
        1337,
        2012,
        1508,
        2031,
        1422.5,
        2021.5,
        "Publisher Top / Veren makam /",
        "Εκδ . Αρχή /Veren makam/"
      ],
      "page": 0
    },
    {
      "box": [
        1337,
        2029,
        1440,
        2049,
        1388.5,
        2039,
        "Issuing Auth. ( 9 )",
        "Issuing Auth. ( 9 )"
      ],
      "page": 0
    },
    {
      "box": [
        1337,
        2048,
        1402,
        2066,
        1369.5,
        2057,
        "Τ.Α.Π.Μ",
        "Τ.Α.Π.Μ"
      ],
      "page": 0
    },
    {
      "box": [
        1337,
        2074,
        1404,
        2092,
        1370.5,
        2083,
        "CRMD",
        "C.R.M.D"
      ],
      "page": 0
    },
    {
      "box": [
        621,
        2140,
        645,
        2170,
        633,
        2155,
        "P <",
        "P <"
      ],
      "page": 0
    },
    {
      "box": [
        896,
        2142,
        931,
        2172,
        913.5,
        2157,
        "<<",
        "<<"
      ],
      "page": 0
    },
    {
      "box": [
        1349,
        2148,
        1494,
        2176,
        1421.5,
        2162,
        "* Multiplication table",
        "* くくくく くくく"
      ],
      "page": 0
    },
    {
      "box": [
        1360,
        2194,
        1493,
        2222,
        1426.5,
        2208,
        "<<<<<< 0",
        "<<<<<< 0"
      ],
      "page": 0
    }
  ],
  "num_pages": 1
}
```

**SDK Code**

```python Extract Passport
import requests

url = "https://api.staple.io/v1/documents/extract/passport"

files = { "files": "open('string', 'rb')" }
headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, files=files, headers=headers)

print(response.json())
```

```javascript Extract Passport
const url = 'https://api.staple.io/v1/documents/extract/passport';
const form = new FormData();
form.append('files', 'string');

const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Extract Passport
package main

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

func main() {

	url := "https://api.staple.io/v1/documents/extract/passport"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Extract Passport
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/documents/extract/passport")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java Extract Passport
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.staple.io/v1/documents/extract/passport")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php Extract Passport
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staple.io/v1/documents/extract/passport', [
  'multipart' => [
    [
        'name' => 'files',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Extract Passport
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/documents/extract/passport");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Extract Passport
import Foundation

let headers = ["x-api-key": "<apiKey>"]
let parameters = [
  [
    "name": "files",
    "fileName": "string"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/documents/extract/passport")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```