User management

Step-by-Step Workflow: Sign-up

To create a user using the Shield API, the first step is to use the endpoint for sending an OTP to the email/phone. It is mandatory to include the query parameter with the email value to recognize that the user is registering for the first time.

Important! Due to limitations of the WhatsApp API, if you want to use this OTP, you must keep in mind that the user must have previously spoken to the InsureHero number in order to receive the message.

Create OPT

POST https://app.insurehero.io/api/shield/v1/users/:userId/otp

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

searchBy*

email or phone*

Field use to create a temp register of the user

Path Parameters

Name
Type
Description

userId*

string

Email or phone

Example Response

{
    "data": {
        "message": "Success! OTP sent to the user mail"
    }
}

Check OTP

Once the OTP is received, you must verify it to create a pre-registered user (this is not enough to create a claim).

POST https://app.insurehero.io/api/shield/v1/users/:userId/verify-otp

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

searchBy*

email or phone*

Field use to create a temp register of the user

Path Parameters

Name
Type
Description

userId*

string

Email or phone

Request Body

Name
Type
Description

otp*

string

The OPT generated for the user

Example Response

{
    "data": {
        "message": "eyJhbGciOiJIUzI1NiJ9.eyJzd6346iOiJlbWFudWVsLm1hbnJpccaQHRyYWRlLmVjIiwiaWF0IjoxNzIwNTU1MzkxLCJleHArjjE3MjA1NTg5OTF9.mY9Y1alXXwxMGkI6XIzo54uZB_vT4hhtna6gxHr4PGA",
        "additionalData": "This user needs to be register before make a claim."
    }
}

Register a user

Once the user is pre-registered with the previous steps, you can register them. This endpoint enables the creation of a user within the channel. These users are then designated as authorized claimants in the risk item, and the relationship is established based on email. If the user doesn't exist at the time of being added as an authorized claimant, there's no issue. Utilizing this endpoint automatically establishes the relationship via email.

PATCH https://app.insurehero.io/api/shield/v1/users/:userId?searchBy=email

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

searchBy*

email*

Field use to create a temp register of the user

Path Parameters

Name
Type
Description

userId*

string

Email

Request Body

Name
Type
Description

first_name*

string

User's first name

last_name*

string

User's last name

phone*

string

User's phone number (Must be unique)

gender

string

MALE | FEMALE

dob

string

User's date of birth

address

json

The user's address information

document_type

string

The type of document can be: PASSPORT, RUC, CI and CURP

document_number

string

The user's document number

bank_accounts

BankAccountType[]

User bank accounts

company_name

string

User company name

company_role

string

User company role

company_email

string

User company email

company_identifier

CompanyIdentifierType

User company identifier

company_address

json

The user's company address information

company_bank_accounts

BankAccountType[]

The object fields are the same fields as bank_accounts

uid

string

Additional user's unique identifier in your system. You will be able to use it to search for a user later

group_id

string

The id of the group a user should belong to

metadata

object

Additional data to include in the user record.

Example Response

{
    "data": {
        "id": "5fd3b337-a10a-4388-bd63-40a0cb0361cf",
        "channel_id": "fc94d4a1-f834-481d-a6b2-138b823389c8",
        "email": "example-6@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "phone": "098 391 3123",
        "uid": null,
        "gender": "MALE",
        "dob": "2024-04-01T05:00:00+00:00",
        "address": "Jr Junin 550",
        "document_type": "RUC",
        "document_number": "0931339568",
        "bank_accounts": [
            {
                "account_name": "John Doe",
                "bank_name": "Global Bank",
                "account_number": "2313213123123",
                "bic_swift": "GBL12345",
                "iban": "123123123",
                "routing_number": "011000138",
                "country": "EC",
                "currency": "US Dollar",
                "account_type": "Checking",
                "bank_address": "example",
                "additional_info": "example"
            }
        ],
        "company_name": "Doe Enterprises",
        "company_role": "Founder",
        "company_email": "example@example.com",
        "company_identifier": {
            "type": "RUC",
            "value": "12312321321321"
        },
        "company_address": "Jr Junin 550",
        "company_bank_accounts": [
            {
                "account_name": "Doe Enterprises",
                "bank_name": "Business Bank",
                "account_number": "987654321",
                "bic_swift": "BSNS12345",
                "iban": "GB33BUKB20201555555555",
                "routing_number": "011000015",
                "country": "EC",
                "currency": "US Dollar",
                "account_type": "Savings",
                "bank_address": "Jr Junin 550",
                "additional_info": "Branch: Main"
            }
        ],
        "group_id": "8049cfed-c4fb-4114-8c69-457d405eeb10",
        "metadata": {}
    }
}

Step-by-Step Workflow: Sign-in

Create OPT

Once you already have the user registered, you can send the OTP by id, uid, or email of it

POST https://app.insurehero.io/api/shield/v1/users/:userId/otp

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

searchBy

email | id | uid | phone

Field use to search for a matching user. Default to "id"

Path Parameters

Name
Type
Description

userId*

string

Either user_id, uid, phone or email

Example Response

{
    "data": {
        "message": "Success! OTP sent to the user mail"
    }
}

