Skip to content
Try For Free
Bizstim
Free tools
Pricing Contact Log in
Try For Free Book Demo
Home / API Reference / Agents
Resource

Agents

Third parties who pay for or oversee clients (a school district, a parent company): contact details, status, portal permissions and the login record.

The agent object

Every agent record carries these fields in this order, after object, which is always "agent".

FieldTypeDescription
idinteger
first_namestring, up to 50 characters
last_namestring, up to 50 characters
address1string, up to 100 characters
address2string, up to 100 characters
citystring, up to 50 characters
statestring, up to 50 characters
zipcodestring, up to 25 characters
countrystring, up to 50 characters
p_phonestring, up to 100 characters
s_phonestring, up to 100 characters
text_phonestring, up to 510 charactersMobile number(s) for text messages, comma-separated.
statusstring, up to 10 characters"active" or "inactive". Only active agents can log in.
timezonestring, up to 256 charactersThe agent's own time zone (see Timezones): the app uses it for the current date and time while they are logged in.
notestextNotes shown on the agent page (HTML).
send_welcome_messageinteger1 = Send Welcome Email is checked on the agent page, 0 = not. A stored setting: it does not show whether the e-mail was sent.
a_clientsinteger1 = can see their assigned clients' information in the agent portal, 0 = cannot.
a_sessionsinteger1 = can see their assigned clients' sessions in the agent portal, 0 = cannot.
a_reportsinteger1 = can see reports and assessments, 0 = cannot.
a_recordsinteger1 = can see records, 0 = cannot.
a_accountinginteger1 = can see payments and invoices, 0 = cannot.
a_payassistinteger1 = can make payments for their clients on the Pay Assist page (needs a_accounting = 1), 0 = cannot.
a_smartlearninteger1 = can manage Smart Learn (needs the Smart Learn module), 0 = cannot.
usernamestring, up to 50 characters, nullableLogin name, lower case and unique across every account. Empty or null when the agent has no login.
emailstring, up to 510 characters, nullableOne e-mail address or several, comma-separated, lower case.

Example

{
    "object": "agent",
    "id": 42,
    "first_name": "Jane",
    "last_name": "Doe",
    "address1": "12 Main Street",
    "address2": "Suite 4",
    "city": "Toronto",
    "state": "ON",
    "zipcode": "M5V 2T6",
    "country": "Canada",
    "p_phone": "416-555-0100",
    "s_phone": "416-555-0101",
    "text_phone": "416-555-0102",
    "status": "active",
    "timezone": "America/Toronto",
    "notes": "Prefers afternoon appointments.",
    "send_welcome_message": 1,
    "a_clients": 1,
    "a_sessions": 1,
    "a_reports": 1,
    "a_records": 1,
    "a_accounting": 1,
    "a_payassist": 1,
    "a_smartlearn": 1,
    "username": "jane.doe",
    "email": "jane.doe@example.com"
}

List agents

GET /api/v1/agents

Parameters

ParameterInDescription
limitqueryRecords per page, 1 to 1000 (default 100).
offsetqueryRecords to skip (default 0).

Returns

A list envelope of agent records (see Pagination).

Request

curl "https://www.bizstim.com/api/v1/agents" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "object": "list",
    "total": 2,
    "limit": 100,
    "offset": 0,
    "has_more": false,
    "data": [
        {
            "object": "agent",
            "id": 42,
            "first_name": "Jane",
            "last_name": "Doe",
            "address1": "12 Main Street",
            "address2": "Suite 4",
            "city": "Toronto",
            "state": "ON",
            "zipcode": "M5V 2T6",
            "country": "Canada",
            "p_phone": "416-555-0100",
            "s_phone": "416-555-0101",
            "text_phone": "416-555-0102",
            "status": "active",
            "timezone": "America/Toronto",
            "notes": "Prefers afternoon appointments.",
            "send_welcome_message": 1,
            "a_clients": 1,
            "a_sessions": 1,
            "a_reports": 1,
            "a_records": 1,
            "a_accounting": 1,
            "a_payassist": 1,
            "a_smartlearn": 1,
            "username": "jane.doe",
            "email": "jane.doe@example.com"
        },
        {
            "object": "agent",
            "id": 43,
            "first_name": "Jane",
            "last_name": "Doe",
            "address1": "12 Main Street",
            "address2": "Suite 4",
            "city": "Toronto",
            "state": "ON",
            "zipcode": "M5V 2T6",
            "country": "Canada",
            "p_phone": "416-555-0100",
            "s_phone": "416-555-0101",
            "text_phone": "416-555-0102",
            "status": "active",
            "timezone": "America/Toronto",
            "notes": "Prefers afternoon appointments.",
            "send_welcome_message": 1,
            "a_clients": 1,
            "a_sessions": 1,
            "a_reports": 1,
            "a_records": 1,
            "a_accounting": 1,
            "a_payassist": 1,
            "a_smartlearn": 1,
            "username": "jane.doe",
            "email": "jane.doe@example.com"
        }
    ]
}

