For the complete documentation index, see llms.txt. This page is also available as Markdown.

User management

Endpoints

All error responses use the { "error": string, "details": any } envelope. The examples on this page show the most common cases for each endpoint; see Error Handling for the general format, including unexpected internal errors, which return 422 with an event_id you can share with support.

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 searchBy query parameter with the value email (the OTP is sent by email) or phone (the OTP is sent via WhatsApp). If no user exists in your channel with that email or phone, a pre-registered user is created.

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.

OTP rules

  • The OTP is a 6-digit code, valid for 15 minutes.

  • Each new request replaces the previous code and resets the verification attempts.

  • A user can request up to 10 OTPs within 60 minutes. Further requests return 422 with details "OTP request limit exceeded" and no code is sent.

  • Each code allows 3 verification attempts. After the third failed attempt the code is invalidated (even the correct code returns Invalid OTP) and a new OTP must be requested.

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 used to find the user, or to create a pre-registered user if none exists. email sends the OTP by email; phone sends it via WhatsApp.

Path Parameters

Name
Type
Description

userId*

string

Email or phone

Example Response

When searchBy=phone and the user already exists, the message is "Success! OTP sent via WhatsApp". If the WhatsApp message cannot be sent, the endpoint returns 422 with details "Failed to send OTP via WhatsApp".

Attributes

Name
Type
Description

data

object

Object containing the response details.

message

string

Confirmation message indicating that the OTP has been sent successfully to the user's email or via WhatsApp.

Check OTP

Once the OTP is received, you must verify it to confirm the ownership of the email or phone. The response includes a user token, but a pre-registered user still needs to be registered (next step) before making 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 used to find the user. Use the same value you used to request the OTP. Emails are matched exactly, so send them in lowercase.

Path Parameters

Name
Type
Description

userId*

string

Email or phone

Request Body

Name
Type
Description

otp*

string

The OTP generated for the user

Example Response

Invalid OTP is returned when the code is wrong, when there is no active code, or after 3 failed attempts. additionalData is only included when the user has not been registered yet (no first_name). If the user has neither email nor phone, the endpoint returns 400 with details "User without email or phone".

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 | id | uid | phone

Field used to find the user to update. Default to "id". In the sign-up flow, use email (or phone if the OTP was sent via WhatsApp).

Path Parameters

Name
Type
Description

userId*

string

Either user_id, uid, phone or email, according to searchBy

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).

email

string

User's email (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. Required key; send null if you do not use it.

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

If group_id does not belong to a group of your channel, or a bank account country or currency cannot be resolved, the endpoint returns 404. A duplicated email, phone or uid returns 422 with the database error, for example { "code": "P0001", "message": "User emails must be unique", "details": null, "hint": null }.

Additional attributes

Name
Type
Description

data

object

Main container that holds all user information.

id

uuid

Unique identifier of the user.

channel_id

string

Identifier of the channel.

account_name

string

Name of the bank account holder.

bank_name

string

Name of the bank.

account_number

string

Bank account number.

bic_swift

string

SWIFT or BIC code of the bank.

iban

string

IBAN (International Bank Account Number).

routing_number

string

Routing number for the bank.

country

string

Country where the bank account is held (ISO code).

currency

string

Currency type for the bank account (currency name).

account_type

string

Type of bank account.

bank_address

string

Address of the bank branch.

additional_info

string

Any additional information regarding the bank account.

type

string

Type of company identifier.

value

string

The actual identifier value.

Step-by-Step Workflow: Sign-in

Create OPT

Once you already have the user registered, you can send the OTP by id, uid, email or phone of it. With phone, the OTP is sent via WhatsApp; otherwise it is sent to the user's email. The OTP rules described above apply.

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

The 404 is returned with searchBy=uid when no user matches. With searchBy=id, a user that does not exist returns 422 with the database error PGRST116. With searchBy=email or searchBy=phone, a user that does not exist is created as pre-registered, as in the sign-up flow.

Attributes

Name
Type
Description

data

object

Object containing the response details.

message

string

Confirmation message indicating the OTP was successfully sent to the user’s email or via WhatsApp.

Check OTP

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

The user token is valid for 1 hour. It is only accepted in the User-Authorization header when creating claims (POST /v1/claims, POST /v2/claims) and in claim workflow steps. It is not an access token: sending it as Authorization: Bearer on any endpoint returns 401.

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". Emails are matched exactly, so send them in lowercase.

Path Parameters

Name
Type
Description

userId*

string

Either user_id, uid, phone or email

Request Body

Name
Type
Description

otp*

string

The OTP generated for the user

Example Response

Invalid OTP is returned when the code is wrong, when there is no active code, or after 3 failed attempts; in the last case, request a new OTP.

Attributes

Name
Type
Description

data

object

Object containing the validation result.

message

string

A user token returned after successful OTP validation, valid for 1 hour. This token must be used in the request header as User-Authorization.

additionalData

