REST API: Leads
Using the Leads REST API, you can create, search, update and view the full detail of Sales Records within your AMS+ account.
Lead Resources
Create
RESOURCE URI
https://app.agencybloc.com/api/v1/salesEnablement/leads/create
REQUIRED POST PARAMETERS
You must POST the following parameters via the body of the request. Parameters found in the querystring of the request will be ignored:
Parameter | Description |
---|---|
first_name | The first name of the new Sales Record that is being created in your AMS+ account. |
last_name | The last name of the new Sales Record that is being created in your AMS+ account. |
ADDITIONAL POST PARAMETERS
You may also POST any of the following parameters:
Parameter | Description |
---|---|
middle_name |
The middle name of the new Sales Record that is being created. |
title |
The title for the new Sales Record that is being created. |
nickname |
The nickname of the new Sales Record that is being created. |
date_of_birth |
The birth date of the new Sales Record that is being created. |
social_security_number | The social security number of the new Sales Record that is being created. |
drivers_license_number | The driver's license number of the new Sales Record that is being created. |
med_beneficiary_number | The Medicare Beneficiary ID (MBI) of the new Sales Record that is being created. |
med_effective_date_part_a | The Medicare Part A Effective Date of the new Sales Record that is being created. |
med_effective_date_part_b | The Medicare Part B Effective Date of the new Sales Record that is being created. |
gender |
The gender of the new Sales Record that is being created. |
smoker_status | The smoker/tobacco status for the new Sales Record that is being created, 'Yes' or 'No'. |
The email of the new Sales Record that is being created. | |
secondary_email | The secondary email of the new Sales Record that is being created. |
coverage_type* | The coverage of the new Sales Record that is being created. |
status_id* or status* | The status of the new Sales Record that is being created. |
lead_source_id* or lead_source* | The lead source of the new Sales Record that is being created. |
When sending gender via POST, please format using Male
for a male or Female
for a female. When sending email field via POST, please ensure that all email addresses are formatted as name@example.com
. When sending dates via POST, please ensure that the dates are formatted as 01/01/2013
.
You may also POST phone numbers for the new Sales Record using these parameters:
Parameter | Description |
---|---|
phone | The phone number of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
cellphone |
The cell phone number of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
When sending phone numbers via POST, we recommend that all phone numbers are formatted as (319) 555-0000
.
You may also POST address information for the new Sales Record using these parameters:
Parameter | Description |
---|---|
address |
The first line of the address of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
city | The city of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
county | The county of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
state |
The state of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. Two-char state code is preferred; if full name is provided e.g. “Iowa”, will be converted to two-char code “IA”. Required for populating the county. |
zip |
The zip code of the new Sales Record that is being created. This value will be displayed in the 'Information' tab of the new Sales Record. |
You may also POST agent information for the new Sales Record using these parameters:
Parameter | Description |
---|---|
assigned_ab_agent_id* or agent |
The assigned user of the new Sales Record that is being created.
|
* To get the corresponding 'Agent ID' from AMS+, you will need to get the unique identifier used within AMS+. To get this value you will need to navigate to the 'Agent Detail' screen within AMS+. Once you have reached that page you can get the value from the URL:
https://app.agencybloc.com/agents/######/detail
The assigned_ab_agent_id' used by AMS+ is represented by the ######
in the link above. By sending this value via POST, the API will assign the corresponding agent's linked user to the new Sales Record being created.
Note: If you’re on the Scale Package, you can use Sales Workflows to trigger Lead Routing Rules to assign agents to new Sales Records created by the Lead POST. Posting the word “Auto” in the first name field and leaving the last name field blank will trigger Lead Routing Rules.
Custom Fields
The REST API allows access to the custom fields inside your account when creating a new Sales Record. To obtain the name values for the custom fields, you will need to access the custom fields page below.
https://app.agencybloc.com/settings/custom-fields/Individual/list
By selecting the entity type from the dropdown, you will see the list of that entity's custom fields. All names must be lowercase, but otherwise match exactly what is listed on the page.
For Checkbox List custom fields, you can only send one value currently. For Checkbox fields, you need to provide either "true" or "false".
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully creating a new Sales Record inside your AMS+ account, you will get a return status of 200 along with the record_id as seen below.
{ "Agencybloc Response": { "Status":"200", "record_id":"123456", "Action":"create" } }
Search
RESPONSE URI
https://app.agencybloc.com/api/v1/salesEnablement/leads/searchphone
REQUIRED POST PARAMETERS
Phone number is a required POST parameter for searching.
ADDITIONAL POST PARAMETERS
You may POST any of the following parameters to search for a Sales Record:
Parameter | Description |
---|---|
PhoneNumberSearchQuery |
The phone number of the Sales Record being searched. |
RESPONSE
The response will be a list of Sales Records matching your criteria in JSON format.
[ { "type":"My Lead", "name":"Aedion Asher", "address":"", "email":"", "city":"", "state":"IA", "zip":"", "county":null”, "phone":"1234567890", "cell":"", "coverage_type":null”, "temperature":"Cold", "status":"Quoting", "record_id":3983”, "create_date":"2024-01-30T09:27:01.000-07:00", "last_update":"2024-02-15T09:55:00.000-07:00", "assigned_user":"Unassigned", "date_of_birth":null”, "height":"", "weight":null”, "gender":"", "tags":"”, "facebook_username":"", "twitter_username":"", "linkedin_username":"", "unsubscribe":"No", "notes": [ "Notes body" ], "med_effective_date_part_a":null”, "med_effective_date_part_b":null”, "custom_fields": { "checkbox":"false" }, "products": [ "carrier":"ACA Carrier", "product":null, "status":"Active", "coverage_type":"Life", "premium":null, "policy_no":"", "customer_number":"", "effective_date":null, "renewal_date":null, "created_at":"2024-02-13T10:32:11.000-07:00", "updated_at":"2024-02-13T10:32:11.000-07:00", "id":370, "record_id":3588, "record_type":"Lead",
"type":"LeadProduct", ] } ]
Detail
RESOURCE URI
https://app.agencybloc.com/api/v1/salesEnablement/Leads/detail
REQUIRED POST PARAMETERS
Parameter | Description |
---|---|
record_id | The record_id returned from the search response. |
RESPONSE
The response will be the full detail of the Sales Record selected and include all addresses associated with a Sales Record.
{ "type":"My Lead", "name":"Aedion Asher", "address":"", "email":"", "city":"", "state":"IA", "zip":"", "county":null”, "phone":"1234567890", "cell":"", "coverage_type":null”, "temperature":"Cold", "status":"Quoting", "record_id":3983”, "create_date":"2024-01-30T09:27:01.000-07:00", "last_update":"2024-02-15T09:55:00.000-07:00", "assigned_user":"Unassigned", "date_of_birth":null”, "height":"", "weight":null”, "gender":"", "tags":"”, "facebook_username":"", "twitter_username":"", "linkedin_username":"", "unsubscribe":"No", "notes": [ "Notes body" ], "med_effective_date_part_a":null”, "med_effective_date_part_b":null”, "custom_fields": { "checkbox":"false" }, "products": [ "carrier":"ACA Carrier", "product":null, "status":"Active", "coverage_type":"Life", "premium":null, "policy_no":"", "customer_number":"", "effective_date":null, "renewal_date":null, "created_at":"2024-02-13T10:32:11.000-07:00", "updated_at":"2024-02-13T10:32:11.000-07:00", "id":370, "record_id":3588, "record_type":"Lead",
"type":"LeadProduct", "Custom_fields":
{
"Name":"Value",
"Name (multi-select)":[
"Option 1",”Option 2”
]
}
}
]
}
Update
RESPONSE URL
https://app.agencybloc.com/api/v1/salesEnablement/leads/update
REQUIRED POST PARAMETERS
You must POST the following parameters via the body of the request. Parameters found in the querystring of the request will be ignored:
Parameter | Description |
---|---|
record_id | The record_id of the Sales Record that is being updated. |
ADDITIONAL POST PARAMETERS
You may also POST any of the following parameters:
Parameter | Description |
---|---|
first_name | The first name of the new Sales Record that is being updated in your AMS+ account. |
last_name | The last name of the new Sales Record that is being updated in your AMS+ account. |
middle_name |
The middle name of the new Sales Record that is being updated. |
title |
The title for the new Sales Record that is being updated. |
nickname |
The nickname of the new Sales Record that is being updated. |
date_of_birth |
The birth date of the new Sales Record that is being updated. |
social_security_number | The social security number of the new Sales Record that is being updated. |
drivers_license_number | The driver's license number of the new Sales Record that is being updated. |
med_beneficiary_number | The Medicare Beneficiary ID (MBI) of the new Sales Record that is being updated. |
med_effective_date_part_a | The Medicare Part A Effective Date of the new Sales Record that is being updated. |
med_effective_date_part_b | The Medicare Part B Effective Date of the new Sales Record that is being updated. |
gender |
The gender of the new Sales Record that is being updated. |
smoker_status | The smoker/tobacco status for the new Sales Record that is being updated, 'Yes' or 'No'. |
The email of the new Sales Record that is being updated. | |
secondary_email | The secondary email of the new Sales Record that is being updated. |
coverage_type* | The coverage of the new Sales Record that is being updated. |
status_id* or status* | The status of the new Sales Record that is being updated. |
lead_source_id* or lead_source* | The lead source of the new Sales Record that is being updated. |
When sending gender via POST, please format using Male
for a male or Female
for a female. When sending email field via POST, please ensure that all email addresses are formatted as name@example.com
. When sending dates via POST, please ensure that the dates are formatted as 01/01/2013
.
You may also POST phone numbers for the Sales Record using these parameters:
Parameter | Description |
---|---|
phone | The phone number of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
cellphone |
The cell phone number of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
When sending phone numbers via POST, we recommend that all phone numbers are formatted as (319) 555-0000
.
You may also POST address information for the Sales Record using these parameters:
Parameter | Description |
---|---|
address |
The first line of the address of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
city | The city of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
county | The county of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
state |
The state of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. Two-char state code is preferred; if full name is provided e.g. “Iowa”, will be converted to two-char code “IA”. Required for populating the county. |
zip |
The zip code of the Sales Record that is being updated. This value will be displayed in the 'Information' tab of the Sales Record. |
You may also POST agent information for the Sales Record using these parameters:
Parameter | Description |
---|---|
assigned_ab_agent_id* or agent |
The assigned user of the Sales Record that is being updated.
|
* To get the corresponding 'Agent ID' from AMS+, you will need to get the unique identifier used within AMS+. To get this value you will need to navigate to the 'Agent Detail' screen within AMS+. Once you have reached that page you can get the value from the URL:
https://app.agencybloc.com/agents/######/detail
The 'Agent ID' used by AMS+ is represented by the ######
in the link above. By sending this value via POST, the API will assign the corresponding agent's linked user to the Sales Record being updated.
Note: If you’re on the Scale Package, you can use Sales Workflows to trigger Lead Routing Rules to assign agents to new Sales Records created by the Lead POST. Posting the word “Auto” in the first name field and leaving the last name field blank will trigger Lead Routing Rules.
Custom Fields
The REST API allows access to the custom fields inside your account when updating a Sales Record. To obtain the name values for the custom fields, you will need to access the custom fields page below.
https://app.agencybloc.com/settings/custom-fields/Individual/list
By selecting the entity type from the dropdown, you will see the list of that entity's custom fields. All names must be lowercase, but otherwise match exactly what is listed on the page.
For Checkbox List custom fields, you can only send one value currently. For Checkbox fields, you need to provide either "true" or "false".
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully updating a Sales Record inside your AMS+ account, you will get a return status of 200.
{ "Agencybloc Response": { "Status":"200", "record_id":"123456", "Action":"update" } }
Exception Responses
The exception responses will include status, title, and message and be in JSON format.
{ "Agencybloc Response": { "Exception": { "Status":"Status Code", "Title":"Title of Error", "Message":"Error Message" } } }