Retrieve an agent

GET /api/v1/agents/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Returns

One agent record, or 404 not_found when no record with that id exists on your account.

Request

curl "https://www.bizstim.com/api/v1/agents/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "object": "agent",
    "id": 42,
    "first_name": "Jane",
    "last_name": "Doe",
    "address1": "12 Main Street",
    "address2": "Suite 4",
    "city": "Toronto",
    "state": "ON",
    "zipcode": "M5V 2T6",
    "country": "Canada",
    "p_phone": "416-555-0100",
    "s_phone": "416-555-0101",
    "text_phone": "416-555-0102",
    "status": "active",
    "timezone": "America/Toronto",
    "notes": "Prefers afternoon appointments.",
    "send_welcome_message": 1,
    "a_clients": 1,
    "a_sessions": 1,
    "a_reports": 1,
    "a_records": 1,
    "a_accounting": 1,
    "a_payassist": 1,
    "a_smartlearn": 1,
    "username": "jane.doe",
    "email": "jane.doe@example.com"
}

Create an agent

POST /api/v1/agents

Request body

A JSON object (Content-Type: application/json) with these fields.

FieldTypeRequiredDescription
first_namestring, up to 50 charactersyesFirst name (or the organisation's contact).
last_namestring, up to 50 charactersyesLast name.
statusstringyes"active" or "inactive". Only active agents can log in.
countrystring, up to 50 charactersyesCountry.
statestring, up to 50 charactersyesState or province.
citystring, up to 50 charactersnoCity.
address1string, up to 100 charactersnoStreet address.
address2string, up to 100 charactersnoApartment, suite or unit.
zipcodestring, up to 25 charactersnoZip or postal code.
p_phonestring, up to 100 charactersnoPrimary phone.
s_phonestring, up to 100 charactersnoSecondary phone.
text_phonestring, up to 510 charactersnoMobile number(s) for text messages, with the country code, comma separated. Stored without spaces, brackets or dashes.
emailstring, up to 510 charactersnoOne e-mail address, or several separated by commas. Stored in lower case.
notesstringnoPrivate notes shown on the agent page (HTML allowed).
timezonestringnoA time zone from GET /api/v1/timezones (default: the account time zone).
usernamestring, 4 to 50 charactersnoLogin name, stored in lower case; needs password. Without one the agent has no login (see send_welcome_message).
passwordstring, 4 to 72 characterswith usernameLogin password. Write only: it is never returned.
send_welcome_messagebooleannotrue e-mails the welcome message with the login details, as the app's add page does: for an active agent with an email address only (an active agent without one answers 400). Without a username, one and a password are created and the e-mail carries them. Default false.
a_clientsbooleannoView client information. Default for this and every permission below: the account's agent permission profile, as the app's add page.
a_sessionsbooleannoView session information.
a_reportsbooleannoView reports and assessments.
a_recordsbooleannoView records.
a_accountingbooleannoView payments and invoices.
a_payassistbooleannoUse Pay Assist (needs a_accounting).
a_smartlearnbooleannoManage Smart Learn (true needs the Smart Learn module and answers 400 without it; left out with the module off it is stored as false).

Returns

201 with the new agent record. Clients and tags are assigned to the agent in the app. 400 invalid_request names the field to fix; 409 conflict when the username is already taken (usernames are unique across every account; the check ignores case).

Request

curl -X POST "https://www.bizstim.com/api/v1/agents" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Jordan",
    "last_name": "Lee",
    "status": "active",
    "country": "Canada",
    "state": "Ontario",
    "city": "Toronto",
    "email": "jordan.lee@example.com"
}'

Response (201)