Check OTP

Once the OTP is received, it must be validated to verify the ownership of the email. After registration, it can be sent via email, ID, or UID. The response will include a token, which you must use as a header with the key User-Authorization.

POST https://app.insurehero.io/api/shield/v1/users/:userId/verify-otp

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

searchBy

email | id | uid | phone

Field use to search for a matching user. Default to "id"

Path Parameters

Name
Type
Description

userId*

string

Either user_id, uid, phone or email

Request Body

Name
Type
Description

otp*

string

The OPT generated for the user

Example Response

{
    "data": {
        "message": "eybGciOiJIUzI1NiJ9.eyJiOiJmYzk0ZDRhMS1mODM0LtYTZiMODIzMzg5YzgiLCJpYXQiOjE3MjA1MzY5MzcsImV4cCI6MTcyMDU0MDUzN30.noGIvoYIRZiMMPw4WvHUUtkhzxS3ilvNyt7luU"
    }
}

Users

Get all the users

Get a list of all available users in your channel

GET https://app.insurehero.io/api/shield/v1/users

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

from*

number

Starting record index

to*

number

Ending record index

{
  "data": [
    {
      "id": "bb0259b1-6deb-46b0-b88b-44795e6bdcdf",
      "channel_id": "fc94d4a1-f834-481d-a6b2-138b823389c8",
      "email": "example3@acme.com",
      "first_name": "John",
      "last_name": "Smith",
      "phone": "0987654338",
      "uid": null,
      "gender": null,
      "dob": null,
      "address": null,
      "document_type": null,
      "document_number": null,
      "bank_accounts": null,
      "company_name": null,
      "company_role": null,
      "company_email": null,
      "company_identifier": null,
      "company_address": null,
      "company_bank_accounts": null,
      "group_id": null,
      "metadata": {"cool": true}
    }
  ]
}

Get a specific user

You can get a user using its uid or id.

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Path Parameters

Name
Type
Description

userId*

string

Either user_id or uid

Query Parameters

Name
Type
Description

searchBy

id | uid

Field use to search for a matching user. Default to 'id'

Or using its email.

GET https://api.insurehero.io/api/shield/v1/users/by-email/:userEmail

Path Parameters

Name
Type
Description

userEmail*

string

The user email

Example Response

{
    "data": {
        "id": "6e83de1e-af92-4604-99d8-eaf9f198e8a9",
        "channel_id": "fc94d4a1-f834-481d-a6b2-138b823389c8",
        "email": "john.doe@example.com",
        "first_name": "John PROD",
        "last_name": "Doe",
        "phone": "098 321 3123",
        "uid": "USER1",
        "gender": "MALE",
        "dob": "2024-04-01T05:00:00+00:00",
        "address": "Jr Junin 550",
        "document_type": "RUC",
        "document_number": "0931339568",
        "bank_accounts": [
            {
                "account_name": "John Doe",
                "bank_name": "Global Bank",
                "account_number": "2313213123123",
                "bic_swift": "GBL12345",
                "iban": "123123123",
                "routing_number": "011000138",
                "country": "3b67c9ca-fd42-4c37-a53b-8aabfc90ee10",
                "currency": "8d4ddf57-f5cf-4b03-83f9-97e9abb8ee13",
                "account_type": "Checking",
                "bank_address": "example",
                "additional_info": "example"
            }
        ],
        "company_name": "Doe Enterprises",
        "company_role": "Founder",
        "company_email": "john.doe@example.com",
        "company_identifier": {
            "type": "RUC",
            "value": "12312321321321"
        },
        "company_address": "Jr Junin 550",
        "company_bank_accounts": [
            {
                "account_name": "Doe Enterprises",
                "bank_name": "Business Bank",
                "account_number": "987654321",
                "bic_swift": "BSNS12345",
                "iban": "GB33BUKB20201555555555",
                "routing_number": "011000015",
                "country": "3b67c9ca-fd42-4c37-a53b-8aabfc90ee10",
                "currency": "8d4ddf57-f5cf-4b03-83f9-97e9abb8ee13",
                "account_type": "Savings",
                "bank_address": "Jr Junin 550",
                "additional_info": "Branch: Main"
            }
        ],
        "group_id": "8049cfed-c4fb-4114-8c69-457d405eeb10",
        "metadata": {}
    }
}

Groups

Create new group in a channel

POST https://app.insurehero.io/api/shield/v1/groups

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Request Body

Name
Type
Description

name*

string

Group name unique

description

string

Group description

bussiness_industry*

string

Bussiness industry

company_name

string

Group company name

company_role

string

Group company role

company_email

string

Group company email

company_identifier

CompanyIdentifierType

Group company identifier

company_address

json

The groups's company address information

company_bank_accounts

BankAccountType[]

The object fields are: account_name, bank_name, account_number, bic_swift, iba, routing_number, country, currency, account_type, bank_address and additional_info. All of type string. All of type string

uid

string

Asssign your unique identifier "yourUID01"

metadata

object

Additional data to include in the group

