> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adherecompliance.com/llms.txt
> Use this file to discover all available pages before exploring further.

# National ID

> Extrayez les détails d'identité d'un slip ou d'une carte NIN nigériane.

Vérifiez le slip ou la carte du Numéro National d'Identification d'un client nigérian en téléversant une photo — aucune saisie manuelle du NIN requise. Nous lisons les informations et comparons le visage du document avec un selfie. Aucun contrôle de vivacité n'est nécessaire.

> [!NOTE]
>
> Il s'agit d'un document recto-verso — fournissez à la fois `document_front` et `document_back` pour l'extraction la plus complète.

> [!NOTE]
>
> `selfie_image` est requis — le visage extrait du document est comparé à celui-ci. Il s'agit d'une comparaison d'image fixe (pas de vivacité).

## Endpoint

```
POST /api/onboarding/document_verification/nigeria/national_id
```

## Requête

### En-têtes

| En-tête | Valeur | Requis |
| - | - | - |
| `x-access-token` | Votre clé secrète API | Oui |
| `Content-Type` | `multipart/form-data` | Oui |

### Paramètres de corps

| Paramètre | Type | Requis | Description |
| - | - | - | - |
| `document_front` | file | Oui | Recto du slip/carte NIN. JPG, PNG ou PDF d'une page, max 10 Mo |
| `document_back` | file | Non | Verso de la carte NIN. JPG, PNG ou PDF d'une page, max 10 Mo |
| `selfie_image` | file | Oui | Un selfie à comparer avec la photo du visage du document. JPG ou PNG, max 5 Mo |

> [!NOTE]
>
> `document_type` et `country` ne sont pas nécessaires — cet endpoint est déjà délimité au National ID nigérian.

> [!TIP]
>
> Un document numérisé peut être envoyé sous forme de PDF d'une page, par exemple `-F "document_front=@/path/to/scan.pdf"`.

### Exemple

```bash cURL theme={null}
curl -X POST "https://adhere-api.smartcomply.com/api/onboarding/document_verification/nigeria/national_id" \
  -H "x-access-token: YOUR_SECRET_KEY" \
  -F "document_front=@/path/to/nin_front.jpg" \
  -F "document_back=@/path/to/nin_back.jpg" \
  -F "selfie_image=@/path/to/selfie.jpg"
```

```javascript Node.js theme={null}
const formData = new FormData();
formData.append("document_front", fs.createReadStream("/path/to/nin_front.jpg"));
formData.append("document_back", fs.createReadStream("/path/to/nin_back.jpg"));
formData.append("selfie_image", fs.createReadStream("/path/to/selfie.jpg"));

const response = await fetch(
  "https://adhere-api.smartcomply.com/api/onboarding/document_verification/nigeria/national_id",
  {
    method: "POST",
    headers: { "x-access-token": "YOUR_SECRET_KEY" },
    body: formData,
  }
);
const data = await response.json();
```

```python Python theme={null}
import requests

response = requests.post(
    "https://adhere-api.smartcomply.com/api/onboarding/document_verification/nigeria/national_id",
    headers={"x-access-token": "YOUR_SECRET_KEY"},
    files={
        "document_front": open("/path/to/nin_front.jpg", "rb"),
        "document_back": open("/path/to/nin_back.jpg", "rb"),
        "selfie_image": open("/path/to/selfie.jpg", "rb"),
    },
)
data = response.json()
```

## Réponse

### 200 OK

| Champ | Type | Description |
| - | - | - |
| `status` | string | `"success"` en cas d'extraction réussie |
| `data.full_name` | string | Nom complet extrait |
| `data.first_name` | string | Prénom extrait |
| `data.last_name` | string | Nom de famille extrait |
| `data.date_of_birth` | string | Date de naissance au format `YYYY-MM-DD` |
| `data.gender` | string | Genre extrait |
| `data.id_number` | string | Le NIN imprimé sur le document |
| `data.document_type` | string | `"national_id"` |
| `data.document_country` | string | Le pays qui a délivré le document, en code pays à deux lettres : `"NG"` |
| `data.photo` | string | Photo du visage extraite du document, encodée en base64 |
| `data.extra_fields` | object | Présent si la carte est au format recto-verso plus ancien — voir ci-dessous |
| `data.face_match` | object | Résultat de la comparaison du visage du document avec `selfie_image` — voir ci-dessous |
| `data.face_match.attempted` | boolean | Si une comparaison a réellement été exécutée |
| `data.face_match.verified` | boolean \| null | `true`/`false` si la comparaison a été exécutée ; `null` si elle ne l'a pas pu (voir Notes de concordance faciale) |
| `data.face_match.decision` | string | `"MATCH"` ou `"NO_MATCH"` |
| `data.face_match.confidence_percentage` | number | Confiance de correspondance, 0–100 |
| `data.face_match.compare_mode` | string | `"COMPARISON_NO_LIVENESS"` signifie que les deux photos ont été comparées sans contrôle de vivacité |
| `data.face_match.selfie_image` | string | URL du selfie téléversé |
| `message` | string | Résumé du résultat lisible par l'homme |

```json theme={null}
{
  "status": "success",
  "data": {
    "valid": true,
    "first_name": "TUNDE",
    "last_name": "AYODELE",
    "full_name": "AYODELE TUNDE",
    "date_of_birth": "2002-02-16",
    "gender": "M",
    "id_number": "12345678901",
    "document_type": "national_id",
    "document_country": "NG",
    "photo": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
    "face_match": {
      "attempted": true,
      "verified": true,
      "decision": "MATCH",
      "confidence_percentage": 92.4,
      "compare_mode": "COMPARISON_NO_LIVENESS",
      "selfie_image": "https://.../selfie.jpg"
    }
  },
  "message": "Document details retrieved successfully"
}
```

