Clients
As the name suggests, clients are a core part of RiskAdvisor — the very reason RiskAdvisor exists is so you can have conversations with your clients. On this page, we'll dive into the different client endpoints you can use to manage clients programmatically. We'll look at how to query, create, update, and delete clients.
The client model
The client model contains all the information about your clients, such as their name, phone number, and email. It also contains a reference to the risk profiles between you and the client.
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the client.
- Name
first_name
- Type
- string
- Description
The first name of the client.
- Name
middle_name
- Type
- string
- Description
The middle name of the client.
- Name
last_name
- Type
- string
- Description
The last name of the client.
- Name
suffix
- Type
- string
- Description
The suffix of the client.
- Name
date_of_birth
- Type
- date
- Description
The date of birth of the client.
- Name
phone_number
- Type
- string
- Description
The phone number for the client.
- Name
email
- Type
- string
- Description
The email address of the client.
- Name
contact_preference
- Type
- string
- Description
The client's preferred contact method (i.e. phone or email).
- Name
gender
- Type
- string
- Description
The client's gender.
- Name
education
- Type
- timestamp
- Description
The client's education level.
- Name
occupation
- Type
- timestamp
- Description
The client's occupation.
List all clients
This endpoint allows you to retrieve a paginated list of all your clients. By default, a maximum of ten clients are shown per page.
Optional attributes
- Name
limit
- Type
- integer
- Description
Limit the number of clients returned.
Request
curl -G https://app.riskadvisor.insure/api/clients \
-H "Authorization: Bearer {token}" \
-d active=true \
-d limit=10
Response
{
"has_more": false,
"data": [
{
"id": "WAz8eIbvDR60rouK",
"username": "FrankMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.RiskAdvisor.chat/avatars/frank.jpg",
"display_name": null,
"conversation_id": "xgQQXg3hrtjh7AvZ",
"last_active_at": 705103200,
"created_at": 692233200
},
{
"id": "hSIhXBhNe8X1d8Et"
// ...
}
]
}
Create a client
This endpoint allows you to add a new client to your client list in RiskAdvisor. To add a client, you must provide their RiskAdvisor username and phone number.
Required attributes
- Name
first_name
- Type
- string
- Description
The first name of the client.
- Name
last_name
- Type
- string
- Description
The last name of the client.
- Name
phone_number
- Type
- string
- Description
The phone number for the client.
- Name
email
- Type
- string
- Description
The email address of the client.
Optional attributes
- Name
middle_name
- Type
- string
- Description
The middle name of the client.
- Name
suffix
- Type
- string
- Description
The suffix of the client.
- Name
date_of_birth
- Type
- date
- Description
The date of birth of the client.
- Name
contact_preference
- Type
- string
- Description
The client's preferred contact method (i.e. phone or email).
- Name
gender
- Type
- string
- Description
The client's gender.
- Name
education
- Type
- timestamp
- Description
The client's education level.
- Name
occupation
- Type
- timestamp
- Description
The client's occupation.
Request
curl https://app.riskadvisor.insure/api/clients \
-H "Authorization: Bearer {token}" \
-d first_name="Frank" \
-d last_name="McCallister" \
-d phone_number="1-800-876-5309" \
-d email="[email protected]"
Response
{
"id": "WAz8eIbvDR60rouK",
"first_name": "FrankMcCallister",
"last_name": "FrankMcCallister",
"phone_number": "1-800-876-5309",
"email": "[email protected]"
}
Retrieve a client
This endpoint allows you to retrieve a client by providing their RiskAdvisor id. Refer to the list at the top of this page to see which properties are included with client objects.
Request
curl https://app.riskadvisor.insure/api/clients/WAz8eIbvDR60rouK \
-H "Authorization: Bearer {token}"
Response
{
"id": "WAz8eIbvDR60rouK",
"first_name": "Frank",
"last_name": "McCallister",
"phone_number": "1-800-876-5309",
"email": "[email protected]"
}
Update a client
This endpoint allows you to perform an update on a client. Currently, the only attributes that can be updated on clients are the same ones required to create a client.
Required attributes
- Name
first_name
- Type
- string
- Description
The first name of the client.
- Name
last_name
- Type
- string
- Description
The last name of the client.
- Name
phone_number
- Type
- string
- Description
The phone number for the client.
- Name
email
- Type
- string
- Description
The email address of the client.
Optional attributes
- Name
middle_name
- Type
- string
- Description
The middle name of the client.
- Name
suffix
- Type
- string
- Description
The suffix of the client.
- Name
date_of_birth
- Type
- date
- Description
The date of birth of the client.
- Name
contact_preference
- Type
- string
- Description
The client's preferred contact method (i.e. phone or email).
- Name
gender
- Type
- string
- Description
The client's gender.
- Name
education
- Type
- timestamp
- Description
The client's education level.
- Name
occupation
- Type
- timestamp
- Description
The client's occupation.
Request
curl -X PUT https://app.riskadvisor.insure/api/clients/WAz8eIbvDR60rouK \
-H "Authorization: Bearer {token}" \
-d phone_number="1-800-555-1212"
Response
{
"id": "WAz8eIbvDR60rouK",
"first_name": "Frank",
"last_name": "McCallister",
"phone_number": "1-800-555-1212",
"email": "[email protected]"
}
Delete a client
This endpoint allows you to delete clients from your client list in RiskAdvisor. Note: This will also delete your risk profiles with the given client.
Request
curl -X DELETE https://app.riskadvisor.insure/api/clients/WAz8eIbvDR60rouK \
-H "Authorization: Bearer {token}"