Skip to main content

Amani Web SDK

Authentication

On server side you need to login with your credentials and get a token for next steps. This token should be used only on server side requests not used on Web SDK link.

curl --location --request POST 'https://eu1.amani.ai/api/v2/user/login/' // Change 'eu1' according to your region
--form 'username="user@account.com"'
--form 'password="password"'

Here is an example of how the response look like:

{
"id": "8cd7...843c2",
"username": "example@amani.ai",
"first_name": "YOUR_NAME",
"last_name": "YOUR_LASTNAME",
"phone": "532126...",
"refresh": "eyJhbG...5K3KWgQtAEiE",
"access": "eyJhbGciO...Kv_Rvf8rWE4", // Use this access token for subsequent requests
"groups": [
{
"id": 2,
"name": "Company Admin",
"permissions": [
"view_group",
"view_company",
...
]
}
],
"company_id": "dfc...9b520444",
"permissions": [
"delete_contenttype",
"view_chordcounter",
"add_profileextra",
...
]
}

Create Profile

Get or Create a customer using the request below.

If there is no customer, new one is created.

if there is a customer already created with same id_card_number, it will be returned.



curl --location --request POST 'https://eu1.amani.ai/api/v2/profile' // Change 'eu1' according to your region
--header 'Authorization: Bearer use_your_access_token_here'
--form 'id_card_number="Customer_ID_Card_Number"' // (Required)
--form 'name="Customer Name"' // (Optional)
--form 'email="Customer Email"' // (Optional)
--form 'phone="Customer Phone"' // (Optional)

Here is an example of how the response look like:

{
"id": "6aff82cb-e91a-4df4-b9a3-d69de0be1a2e", // Prfile ID
"external_id": null,
"created_at": 1709651428,
"updated_at": 1715009755,
"last_status_update": 1715009755,
"name": "NAME",
"phone": null,
"email": null,
.
.
.
]

You can use this Profile ID to create a verification URL for customer.

curl --location --request POST 'https://eu1.amani.ai/api/v2/profile/url' \ // Change 'eu1' according to your region
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer use_your_access_token_here'
--data '{
"profile": "Profile ID"
}' // Profile ID returned in the previous step
{
"short_url": "https://verify.amani.ai?pid=be1a2e01HX79R....A757XPS&server_url=https://eu1.amani.ai"
}

Redirect User to Web SDK

After the short url has been created, you can redirect the user to Amani Web SDK using this url with the parameters below.

'https://verify.amani.ai?pid=be1a2e01HX79R....A757XPS&server_url={server_url}&gl={boolean}&ln={language_code}&rl={return_url}'
pid: 'be1a2e01HX796.....Z6HATGR0ZS' // Profile Token
server_url: 'https://eu1.amani.ai/api/v2' // Server URL that will be used as a backend server. Change this according to your region
gl: false // Enable/Disable geolocation feature. Default: false
ln: 'en' // (Default is 'en')
rl: '' // User will ve redirected to this URL after verification steps are completed

You can check Supported SDK languages for more languages.

Uploading document

User will follow steps on the screen and upload the necessary documents. When all required documents uploaded, user will be redirected to return link you provided with status and error parameters.

'https://{return_link}/?status=incomplete&profile_id={profie_id}&errors=401,404'

Possible Error Codes

  • 401: Token is not valid
  • 404: User not found
  • 500: Server error