# API Reference

## Recognition with JSON response

<mark style="color:green;">`POST`</mark> `https://api.app.authenteq.com/recognition/as-json`

This endpoint allows you to perform document recognition and get the result in JSON response.

#### Headers

| Name          | Type   | Description                                                                                         |
| ------------- | ------ | --------------------------------------------------------------------------------------------------- |
| Authorization | string | Your client credentials combined with a colon separator, base64-encoded and prefixed with "Basic ". |
| Content-Type  | string | Always `multipart/form-data`.                                                                       |

#### Request Body

| Name       | Type   | Description                    |
| ---------- | ------ | ------------------------------ |
| frontImage | object | The front side document image. |
| backImage  | object | The back side document image.  |

{% tabs %}
{% tab title="200 Recognition finished successfully." %}
{% tabs %}
{% tab title="National ID" %}

```
{
  "documentType": "NID",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30",
  "address": "430-985 ELEIFEND^DULUTH WA 92611",
  "croppedFrontImage": {
    "contentType": "image/jpeg",
    "content": "Y3JvcHBlZEZyb250SW1hZ2U="
  },
  "croppedBackImage": {
    "contentType": "image/jpeg",
    "content": "Y3JvcHBlZEJhY2tJbWFnZQ=="
  },
  "faceImage": {
     "contentType": "image/jpeg",
     "content": "ZmFjZUltYWdlCg=="
  }
}
```

{% endtab %}

{% tab title="Passport" %}

```
{
  "documentType": "PP",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30",
  "croppedFrontImage": "<base64>",
  "croppedBackImage": "<base64>",
  "faceImage": "<base64>"
}
```

{% endtab %}

{% tab title="Driving License" %}

