Skip to content

Example Workflow

In this section an example workflow (with CURL examples) is described to show how this REST Channel API can be used to create a Register Session.

Let's suppose that the base URL of the service is: https://api.eu.veri-das.com/dpsrest

Step1: Create Audio Settings configuration

Before creating any Session, a POST request to v1/audio_settings endpoint is required to notify das-Peak Streaming which consumer is required and which audio format will be employed.

Request:

curl --location --request POST 'https://api.eu.veri-das.com/dpsrest/v1/audio_settings' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'apikey: $APIKEY' \
--data-raw '{
  "audio_protocol": "audiohook",
  "audio_format": "raw",
  "audio_codec": "mulaw",
  "sample_format": "",
  "sample_rate": 8000,
  "channels": 1
}'

Response:

HTTP status: 201

{
    "audio_codec": "mulaw",
    "audio_format": "raw",
    "audio_protocol": "audiohook",
    "channels": 1,
    "created_at": "Wed, 17 May 2023 09:25:24 GMT",
    "id": "6ef34b58-e793-4126-b043-152edefed3a3",
    "sample_format": "",
    "sample_rate": 8000
}

The service returns an Audio Settings id (6ef34b58-e793-4126-b043-152edefed3a3) that will be used in the following requests.

Step2: Create a Register Session

Once the required Audio Settings configuration is created, the user can create a Register Session performing a POST request to the v1/register_session endpoint.

Request:

curl --location --request POST 'https://api.eu.veri-das.com/dpsrest/v1/register_session' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'apikey: $APIKEY' \
--data-raw '{
  "audio_settings_id": "6ef34b58-e793-4126-b043-152edefed3a3",
  "authenticity_threshold": 0.8,
  "audio_total_duration": 5.0,
  "call_id": "888806c3-3391-4d73-bb86-e5874e6ed5b4",
  "model_hash": "<MODEL_HASH>"
}'

Check how previous audio_settings_id is set when requesting the Register Session. Also, call_id parameter is set, which identifies a Session with its corresponding audio stream.

Response:

HTTP status: 201

{
    "audio_settings_id": "6ef34b58-e793-4126-b043-152edefed3a3",
    "audio_total_duration": 5.0,
    "authenticity_threshold": 0.8,
    "call_id": "888806c3-3391-4d73-bb86-e5874e6ed5b4",
    "created_at": "Wed, 17 May 2023 10:08:07 GMT",
    "id": "39caf7fe-2f37-4a65-9c27-a5595ee24219",
    "model_hash": "<MODEL_HASH>",
    "state": "PROCESSING_AUDIO",
}

The service returns a Register Session id (39caf7fe-2f37-4a65-9c27-a5595ee24219) that will be used in the following requests.

Check how state parameter is set as PROCESSING_AUDIO, meaning das-Peak Streaming has created the necessary resources and it is ready to receive audio. The Client is now able to send audio using corresponding Audio Channel (audiohook in this example).

Step3: Get Register Session status

In order to retrieve the Register Session status meanwhile das-Peak Streaming is receiving audio a GET request can be performed to v1/register_session endpoint.

curl --location --request GET 'https://api.eu.veri-das.com/dpsrest/v1/register_session/39caf7fe-2f37-4a65-9c27-a5595ee24219' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'apikey: $APIKEY'

Check how previous register_session_id is set as query parameter when requesting Register Session status.

Response:

HTTP status: 200

While the audio is being processed by das-Peak Streaming, this request will give following response:

{
    "audio_settings_id": "6ef34b58-e793-4126-b043-152edefed3a3",
    "audio_total_duration": 5.0,
    "authenticity_threshold": 0.8,
    "call_id": "888806c3-3391-4d73-bb86-e5874e6ed5b4",
    "created_at": "Wed, 17 May 2023 10:08:07 GMT",
    "id": "39caf7fe-2f37-4a65-9c27-a5595ee24219",
    "model_hash": "<MODEL_HASH>",
    "result": {
        "audio_seconds": 6.1,
        "vad_percentage": 61
    },
    "state": "PROCESSING_AUDIO"
}

This means audio processing is in progress. Check how feedback of the process is returned using audio_seconds and vad_percentage parameters.

After enough audio is processed by das-Peak Streaming, this request will return following response:

HTTP status: 200

{
    "audio_settings_id": "6ef34b58-e793-4126-b043-152edefed3a3",
    "audio_total_duration": 5.0,
    "authenticity_threshold": 0.8,
    "call_id": "888806c3-3391-4d73-bb86-e5874e6ed5b4",
    "created_at": "Wed, 17 May 2023 10:08:07 GMT",
    "id": "39caf7fe-2f37-4a65-9c27-a5595ee24219",
    "model_hash": "<MODEL_HASH>",
    "result": {
        "credential": "$CREDENTIAL",
        "authenticity": 0.98,
        "voice_audio_collected": 5
    },
    "state": "SUCCESS"
}

Check how a biometric credential has been created. This credential can be stored and used for future verifications.