string

Only present when the user has not been registered yet: This user needs to be registered before making a claim.

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. Must be greater than from, at most from + 100

Attributes

Name
Type
Description

data

object

Main container that holds all user information.

id

uuid

Unique identifier of the user.

channel_id

uuid

Identifier of the channel.

email

string

Email of user.

first_name

string

User's first name.

last_name

string

User's last name.

phone

string

User's phone number (Must be unique).

uid

string

Additional user's unique identifier in your system.

gender

string

MALE | FEMALE.

dob

string

User's date of birth.

address

string

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

string

User bank accounts.

company_name

string

User company name.

company_role

string

User company role.

company_email

string

User company email.

company_identifier

string

User company identifier.

company_address

string

The user's company address information.

company_bank_accounts

string

The object fields are the same fields as bank_accounts.

group_id

uuid

The id of the group;

metadata

object

Additional data to include in the user record.

Get a specific user

You can get a user using its id, uid, email, phone or document number.

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

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Path Parameters

Name
Type
Description

userId*

string

Either user_id, uid, email, phone or document number, according to searchBy

Query Parameters

Name
Type
Description

searchBy

id | uid | email | phone | document_number

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

Or using its email.

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

Path Parameters

Name
Type
Description

userEmail*

string

The user email

Example Response

Attributes

Name
Type
Description

data

object

Main container that holds all user information.

id

uuid

Unique identifier of the user.

channel_id

string

Identifier of the channel.

account_name

string

Name of the bank account holder.

bank_name

string

Name of the bank.

account_number

string

Bank account number.

bic_swift

string

SWIFT or BIC code of the bank.

iban

string

IBAN (International Bank Account Number).

routing_number

string

Routing number for the bank.

country

string

Country where the bank account is held.

currency

string

Currency type for the bank account.

account_type

string

Type of bank account.

bank_address

string

Address of the bank branch.

additional_info

string

Any additional information regarding the bank account.

type

string

Type of company identifier.

value

string

The actual identifier value.

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, iban, routing_number, country, currency, account_type, bank_address and additional_info. All of type string.

uid*

string

Asssign your unique identifier "GRP-0001". Required key; send null if you do not use it

metadata

object

Additional data to include in the group

If a bank account country or currency cannot be resolved, the endpoint returns 404 (for example, details "Currency not found: XYZ").

CompanyIdentifierType

It is an object that has the following values

Type
Value

Type

string (PASSPORT, RUC, CI or CURP)

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

iban

string

routing_number

string

country

string

currency

string

account_type

string

bank_address

string

additional_info

string

All fields are required except additional_info. Send country as a country name or ISO code (for example EC) and currency as a currency code (for example USD). Create and update responses return the country ISO code and the currency name; GET responses return the stored identifiers.

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. Must be greater than from, at most from + 100

Attributes

Name
Type
Description

data

array

Main container that holds all group information.

id

uuid

Unique identifier for the group.

name

string

Name of the group.

description

string

Description of the group.

bussiness_industry

string

Industry to which the group belongs. Can be an empty string.

company_name

string

Name of the company associated with the group.

company_role

string

Role of the company.

company_email

string

Contact email of the company.

company_identifier

CompanyIdentifierType

Identifier of the company.

company_address

string

Address of the company.

company_bank_accounts

BankAccountType[]

Bank accounts associated with the company.

uid

string

Unique identifier for the group within the system.

metadata

object

Additional metadata related to the group.

Get a specific group

Get a group of your channel by its id or its uid.

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

Headers

Name
Type
Description

Authorization*

string

Bearer access token

Path Parameters

Name
Type
Description

groupId*

string

The group id, or its uid when searchBy=uid.

Query Parameters

Name
Type
Description

searchBy

id | uid

Field used to search for the group. Default id.

Example Response

The group does not exist in your channel:

A searchBy value other than id or uid returns an input validation error. See Error Handling.

Attributes

Same fields as in Get all the groups, in a single object in data.

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. Until then, this endpoint returns 401 with details "This channel does not allow hand-shake register".

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 (Must be unique). Required key; can be null

phone*

string

User's phone number (Must be unique). Required key; can be null

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. Required key; send null if you do not use it

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

Attributes

Name
Type
Description

data

object

Main container that holds all user information.

id

uuid

Unique identifier of the user.

channel_id

string

Identifier of the channel.

account_name

string

Name of the bank account holder.

bank_name

string

Name of the bank.

account_number

string

Bank account number.

bic_swift

string

SWIFT or BIC code of the bank.

iban

string

IBAN (International Bank Account Number).

routing_number

string

Routing number for the bank.

country

string

Country where the bank account is held (ISO code).

currency

string

Currency type for the bank account (currency name).

account_type

string

Type of bank account.

bank_address

string

Address of the bank branch.

additional_info

string

Any additional information regarding the bank account.

type

string

Type of company identifier.

value

string

The actual identifier value.

Last updated