```
{
  "documentType": "DL",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30",
  "licenseClass": "B/C/D",
  "licenseClassDetails": {
    "B": {
      "from": "2019-01-30",
      "to": "2029-01-30",
      "note": "Some note"
    },
    "C": {
      "from": "2019-01-30",
      "to": "2029-01-30"
    },
    "D": {
      "from": "2019-01-30",
      "to": "2029-01-30"
    }
  },
  "croppedFrontImage": "<base64>",
  "croppedBackImage": "<base64>",
  "faceImage": "<base64>"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 Full authentication is required to perform document recognition." %}
{% tabs %}
{% tab title="Missing API Keys" %}

```
{
  "errorCode": "API_KEYS_MISSING",
  "errorMessage": "No API Keys in the Authorization header"
}
```

{% endtab %}

{% tab title="Invalid API Keys" %}

```
{
  "errorCode": "API_KEYS_INVALID",
  "errorMessage": "Invalid API Keys in the Authorization header"
}
```

{% endtab %}

{% tab title="Bad API Keys" %}

```
{
  "errorCode": "API_KEYS_BAD",
  "errorMessage": "Bad API Keys"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403 Your account is deactivated and you can't perform document recognition." %}

```
{
  "errorCode": "ACCOUNT_DEACTIVATED",
  "errorMessage": "Account deactivated. Please contact your Authenteq Sales Representative in order to keep using this service"
}
```

{% endtab %}

{% tab title="422 Recognition failed." %}
{% tabs %}
{% tab title="Recognition is currently not possible" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Recognition has failed on your request"
}
```

{% endtab %}

{% tab title="Document type was not recognized" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document type was not recognized"
}
```

{% endtab %}

{% tab title="Unsupported document type" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document type is not supported: 32, name: Authorization Card"
}
```

{% endtab %}

{% tab title="Issuing country was not recognized" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Issuing country was not recognized"
}
```

{% endtab %}

{% tab title="Portrait is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Portrait is missing"
}
```

{% endtab %}

{% tab title="Document fields are not valid" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Some document fields are not valid",
  "errorDetails": {
    "Surname": "Barcode value is not valid"
  }
}
```

{% endtab %}

{% tab title="Document number is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document number is missing"
}
```

{% endtab %}

{% tab title="Surname and given names are missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Surname and given names are missing"
}
```

{% endtab %}

{% tab title="Surname is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Surname is missing"
}
```

{% endtab %}

{% tab title="Date of birth is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Date of birth is missing"
}
```

{% endtab %}

{% tab title="Document is expired" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document is expired"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Recognition with multipart response

<mark style="color:green;">`POST`</mark> `https://api.app.authenteq.com/recognition/as-multipart`

This endpoint allows you to perform document recognition and get the result in multipart response.

#### Headers

| Name           | Type   | Description                                                                                         |
| -------------- | ------ | --------------------------------------------------------------------------------------------------- |
| Authentication | string | Your client credentials combined with a colon separator, base64-encoded and prefixed with "Basic ". |
| Content-Type   | string | Always `multipart/form-data`.                                                                       |

#### Request Body

| Name       | Type   | Description                    |
| ---------- | ------ | ------------------------------ |
| frontImage | object | The front side document image. |
| backImage  | object | The back side document image.  |

{% tabs %}
{% tab title="200 Recognition finished successfully." %}
{% tabs %}
{% tab title="National ID" %}

```
Content-Type: multipart/mixed;boundary=S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="documentData"
Content-Type: application/json

{
  "documentType": "NID",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30",
  "address": "430-985 ELEIFEND^DULUTH WA 92611"
}
--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedFrontImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedBackImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="faceImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt--

```

{% endtab %}

{% tab title="Passport" %}

```
Content-Type: multipart/mixed;boundary=S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="documentData"
Content-Type: application/json

{
  "documentType": "PP",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30"
}
--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedFrontImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedBackImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="faceImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt--

```

{% endtab %}

{% tab title="Driving License" %}

```
Content-Type: multipart/mixed;boundary=S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="documentData"
Content-Type: application/json

{
  "documentType": "DL",
  "documentNumber": "1234567890",
  "issuingCountry": "USA",
  "jurisdiction": "UT",
  "nationality": "USA",
  "surnameAndGivenNames": "JOHN DOE",
  "surname": "DOE",
  "givenNames": "JOHN",
  "namePrefixes": "MR",
  "nameSuffixes": "JR",
  "sex": "M",
  "dateOfBirth": "1964-12-30",
  "dateOfIssue": "2012-12-30",
  "dateOfExpiry": "2022-12-30",
  "licenseClass": "B/C/D",
  "licenseClassDetails": {
    "B": {
      "from": "2019-01-30",
      "to": "2029-01-30",
      "note": "Some note"
    },
    "C": {
      "from": "2019-01-30",
      "to": "2029-01-30"
    },
    "D": {
      "from": "2019-01-30",
      "to": "2029-01-30"
    }
  }
}
--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedFrontImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="croppedBackImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt
Content-Disposition: form-data; name="faceImage"
Content-Type: image/jpeg

--S1SPHauV7jaDgqMljnwfF-gQ2I1AcxAYrwgCt--

```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 Full authentication is required to perform document recognition." %}
{% tabs %}
{% tab title="Missing API Keys" %}

```
{
  "errorCode": "API_KEYS_MISSING",
  "errorMessage": "No API Keys in the Authorization header"
}
```

{% endtab %}

{% tab title="Invalid API Keys" %}

```
{
  "errorCode": "API_KEYS_INVALID",
  "errorMessage": "Invalid API Keys in the Authorization header"
}
```

{% endtab %}

{% tab title="Bad API Keys" %}

```
{
  "errorCode": "API_KEYS_BAD",
  "errorMessage": "Bad API Keys"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403 Your account is deactivated and you can't perform document recognition." %}

```
{
  "errorCode": "ACCOUNT_DEACTIVATED",
  "errorMessage": "Account deactivated. Please contact your Authenteq Sales Representative in order to keep using this service"
}
```

{% endtab %}

{% tab title="422 Recognition failed." %}
{% tabs %}
{% tab title="Recognition is currently not possible" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Recognition has failed on your request"
}
```

{% endtab %}

{% tab title="Document type was not recognized" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document type was not recognized"
}
```

{% endtab %}

{% tab title="Unsupported document type" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document type is not supported: 32, name: Authorization Card"
}
```

{% endtab %}

{% tab title="Issuing country was not recognized" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Issuing country was not recognized"
}
```

{% endtab %}

{% tab title="Portrait is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Portrait is missing"
}
```

{% endtab %}

{% tab title="Document fields are not valid" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Some document fields are not valid",
  "errorDetails": {
    "Surname": "Barcode value is not valid"
  }
}
```

{% endtab %}

{% tab title="Document number is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document number is missing"
}
```

{% endtab %}

{% tab title="Surname and given names are missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Surname and given names are missing"
}
```

{% endtab %}

{% tab title="Surname is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Surname is missing"
}
```

{% endtab %}

{% tab title="Date of birth is missing" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Date of birth is missing"
}
```

{% endtab %}

{% tab title="Document is expired" %}

```
{
  "errorCode": "RECOGNITION_FAILED",
  "errorMessage": "Document is expired"
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}