{
    "data": {
        "id": "47ac5ac7-48fa-448f-83a0-ac9cbdb50d2a",
        "name": "example-5",
        "description": "",
        "bussiness_industry": "CONSUMO MASIVO",
        "company_name": "Doe Enterprises",
        "company_role": "Founder",
        "company_email": "example@example.ec",
        "company_identifier": {
            "type": "CI",
            "value": "sadsad"
        },
        "company_address": "Jr Junin 550",
        "company_bank_accounts": [
            {
                "account_name": "Doe Enterprises",
                "bank_name": "Business Bank",
                "account_number": "987654321",
                "bic_swift": "BSNS12345",
                "iban": "GB33BUKB20201555555555",
                "routing_number": "011000015",
                "country": "PE",
                "currency": "Euro",
                "account_type": "Savings",
                "bank_address": "Jr Junin 550",
                "additional_info": "Branch: Main"
            },
            {
                "account_name": "Doe Enterprises",
                "bank_name": "Business Bank",
                "account_number": "987654321",
                "bic_swift": "BSNS12345",
                "iban": "GB33BUKB20201555555555",
                "routing_number": "011000015",
                "country": "EC",
                "currency": "US Dollar",
                "account_type": "Savings",
                "bank_address": "Jr Junin 550",
                "additional_info": "Branch: Main"
            }
        ],
        "uid": null,
        "metadata": {
            "additional_info": "Branch: Main"
        }
    }
}

CompanyIdentifierType

It is an object that has the following values

Type
Value

Type

string

Value

string

BankAccountType

It is an array of objects where each object can have the following values:

Value
Type

account_name

string

bank_name

string

account_number

string

bic_swift

string

iba

string

routing_number

string

country

string

currency

string

account_type

string

bank_address

string

additional_info

string

Get all the groups

Get a list of all available groups in your channel

GET https://app.insurehero.io/api/shield/v1/groups

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Query Parameters

Name
Type
Description

from*

number

Starting record index

to*

number

Ending record index

{
    "data": [
        {
            "id": "62c62277-3f28-4a73-8e93-021b4ax98cba",
            "name": "Group example",
            "description": "Description Example",
            "bussiness_industry": "Industry example",
            "company_name": "Example Inc",
            "company_role": "Example role",
            "company_email": "companyemail@mail.com",
            "company_identifier": "example-214",
            "company_address": "Route 53",
            "company_bank_accounts": 5235232362,
            "uid": "GROUPUID",
            "metadata": {}
        },
    ]
}

Register a user without OTP

To create a user directly, you will need to contact our support team. Once you have requested authorization and it has been granted, you will be provided with the specific instructions to carry out this action.

POST https://app.insurehero.io/api/shield/v1/users

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Request Body

Name
Type
Description

first_name*

string

User's first name

last_name*

string

User's last name

email*

string

User's email

phone*

string

User's phone number (Must be unique)

gender

string

MALE | FEMALE

dob

string

User's date of birth

address

json

The user's address information

document_type

string

The type of document can be: PASSPORT, RUC, CI and CURP

document_number

string

The user's document number

bank_accounts

BankAccountType[]

User bank accounts

company_name

string

User company name

company_role

string

User company role

company_email

string

User company email

company_identifier

CompanyIdentifierType

User company identifier

company_address

json

The user's company address information

company_bank_accounts

BankAccountType[]

The object fields are the same fields as bank_accounts

uid

string

Additional user's unique identifier in your system. You will be able to use it to search for a user later

group_id

string

The id of the group a user should belong to

metadata

object

Additional data to include in the user record.

Example Response

{
    "data": {
        "id": "5fd3b337-a10a-4388-bd63-40a0cb0361cf",
        "channel_id": "fc94d4a1-f834-481d-a6b2-138b823389c8",
        "email": "example-6@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "phone": "098 391 3123",
        "uid": null,
        "gender": "MALE",
        "dob": "2024-04-01T05:00:00+00:00",
        "address": "Jr Junin 550",
        "document_type": "RUC",
        "document_number": "0931339568",
        "bank_accounts": [
            {
                "account_name": "John Doe",
                "bank_name": "Global Bank",
                "account_number": "2313213123123",
                "bic_swift": "GBL12345",
                "iban": "123123123",
                "routing_number": "011000138",
                "country": "EC",
                "currency": "US Dollar",
                "account_type": "Checking",
                "bank_address": "example",
                "additional_info": "example"
            }
        ],
        "company_name": "Doe Enterprises",
        "company_role": "Founder",
        "company_email": "example@example.com",
        "company_identifier": {
            "type": "RUC",
            "value": "12312321321321"
        },
        "company_address": "Jr Junin 550",
        "company_bank_accounts": [
            {
                "account_name": "Doe Enterprises",
                "bank_name": "Business Bank",
                "account_number": "987654321",
                "bic_swift": "BSNS12345",
                "iban": "GB33BUKB20201555555555",
                "routing_number": "011000015",
                "country": "EC",
                "currency": "US Dollar",
                "account_type": "Savings",
                "bank_address": "Jr Junin 550",
                "additional_info": "Branch: Main"
            }
        ],
        "group_id": "8049cfed-c4fb-4114-8c69-457d405eeb10",
        "metadata": {}
    }
}

Last updated