REST API: Agents
Using the Agents REST API, you can create, search, update and view the full detail of agents within your AMS+ account.
When creating or updating field values that use a checkbox list or dropdown with user-defined values in Data & Custom Fields via API request, please note that any new values that did not previously exist will be automatically added.
Agent Resources
Create
RESOURCE URI
https://app.agencybloc.com/api/v1/agents/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 |
---|---|
lastName | The last name of the new agent that is being created in your AMS+ account. |
firstName | The first name of the new agent that is being created in your AMS+ account. |
ADDITIONAL POST PARAMETERS
You may also POST any of the following parameters:
Parameter | Description |
---|---|
middleInitial | The middle initial of the new agent that is being created in your AMS+ account. |
nickName | The nickname of the new agent that is being created in your AMS+ account. |
birthDate | The birth date of the new agent that is being created in your AMS+ account. |
ssn | The social security number of the new agent being created in your AMS+ account. |
The email of the new agent being created in your AMS+ account. | |
secondaryEmail | The secondary email of the new agent being created in your AMS+ account. |
status* | The status of the new agent being created in your AMS+ account. This value will populate the 'Status' dropdown within the 'Agent Detail' section of the new agent being created. |
type* | The type of the new agent being created in your AMS+ account. This value will populate the 'Type' dropdown within the 'Agent Detail' section of the new agent being created. |
classification* | The classification of the new agent being created in your AMS+ account. This value will populate the 'Classification' dropdown within the 'Agent Detail' section of the new agent being created. |
leadSource* | The leadSource of the new agent being created in your AMS+ account. This value will populate the 'Lead Source' dropdown within the 'Lead' section of the new agent being created. |
leadSourceOther | The leadSourceOther of the new agent being created in your AMS+ account. This value will populate the 'Other Lead Source' textbox within the 'Lead' section of the new agent being created. |
businessName | The businessName of the new agent being created in your AMS+ account. This value will populate the 'Business Name' textbox within the 'Lead' section of the new agent being created. |
npn | The npn of the new agent being created in your AMS+ account. This value will populate the 'NPN' textbox within the 'Lead' section of the new agent being created. |
agencyName | The name of the agency that the new agent will be associated to. If no agencies with the provided name exist, a new agency will be created. |
agentNumber | The agent number listed in the association between the agent and agency. You MUST have the agency name to bring in the agent's number. |
When sending gender via POST, please format using M
for a male or F
for a female. When sending email 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 agent using these parameters:
Parameter | Description |
---|---|
homePhone | The home phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
cellPhone | The cell phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
businessPhone | The business phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
agencyBusPhone | The business phone number of the agency associated to the agent. You MUST have the agency name to bring in the agency's business phone number. |
When sending phone numbers via POST, please ensure that all phone numbers are formatted as (319) 555-0000
.
You may also POST address information for the new agent using these parameters:
Note: You can also create, update and delete addresses using the Addresses API.
Parameter | Description |
---|---|
addrType* | The address type of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
street1 | The first line of the address of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
street2 | The second line of the address of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
city | The city of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
stateAbbrev | The state abbreviation of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
zip | The zip code of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
Custom Fields
The REST API allows access to the custom fields inside your account when creating a new agent. In order to pass custom fields via the REST API, you will need to preface the names of the custom fields inside your account with 'custom_'. 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/agent/list
By selecting the entity type from the dropdown, you will see the list of that entity's custom fields. All names must match exactly what is listed on the page, along with the preface of 'custom_'.
Note: When passing custom field data for Checkbox List custom fields, multiple values need to be separated by ||. For example, “option 1||option 2”.
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully creating a new agent inside your AMS+ account, you will get a return status of 200 along with the agentID as seen below.
{ "Agencybloc Response": { "Status":"200", "agentID":"123456", "Action":"create" } }
Search
RESOURCE URI
https://app.agencybloc.com/api/v1/agents/search
REQUIRED POST PARAMETERS
There no required POST parameters for searching. However, if you do not include any parameters the results are limited to 50 agents.
ADDITIONAL POST PARAMETERS
You may POST any of the following parameters to search for an agent:
Parameter | Description |
---|---|
firstName | The first name of the agent being searched. |
lastName | The last name of the agent being searched. |
middleInitial | The middle initial of the agent being searched. |
birthDate | The birth date of the agent being searched. |
ssn | The social security number of the agent being searched. |
The email of the agent being searched. | |
secondaryEmail | The secondary email of the agent being searched. |
homePhone | The home phone number of the agent being searched. |
cellPhone | The cell phone number of the agent being searched. |
businessPhone | The business phone number of the agent being searched. |
anyPhone | Pass this parameter in to search all phone numbers (home, cell, business). |
limit | Pass in the limit parameter for a custom number of results. a If limit isn't present, defaults to show 50 results. If limit is 0, returns all results. |
RESPONSE
The response will be a list of agents matching your criteria in JSON format.
The detail_url is the url that can be used to retrieve the full detail of the agent.
[ { "agentID":123456, "firstName":"Example", "middleInitial":"M", "lastName":"Example", "email":"example@example.com", "secondaryEmail":"example2@example2.com", "birthDate":"1111-11-11T00:00:00", "ssn":"123-45-6789",
"homePhone":"(555) 555-5555",
"businessPhone":"(444) 444-4444",
"cellPhone":"(333) 333-3333", "detailURL":"https://app.agencybloc.com/api/v1/agents/detail" }, { "agentID":54321, "firstName":"Example", "middleInitial":"M","lastName":"Example", "email":"example@example.com", "secondaryEmail":"example2@example2.com", "birthDate":"1111-11-11T00:00:00", "ssn":"123-45-6789","detailURL":"https://app.agencybloc.com/api/v1/agents/detail"
"homePhone":"(555) 555-5555",
"businessPhone":"(444) 444-4444",
"cellPhone":"(333) 333-3333", } ]
Detail
RESOURCE URI
https://app.agencybloc.com/api/v1/agents/detail
REQUIRED POST PARAMETERS
Parameter | Description |
---|---|
agentID | The agentID returned from the search response |
ADDITIONAL POST PARAMETERS
You may POST the following parameter to include activities for an agent:
Parameter | Description |
---|---|
includeActivities | Includes all activities associated with the agent in the response. |
When sending includeActivities via POST, please format using 1 to include activities. Not passing in includeActivities or formatting using 0 will not return activities.
RESPONSE
The response will be the full detail of the agent selected and include all addresses associated with the agent.
{ "agentID":123456, "firstName":"Example", "middleInitial":"J", "lastName":"Example", "nickname":"example", "email":"example@example.com", "secondarEmail":"example2@example2.com", "birthDate":"1111-11-11T00:00:00", "ssn":"123456789", "leadSource":"example", "leadSourceOther":"example", "businessName": "example", "npn": 0, "status":"example", "type":"example", "classification":"example", "homePhone":"(555) 555-5555", "homePhoneExt":"", "businessPhone":"(444) 444-4444", "businessPhoneExt":"", "cellPhone":"(333) 333-3333", "cellPhoneExt":"", "agencies": [ { "AgentNumID": 87055, "AgencyID": 3191, "AgentNumber": "123ABC", "Active": 1 } ], "addresses": [ { "addressID":1111, "entityID":123456, "entityType":"agent", "addressType":"Business", "street1":"122 Test St", "street2":"", "city":"Cedar Falls", "stateAbbrev":"IA", "zip":"50613"}, { "address_id":22222, "entityID":123456, "entityType":"agent", "addressType":"Home", "street1":"123 Example St.", "street2":"", "city":"Cedar Falls", "stateAbbrev":"IA", "zip":"50613"} ], "activities":[ { "activity_id":1111, "activity_date":"2019-01-21", "subject":"Lorem Ipsum", "notes":"Lorem ipsum dolor sit amet.", "status":"In Progress", "type":"Renewal", "method":"Email", "priority":"Medium", "related_policy_id":0, "FU_user_id":0, "FU_user_first_name":"Firstname", "FU_user_last_name":"Lastname", "FU_team_name":"Team Name", "followup_allday":0, "FU_date":"2019-01-01", "FU_UTC_start_time":"14:00:00", "FU_UTC_end_time":"15:00:00" } ], "customFields": [ { "Name": "Custom Field 1", "Value": [ "Example" ] }, { "Name": "Custom Field 2 (Multi-Select)", "Value": [ "option 1||option 2" ] } ] }
Note: If you want the full follow-up date and time, you will need to concatenate FU_date with the corresponding FU_UTC start/end time when consuming the API.
Update
RESOURCE URI
https://app.agencybloc.com/api/v1/agents/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 |
---|---|
agentID | The agentID of the agent that is being updated. |
ADDITIONAL POST PARAMETERS
You may also POST any of the following parameters:
Parameter | Description |
---|---|
firstName | The first name of the agent that is being updated in your AMS+ account. |
lastName | The last name of the agent that is being updated in your AMS+ account. |
middleInitial | The middle initial of the agent that is being updated in your AMS+ account. |
nickName | The nickname of the agent that is being updated in your AMS+ account. |
birthDate | The birth date of the agent that is being updated in your AMS+ account. |
ssn | The social security number of the agent being updated in your AMS+ account. |
The email of the agent being updated in your AMS+ account. | |
secondaryEmail | The secondary email of the agent being updated in your AMS+ account. |
status* | The status of the agent being updated in your AMS+ account. This value will populate the 'Status' dropdown within the 'Agent Detail' section of the new agent being created. |
type* | The type of the agent being updated in your AMS+ account. This value will populate the 'Type' dropdown within the 'Agent Detail' section of the new agent being created. |
classification* | The classification of the agent being updated in your AMS+ account. This value will populate the 'Classification' dropdown within the 'Agent Detail' section of the new agent being created. |
leadSource* | The leadSource of the agent being updated in your AMS+ account. This value will populate the 'Lead Source' dropdown within the 'Lead' section of the new agent being created. |
leadSourceOther | The leadSourceOther of the agent being updated in your AMS+ account. This value will populate the 'Other Lead Source' textbox within the 'Lead' section of the new agent being created. |
businessName | The businessName of the agent being updated in your AMS+ account. This value will populate the 'Business Name' textbox within the 'Lead' section of the new agent being created. |
npn | The npn of the agent being updated in your AMS+ account. This value will populate the 'NPN' textbox within the 'Lead' section of the new agent being created. |
When sending gender via POST, please format using M
for a male or F
for a female. When sending email 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 agent using these parameters:
Parameter | Description |
---|---|
homePhone | The home phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
cellPhone | The cell phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
businessPhone | The business phone number of the new agent that is being created in your AMS+ account. This value will be displayed in the 'Contact Information' section of the new agent being created. |
When sending phone numbers via POST, please ensure that all phone numbers are formatted as (319) 555-0000
.
Note: You may also update addresses for the agent using the Addresses API.
Custom Fields
The REST API allows access to the custom fields inside your account when updating an agent. In order to pass custom fields via the REST API, you will need to preface the names of the custom fields inside your account with 'custom_'. 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/Agent/list
By selecting the entity type from the dropdown, you will see the list of that entity's custom fields. All names must match exactly what is listed on the page, along with the preface of 'custom_'.
Note: When passing custom field data for Checkbox List custom fields, multiple values need to be separated by ||. For example, “option 1||option 2”.
RESPONSE
A return response will be generated after you have consumed the API. Upon successfully updating an agent inside your AMS+ account, you will get a return status of 200 along with the groupID as seen below.
{ "Agencybloc Response": { "Status":"200", "agentID":"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" } } }