> [!NOTE]
>
> **Champs additionnels** — le nouveau slip/carte NIN unilatéral n'a pas d'autres champs au-delà de ceux listés ci-dessus. L'ancienne carte recto-verso imprime plus (`occupation`, `state`, `lga`, `ward`, `height`, `blood_group`, plus plusieurs champs du verso) — ils reviennent dans `extra_fields` lorsqu'ils sont présents, et sont simplement absents pour le nouveau format plutôt qu'envoyés comme `null`.

> [!NOTE]
>
> **Notes de concordance faciale** — si le service de comparaison lui-même échoue, `attempted` reflète si une comparaison a réellement été exécutée et `verified` revient `null` avec un champ `reason` expliquant pourquoi — c'est différent de `verified: false`, qui signifie que la comparaison a été exécutée et que les visages ne correspondaient pas. Un problème de concordance faciale ne bloque jamais les données du document sous-jacent — le reste de `data` est toujours renvoyé.

### 400 Bad Request

Renvoyé pour une entrée invalide, ou lorsque le document échoue à nos contrôles de qualité de la photo (flou, mauvais type de document, reflet, etc.).

```json theme={null}
{
  "status": "failed",
  "data": [],
  "message": "ID photo is too blurry — please retake in good lighting with a steady hand"
}
```

### 401 Unauthorized

```json theme={null}
{
  "status": "failed",
  "message": "Authentication credentials were not provided."
}
```

> [!NOTE]
>
> Pour une liste complète des codes d'erreur, consultez la référence [Codes d'erreur](https://docs.adherecompliance.com/error_codes.md).


## OpenAPI

````yaml POST /api/onboarding/document_verification/nigeria/national_id
openapi: 3.0.3
info:
  title: Adhere API
  description: >-
    Identity verification, credit checks, transaction monitoring, and loan fraud
    detection across Africa.
  version: 3.0.0
servers:
  - url: https://adhere-api.smartcomply.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Nigeria KYC
  - name: Kenya KYC
  - name: Ghana KYC
  - name: Rwanda KYC
  - name: Uganda KYC
  - name: Document Verification
  - name: Biometrics
  - name: Individual Credit
  - name: Business Credit
  - name: Transaction Monitoring
  - name: Transaction Screening
  - name: Transaction KYC
  - name: Loan Fraud
  - name: User Journey
paths:
  /api/onboarding/document_verification/nigeria/national_id:
    post:
      tags:
        - Document Verification
      summary: Document Verification — Nigeria National ID
      description: >
        Extract identity details from a Nigerian NIN slip or National ID card,
        plus a required face match against a selfie. document_type and country
        are fixed by this URL — no need to send them in the request body.
      operationId: documentVerificationNigeriaNationalId
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - document_front
              properties:
                document_front:
                  type: string
                  format: binary
                  description: >-
                    Front of the NIN slip/card. JPG, PNG or single-page PDF, max
                    10MB.
                document_back:
                  type: string
                  format: binary
                  description: >
                    Back of the card. Optional, but recommended — extraction may
                    be less complete without it. JPG, PNG or single-page PDF,
                    max 10MB.
                selfie_image:
                  type: string
                  format: binary
                  description: >
                    A selfie to compare against the face extracted from the
                    document. JPG or PNG, max 5MB. Required.
      responses:
        '200':
          $ref: '#/components/responses/DocumentVerificationSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    DocumentVerificationSuccess:
      description: Document details extracted successfully
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: success
              data:
                type: object
                properties:
                  valid:
                    type: boolean
                  first_name:
                    type: string
                  last_name:
                    type: string
                  full_name:
                    type: string
                  date_of_birth:
                    type: string
                  gender:
                    type: string
                  nationality:
                    type: string
                  address:
                    type: string
                  id_number:
                    type: string
                  serial_number:
                    type: string
                  id_type:
                    type: string
                  document_type:
                    type: string
                  document_country:
                    type: string
                    description: >
                      Passports only. The country that issued the passport, as
                      an two-letter country code, for example RW.
                  expiry_date:
                    type: string
                  issue_date:
                    type: string
                  is_expired:
                    type: boolean
                    description: >
                      Always false on a 200. An expired document fails the check
                      with a 400; its details are still returned in data, with
                      is_expired true.
                  photo:
                    type: string
                    description: >-
                      Base64-encoded face photo extracted from the document.
                      Absent for document types with no face photo
                      (cac_certificate, utility_bill).
                  extra_fields:
                    type: object
                    description: >-
                      Every other field read from the document that doesn't have
                      its own dedicated field above. Varies by document_type and
                      country.
                  face_match:
                    type: object
                    description: Present only when selfie_image was supplied.
                    properties:
                      attempted:
                        type: boolean
                      verified:
                        type: boolean
                        nullable: true
                        description: >-
                          true/false if the comparison ran; null if it couldn't
                          (see reason).
                      decision:
                        type: string
                        enum:
                          - MATCH
                          - NO_MATCH
                        description: The comparison's verdict.
                      confidence_percentage:
                        type: number
                      compare_mode:
                        type: string
                        example: COMPARISON_NO_LIVENESS
                        description: >
                          COMPARISON_NO_LIVENESS: the two photos are compared;
                          no liveness check is run on the selfie.
                      selfie_image:
                        type: string
                        description: URL of the uploaded selfie.
                      reason:
                        type: string
                        description: >-
                          Present when verified is null — explains why the
                          comparison couldn't run or complete.
              message:
                type: string
                example: Document details retrieved successfully
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: failed
              data:
                type: array
                items: {}
              message:
                type: string
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: failed
              message:
                type: string
                example: Authentication credentials were not provided.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: Your Adhere API secret key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.