# Fetch Verification

## Fetch Verification (Sync)

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/api/v1/sync/verification`

This endpoint allows you to verify a customer details synchronously.

#### Headers

| Name           | Type   | Description                                                    |
| -------------- | ------ | -------------------------------------------------------------- |
| Authentication | string | Authentication token to track down who is emptying our stocks. |

#### Request Body

<table><thead><tr><th>Name</th><th width="163">Type</th><th>Description</th></tr></thead><tbody><tr><td>identifier_type<mark style="color:red;">*</mark></td><td>String</td><td>The identifier type being used for the verification (national_id or passport_no)</td></tr><tr><td>identifier<mark style="color:red;">*</mark></td><td>String</td><td>Identifier value</td></tr><tr><td>first_name<mark style="color:red;">*</mark></td><td>String</td><td>First name of the individual</td></tr><tr><td>last_name<mark style="color:red;">*</mark></td><td>String</td><td>Last name of the individual</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK Verification successfully retrieved. (NATIONAL ID)" %}

```json
{
    "status": 200,
    "message": "Verification data fetched successfully",
    "data": {
        "national_id": "99999999",
        "full_name": "Marangi Peter Mbiu",
        "surname": "Marangi",
        "other_names": "Peter Mbiu",
        "first_name": "Peter",
        "gender": "M",
        "date_of_birth": "9/25/1989 12:00:00 AM",
        "place_of_birth": "ELDORET EAST\nDISTRICT - ELDORET EAST",
        "citizenship": "Kenyan",
        "occupation": "UNEMPLOYED",
        "place_of_live": "ELDORET EAST DISTRICT - ELDORET EAST",
        "date_of_issue": "9/25/2014 12:00:00 AM",
        "photo": "",
        "clan": "",
        "ethnic_group": "",
        "family": "",
        "reg_office": "",
        "serial_number": "124316781"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="JSON Payload - National ID" %}

```json
{ 
 "identifier_type": "national_id", 
 "identifier": "99999999",
 "first_name": "Peter Murungi",
 "last_name": "Doe",
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="JSON Payload - Passport" %}

```json
{ 
 "identifier_type": "passport_no", 
 "identifier": "AK078R474",
 "first_name": "Jane",
 "last_name": "Doe",
}
```

{% endtab %}
{% endtabs %}

**Response Codes**

| Code                      | Meaning                                        |
| ------------------------- | ---------------------------------------------- |
| 200 OK                    | Successfully verified the identity.            |
| 400 Bad Request           | Invalid request parameters.                    |
| 401 Unauthorized          | Invalid or missing authentication credentials. |
| 404 Not Found             | No data found for the requested identifier.    |
| 500 Internal Server Error | An error occurred on the server side.          |
| 503 Service Unavailable   | IPRS systems are down.                         |

### **Error Handling** <a href="#error-handling" id="error-handling"></a>

Errors are returned in the following format:

```json
{ 
    "status": "error code",   
    "message": "error message" 
}
```

#### **Common HTTP Status Codes** <a href="#common-http-status-codes" id="common-http-status-codes"></a>

| Code                      | Message                                                 |
| ------------------------- | ------------------------------------------------------- |
| 400 Bad Request           | The request was invalid or missing required parameters. |
| 401 Unauthorized          | Authentication failed or the token is missing.          |
| 403 Forbidden             | Access to the resource is denied.                       |
| 404 Not Found             | The requested resource could not be found.              |
| 500 Internal Server Error | An error occurred on the server side.                   |
| 503 Service Unavailable   | IPRS systems are down.                                  |

#### **Error Responses** <a href="#error-responses" id="error-responses"></a>

**Bad Request (400)**

```json
{   
    "status": 400,   
    "message": "identifier_type is required" 
}
```

```json
{
  "status": 400,
  "message": "Identifier should contain only digits for national_id"
}
```

```json
{
  "status": 400,
  "message": "Identifier should be between 6 and 10 digits long for national_id"
}
```

**Internal Server Error (500)**

```json
{    
    "status": 500,    
    "message": "Internal server error: Contact support@pezesha.freshdesk.com" 
}
```

**Service Unavailable (503)**

```json
{
    "status": 503,    
    "message": "IPRS systems are experiencing a nationwide downtime." 
}
```

&#x20;**Rate Limiting**

To ensure fair usage, API requests are subject to rate limits. Exceeding these limits will result in a **429 Too Many Requests** response. The current setting prevents duplicate requests within a **2-minute window**.

```json
{
   "status": 429,
   "message": "Too many requests: Please wait before retrying."
}
```
