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

Query Parameters

Path Parameters

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

Query Parameters

Path Parameters

Request Body

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

Query Parameters

Path Parameters

Request Body

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

Query Parameters

Path Parameters

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

Query Parameters

Path Parameters

Request Body

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

Query Parameters

{
  "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

Path Parameters

Query Parameters

Or using its email.

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

Path Parameters

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

Request Body

{
    "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

BankAccountType

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

Get all the groups

Get a list of all available groups in your channel

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

Headers

Query Parameters

{
    "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

Request Body

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