# Perform autofill

Extracts data and images from an identity document.

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/autofill`

### Headers

<table><thead><tr><th width="250">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td>﻿﻿<code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <code>live</code> or <code>test</code> key.</td></tr><tr><td>﻿﻿<code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="252">Name</th><th width="103">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>data</code><mark style="color:red;">*</mark></td><td>string</td><td>The <code>BASE64</code> encoded data.</td></tr></tbody></table>

The response will include the following constituents:

* [extractedData](https://docs.complycube.com/documentation/api-reference/check-types/document-check#extracteddata-object)
* [extractedImages](https://docs.complycube.com/documentation/api-reference/check-types/document-check#extractedimages-array)

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/autofill \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
	       "data": "<BASE64_DATA_CONTENT>"
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const supportedDocuments = await complycube.autofill.performAutofill({
    data: "BASE64_DATA_CONTENT"
});
```

{% endtab %}
{% endtabs %}

### Example responses

{% tabs %}
{% tab title="Success (200)" %}

```javascript
{
  "extractedData": {
    "holderDetails": {
      "lastName": [
        "MUSTERMANN"
      ],
      "firstName": [
        "ERIKA"
      ],
      "dob": {
        "day": 12,
        "month": 8,
        "year": 1964
      },
      "age": 57,
      "nationality": "DE",
      "birthPlace": "BERLIN",
      "gender": "female"
    },
    "documentDetails": {
      "documentNumber": "C01X0006H",
      "documentType": "passport",
      "issuingCountry": "DE",
      "issuingAuthority": "STADT KÖLN",
      "issuingDate": {
        "day": 1,
        "month": 11,
        "year": 2007
      },
      "expirationDate": {
        "day": 31,
        "month": 10,
        "year": 2017
      },
      "hasTwoSides": false
    },
    "allExtractedData": {
      "visual": {
        "lastName": [
          "MUSTERMANN"
        ],
        "lastNameNative": "MUSTERMANN",
        "firstName": [
          "ERIKA"
        ],
        "firstNameNative": "ERIKA",
        "entityNameNative": "MUSTERMANN ERIKA",
        "dob": {
          "day": 12,
          "month": 8,
          "year": 1964
        },
        "nationalityNative": "DEUTSCH",
        "birthPlace": "BERLIN",
        "birthPlaceNative": "BERLIN",
        "gender": "female",
        "documentNumber": "C01X0006H",
        "issuingCountry": "DE",
        "issuingAuthority": "STADT KÖLN",
        "issuingAuthorityNative": "STADT KÖLN",
        "issuingDate": {
          "day": 1,
          "month": 11,
          "year": 2007
        },
        "expirationDate": {
          "day": 31,
          "month": 10,
          "year": 2017
        }
      },
      "mrz": {
        "lastName": [
          "MUSTERMANN"
        ],
        "firstName": [
          "ERIKA"
        ],
        "dob": {
          "day": 12,
          "month": 8,
          "year": 1964
        },
        "nationality": "DE",
        "gender": "female",
        "documentNumber": "C01X0006H",
        "issuingCountry": "DE",
        "expirationDate": {
          "day": 31,
          "month": 10,
          "year": 2017
        }
      }
    },
    "mrz": {
      "line1": "P<D<<MUSTERMANN<<ERIKA<<<<<<<<<<<<<<<<<<<<<<",
      "line2": "C01X0006H1D<<6408125F1710319<<<<<<<<<<<<<<<0"
    }
  },
  "extractedImages": [
    {
      "type": "front_side",
      "data": "<BASE64_DATA_CONTENT>"
    }
  ]
}
```

{% endtab %}

{% tab title="Unreadable Image (422)" %}

```javascript
{
    "type": 'document_type_undetected', 
    "message": 'Document type not recognized'
}
```

{% endtab %}
{% endtabs %}
