# 5 Minutes Tutorial

<note>

This tutorial assumes you already have OmniPanel credentials and access to your API key for communicating with
Authologic APIs. If you’re not at this stage yet, feel free to reach out to us for help.

</note>

<note>

We use the `curl` tool to show the API operation.
If you have not dealt with it, you can find a short guide on it [here](https://www.baeldung.com/curl-rest).
Of course, there is nothing to prevent you from using the swagger tool directly, which you will find at the
link: [here](/api),
or any other tool, such as Postman or Insomnia.

</note>

## The Conversation

For the sake of simplicity, we’ll refer to the process of interacting with the API as a **conversation**.

Whenever you want to:

- verify a user’s identity,
- check AML lists, or
- initiate a verification process,

you start a new **conversation**.

## Creating a Conversation

In this 5-minute tutorial, we’ll simulate a user identity verification process. We use a simulation to keep things
simple and to focus on the core interactions needed to get you started.

We will use the `curl` tool to start a new conversation - one that will return the user first and last name. Keep in mind
that the following example requires you to replace the `my_login` with the credentials that you can find in the OmniPanel
and `my_callback_url_here` with an address that our system will return the data to.

For `my_callback_url_here` you could use [https://webhook.site/](https://webhook.site/) to generate callback url which will be responsible for
receiving user information from Authologic. Whether you will use `webhook.site` or other similar tool it is crucial
that it will correctly receive http request since *it is required for the process of identification*.

```shell
curl -X POST -u my_login "https://sandbox.authologic.com/api/conversations" \
-H "Accept: application/vnd.authologic.v1.1+json" \
-H "Content-Type: application/vnd.authologic.v1.1+json" \
-d '{
    "userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
    "returnUrl": "https://id.sandbox.authologic.com/c/{conversationId}/thankYou",
    "callbackUrl": "my_callback_url_here",
    "strategy": "public:sandbox",
        "query": {
            "identity": {
                "requireOneOf": [
                    [ "PERSON_NAME_FIRSTNAME", "PERSON_NAME_LASTNAME"]
                ]
            }
        }
    }'
```

Of course, instead of `my_login` enter your login. You should be prompted for a password - at that point you should
enter *the API key* (do not confuse it with the password to the customer panel).

<note>

The example given is for a test environment. If you perform these operations on the production environment
that was provided to you then the `public:sandbox` strategy is not available. You can omit the `strategy` field to
use the default strategy or use another one that we gave you the name of when determining your needs. As a result,
nothing bad will happen, but remember that the production environment requires real data. The collected data will
also be real.

</note>

The response of the above command should look something like this:

```json
{
  "id": "c12c1adc-3ff0-4d32-b95c-c593135c903e",
  "userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
  "url": "https://sandbox.authologic.com/c/c12c1adc-3ff0-4d32-b95c-c593135c903e",
  "status": "CREATED",
  "result": {
    "identity": {
      "status": "IN_PROGRESS",
      "user": {}
    }
  }
}
```

In the above response we got the following information:

- `id` - the conversation id. We will need it when inquiring about its status.
- `userKey` - ID of the user to be checked, exactly what you entered when creating the conversation.
- `url` - the address to which the user should be redirected in order to verify the identity.
- `status` - conversation status. `CREATED` marks a new conversation where the user has not yet started the verification process.
- `result` - conversation result. At the moment we do not have any data, so there appears, within the product for which we asked the status: `IN_PROGRESS` and an empty structure with data about the user (`user`)

## Identity Check

To start the identity check, direct the user (or yourself during testing) to the **url** provided in the response in
the `url` field. In the sandbox environment, you’ll see a form where you can enter the details to simulate the identity
verification process. Once completed, the user will be redirected to the `returnUrl` you specified earlier - in the
conversation creation request.

## Getting the Conversation Results

Now let's check the conversation status. You should get request on url that was provided in `callbackUrl` field during
creating conversation, which should look similar to the following JSON:

```json
{
  "id": "f109ad2b-5e3c-4f9d-b2ea-20379e56f101",
  "created": "2020-12-24T16:00:00.930853456Z",
  "target": "CONVERSATION",
  "event": "FINISHED",
  "payload": {
    "conversation": {
      "id": "c12c1adc-3ff0-4d32-b95c-c593135c903e",
      "userKey": "7dfb9ded-c38f-49ae-95e2-307283a0b1f6",
      "url": "https://sandbox.authologic.com/c/c12c1adc-3ff0-4d32-b95c-c593135c903e",
      "status": "FINISHED",
      "result": {
        "identity": {
          "status": "FINISHED",
          "errors": [],
          "user": {
            "person": {
              "name": {
                "firstName": "Jan",
                "lastName": "Testowy"
              }
            }
          }
        }
      }
    }
  }
}
```

> #### Conversation Identifier vs Callback Identifier
> 
> Please note, that in the above response the top level identifier is the **callback** identifier, not the
> **conversation** identifier. In order to retrieve metadata about the conversation using Authologic APIs,
> you should use the **conversation** identifier, which is the **id** field value that is located in
> the **payload.conversation** object.

<tip>

That's it. You managed to use API and get data.

</tip>

Now, head to the part of the documentation that describes the product that you would like to use to get a more in-depth
information about the integration.

<card-group>
<card icon="i-lucide-user-check" title="Identity" to="/docs/products/identity">

This product enables user identity check process using various methods such as biometric check, document OCR, government issues digital IDs, bank IDs and more.

</card>

<card icon="i-lucide-shield-check" title="AML" to="/docs/products/aml">

This product enables verification of a user’s registration on AML lists via the API and provides details on the specific lists where the user’s data appears.

</card>

<card icon="i-lucide-landmark" title="Bank Transactions" to="/docs/products/bank-transactions">

This product enables the retrieval of a user's bank transactions and related statistics.

</card>

<card icon="i-lucide-log-in" title="User Authentication" to="/docs/products/user-authentication">

This product enables you to create a user login process (access authentication) for your system using Authologic.

</card>

<card icon="i-lucide-check-circle" title="Data Verification" to="/docs/products/data-verification">

This product allows for the verification of provided data, resulting in a numerical score that indicates how closely the verified data matches the user’s identity.

</card>

<card icon="i-lucide-clipboard-list" title="Enquiry" to="/docs/products/enquiry">

This product allows gathering of custom data from the user via dynamic forms.

</card>
</card-group>
