# Callback URL Integration

* &#x20;Success callback: will be invoked by the eNROLL to sync Approved enrollments.
* &#x20;Fail callback: will be invoked by the eNROLL to sync Rejected enrollments.

## 1. In your organization admin panel You Can Set The Settings of callback url :&#x20;

{% tabs %}
{% tab title="CallBack URL Settings" %}

* **Success CallBack url**:  the url of the callback api will be invoked by the eNROLL to sync Approved enrollments.
* **Faild CallBack url:**  the url of the callback api will be invoked by the eNROLL to sync Rejected enrollments.
* **Token url:** will be invoked by the eNROLL  to obtain an access token.
* **Client Id:** string will be send in the header of request for authentication
* **Client Secret:** string will be send in the header of request for authentication

<figure><img src="https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FOtzDwpqaaXp4m5Cq0rp6%2Fcburl.png?alt=media&#x26;token=f6e4276a-4ea5-41c6-91f5-889a972b7d5d" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

2. **There are two separate callback URLs and an authorization token endpoint that must be implemented by the organization wishing to integrate with** eNROL&#x4C;**:**

**a. Authorization Token Endpoints**

## will be invoked by the eNROLL to obtain an access token.

<mark style="color:green;">`POST`</mark> `{{Your Token url}}`

#### Headers

| Name         | Type | Description                              |
| ------------ | ---- | ---------------------------------------- |
| Content-Type |      | Set to application/x-www-form-urlencoded |

#### Request Body

| Name           | Type   | Description                                                                                                        |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| client\_id     | String | <p>Provided by the organization.</p><p>Must be registered in callback URLs screen in the eKYC Org Admin Panel.</p> |
| client\_secret | String | <p>Provided by the organization.</p><p>Must be registered in callback URLs screen in the eKYC Org Admin Panel.</p> |
| grant\_type    | String | Set to client\_credentials                                                                                         |