{
    "object": "agent",
    "id": 42,
    "first_name": "Jane",
    "last_name": "Doe",
    "address1": "12 Main Street",
    "address2": "Suite 4",
    "city": "Toronto",
    "state": "ON",
    "zipcode": "M5V 2T6",
    "country": "Canada",
    "p_phone": "416-555-0100",
    "s_phone": "416-555-0101",
    "text_phone": "416-555-0102",
    "status": "active",
    "timezone": "America/Toronto",
    "notes": "Prefers afternoon appointments.",
    "send_welcome_message": 1,
    "a_clients": 1,
    "a_sessions": 1,
    "a_reports": 1,
    "a_records": 1,
    "a_accounting": 1,
    "a_payassist": 1,
    "a_smartlearn": 1,
    "username": "jane.doe",
    "email": "jane.doe@example.com"
}

Update an agent

PATCH /api/v1/agents/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Request body

A JSON object (Content-Type: application/json) with these fields.

FieldTypeRequiredDescription
first_namestring, up to 50 charactersnoFirst name (cannot be emptied).
last_namestring, up to 50 charactersnoLast name (cannot be emptied).
statusstringno"active" or "inactive".
countrystring, up to 50 charactersnoCountry. An agent needs one: an update of an agent that has none on file must send it.
statestring, up to 50 charactersnoState or province, needed as country.
citystring, up to 50 charactersnoCity.
address1string, up to 100 charactersnoStreet address.
address2string, up to 100 charactersnoApartment, suite or unit.
zipcodestring, up to 25 charactersnoZip or postal code.
p_phonestring, up to 100 charactersnoPrimary phone.
s_phonestring, up to 100 charactersnoSecondary phone.
text_phonestring, up to 510 charactersnoMobile number(s) for text messages, as on create.
emailstring, up to 510 charactersnoOne e-mail address or several, comma separated; "" removes them.
notesstringnoNotes (HTML allowed), replaced as sent.
timezonestringnoA time zone from GET /api/v1/timezones.
usernamestring, 4 to 50 charactersnoLogin name, stored in lower case. An agent without a password needs password in the same request. "" removes the login (username and password).
passwordstring, 4 to 72 charactersnoNew login password (needs a username). Write only.
send_welcome_messagebooleannoStored setting only: an update never sends the welcome e-mail.
a_clientsbooleannoView client information.
a_sessionsbooleannoView session information.
a_reportsbooleannoView reports and assessments.
a_recordsbooleannoView records.
a_accountingbooleannoView payments and invoices.
a_payassistbooleannoUse Pay Assist (needs a_accounting).
a_smartlearnbooleannoManage Smart Learn (true needs the Smart Learn module; with the module off every update stores false, as the app's edit page).

Returns

200 with the updated agent record. Fields left out keep their values; the assigned clients and the agent's tags are kept too, and, as on the app's edit page, the agent's tags are applied again to each assigned client. 400 invalid_request names the field to fix; 404 not_found; 409 conflict when the username is already taken (usernames are unique across every account; the check ignores case).

Request

curl -X PATCH "https://www.bizstim.com/api/v1/agents/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "inactive",
    "p_phone": "416-555-0100"
}'

Response

{
    "object": "agent",
    "id": 42,
    "first_name": "Jane",
    "last_name": "Doe",
    "address1": "12 Main Street",
    "address2": "Suite 4",
    "city": "Toronto",
    "state": "ON",
    "zipcode": "M5V 2T6",
    "country": "Canada",
    "p_phone": "416-555-0100",
    "s_phone": "416-555-0101",
    "text_phone": "416-555-0102",
    "status": "active",
    "timezone": "America/Toronto",
    "notes": "Prefers afternoon appointments.",
    "send_welcome_message": 1,
    "a_clients": 1,
    "a_sessions": 1,
    "a_reports": 1,
    "a_records": 1,
    "a_accounting": 1,
    "a_payassist": 1,
    "a_smartlearn": 1,
    "username": "jane.doe",
    "email": "jane.doe@example.com"
}

Delete an agent

DELETE /api/v1/agents/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Returns

200 with {"id", "object": "agent", "deleted": true}: the agent, the login, the client assignments and the agent's invoice reports are removed for good, and the agent is taken off every service. The clients themselves are kept. 404 not_found; 409 conflict when the agent has on-demand event settings (set the status to inactive instead).

Request

curl -X DELETE "https://www.bizstim.com/api/v1/agents/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "id": 42,
    "object": "agent",
    "deleted": true
}