{% tabs %}
{% tab title="200: OK {  "access\_token": "string",   "expires\_in": “int”,   "token\_type": "Bearer",  }" %}
{&#x20;

"access\_token": "string",

&#x20;"expires\_in": “int”,&#x20;

"token\_type": "Bearer",

&#x20;}
{% endtab %}

{% tab title="401: Unauthorized 401 UnAuthorized if client\_id and client\_secret is  invalid" %}
401 UnAuthorized if client\_id and client\_secret is invalid
{% endtab %}
{% endtabs %}

### b. Callback EndPoints

## Callback Invoke

<mark style="color:green;">`POST`</mark> `{{Your Provided  Callback URL}}`

#### Headers

| Name          | Type   | Description                                                                                                                                                                                             |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Callback-Test | String | <p>This header will be sent only when a Test attempt is performed to verify that the callback URL is up.</p><p>The org should ignore the request payload when this header is present.</p><p></p><p></p> |

#### Request Body

| Name       | Type               | Description                                |
| ---------- | ------------------ | ------------------------------------------ |
| applicants | List of applicants | [See Next Section](#user-content-fn-1)[^1] |

{% tabs %}
{% tab title="200: OK If Callback-Test header is present, then return 200 Ok" %}
If Callback-Test header is present, then return 200 Ok
{% endtab %}

{% tab title="201: Created If Callback-Test header is not presented" %}
If Callback-Test header is not presented
{% endtab %}
{% endtabs %}

###

## Request body json example :

```json

[
    {     
        "isUpdate":"boolean" , // true if the callback for update request
        "AMLBlackList" : "boolean" , // true if user is blacklisted 
        "correlationId" : "string" , // ex : " 1256398"
        "applicantId": "string", //unique identifier for each application 
        "fullNameAr": "string", 
        "fullNameEn": "string", 
        "birthdate": "1997-03-01T00:00:00", 
        "gender": "string", // ex: "M" or "F" 
        "phoneNumbers": "List<string>", //ex:["+201068282888","+201068282882"] 
        "emails": "List<string>", //ex:["a@b.c","x@y.z"]
        "LivePhotoPath":"string", // Live Photo Path Captured in Face Matching Step
        "LiveImageBase64":"string" // base64 photo Captured in Face Matching Step
        "nationalIdInfo": { 
            "firstName": "string", 
            "familyName": "string", 
            "address": "string", 
            "addressNormalized":"string",
            "state": "string", 
            "idNumber": "string", //ex: "29703012357788" 
            "documentNumber": "string", 
            "documentTypeId": "string", //ex: "identity-card" 
            "documentTypeCode": "string", //ex: "EGY" 
            "issueDate": "2020-01-01T00:00:00", 
            "profession": "string", 
            "maritalStatus": "string", 
            "religion": "string", 
            "nationality": "string", //ex: "EGY" 
            "expirationDate": "2027-09-22T00:00:00", 
            "idFrontScanPath": "string", //file name to be get using new api 
            "idBackScanPath": "string", //file name to be get using new api 
            "photo": "string", //file name to be get using new api
            
        }, 
        "locationInfo": { 
            "latitude": "string", //ex:"29.996407" 
            "longitude": "string" //ex: "31.148291" 
        }, 
        "passportInfo": { 
            "firstNameEn": "string", 
            "familyNameEn": "string", 
            "firstNameAr": "string", 
            "familyNameAr": "string", 
            "expirationDate": "2030-05-27T00:00:00", 
            "passportScanPath": "string", //file name to be get using new api
            "photo": "string", //file name to be get using new api 
            "documentNumber": "string", 
            "documentCode": "string", 
            "issuingAuthority": "string", //ex: "EGY" 
            "nationality": "string" //ex: "EGY" 
        }, 
        "status": "int" 
                   // Accepted = 1,
                  //ManuallyAccepted = 4,
                  //ManuallyRejected = 5 
    } 
]
```

<table><thead><tr><th width="188">Field</th><th>Description</th></tr></thead><tbody><tr><td>isUpdate</td><td>true if the callback for update request</td></tr><tr><td>applicantId</td><td>unique identifier for each application</td></tr><tr><td>gender</td><td>ex: "M" or "F"</td></tr><tr><td>phoneNumbers</td><td>ex:["+201068282888","+201068282882"]</td></tr><tr><td>emails</td><td>ex:["a@b.c","x@y.z"]</td></tr><tr><td>livePhotoPath</td><td>Live Photo Path Captured in Face Matching Step</td></tr><tr><td>firstName</td><td>first line of name in national id</td></tr><tr><td>familyName</td><td>second line of name in national id</td></tr><tr><td>address</td><td>first line of address in national id</td></tr><tr><td>state</td><td>second line in address in national id</td></tr><tr><td>idNumber</td><td>ex: "29703012357788"</td></tr><tr><td>documentNumber</td><td>Factory Naumber</td></tr><tr><td>documentTypeCode</td><td>ex: "EGY"</td></tr><tr><td>issueDate</td><td>issue date for document</td></tr><tr><td>nationality</td><td>ex: "EGY"</td></tr><tr><td>idFrontScanPath</td><td>file name to be get using images  api</td></tr><tr><td>idBackScanPath</td><td>file name to be get using images  api</td></tr><tr><td>photo</td><td>fetched from id document. file name to be get using new api </td></tr><tr><td>passportScanPath</td><td>file name to be get using images  api</td></tr><tr><td>issuingAuthority</td><td>ex: "EGY"</td></tr><tr><td>status</td><td><p>ex :</p><p> Accepted = 1, </p><p>ManuallyAccepted = 4, </p><p>ManuallyRejected = 5</p></td></tr></tbody></table>

## **REVERSE INTEGRATION DETAILS**

There are also an optional end points that organization could use to get specific applications during a period of time

**Token generation:**

&#x20; **this is an Api to generate token using tenantId, tenantSecret.**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media&token=71011f45-89fc-404f-9e8c-090198ef940c>" path="/api/v1/Auth/GenerateAuthToken" method="post" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media\&token=71011f45-89fc-404f-9e8c-090198ef940c)
{% endopenapi %}

**Get Applicant Id By Request Id :**&#x20;

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2F8q4zcrGRDJhhC7jpOonA%2FenROLLCollection.json?alt=media&token=81554937-b091-4bf5-b384-7050d9d9a55f>" path="/api/v1/Applicant/GetApplicantIdByRequestId" method="get" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2F8q4zcrGRDJhhC7jpOonA%2FenROLLCollection.json?alt=media\&token=81554937-b091-4bf5-b384-7050d9d9a55f)
{% endopenapi %}

**Get applicants By Request ID OR Correlation Id:**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1>" path="/api/v1/Applicant/GetApplicationsPaged" method="get" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media\&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1)
{% endopenapi %}

**Get applicants during specific date**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1>" path="/api/v1/Applicant/GetApplicationsByDatePaged" method="post" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media\&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1)
{% endopenapi %}

**Get applicants by list of applicantId:**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1>" path="/api/v1/Applicant/GetApplicationsByIdsPaged" method="post" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FKn0Np7mSwV8IbEQwZMv7%2FenROLLCollection.json?alt=media\&token=7875b547-e2d6-4b2c-bfb0-9162c4f765b1)
{% endopenapi %}

**Get image as base64 by ImagePath:**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media&token=71011f45-89fc-404f-9e8c-090198ef940c>" path="/api/v1/Applicant/GetImageByPath" method="get" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media\&token=71011f45-89fc-404f-9e8c-090198ef940c)
{% endopenapi %}

**Get list of images by list of ImagePaths:**

{% openapi src="<https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media&token=71011f45-89fc-404f-9e8c-090198ef940c>" path="/api/v1/Applicant/GetImagesByPaths" method="post" %}
[enROLLCollection.json](https://3826285197-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGM6tCcdsukNbOigN9U2m%2Fuploads%2FkUyWYX9DkD4UK6x9L9YL%2FenROLLCollection.json?alt=media\&token=71011f45-89fc-404f-9e8c-090198ef940c)
{% endopenapi %}

[^1]:
