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".
| Field | Type | Description |
|---|---|---|
id | integer | |
first_name | string, up to 50 characters | |
last_name | string, up to 50 characters | |
address1 | string, up to 100 characters | |
address2 | string, up to 100 characters | |
city | string, up to 50 characters | |
state | string, up to 50 characters | |
zipcode | string, up to 25 characters | |
country | string, up to 50 characters | |
p_phone | string, up to 100 characters | |
s_phone | string, up to 100 characters | |
text_phone | string, up to 510 characters | Mobile number(s) for text messages, comma-separated. |
status | string, up to 10 characters | "active" or "inactive". Only active agents can log in. |
timezone | string, up to 256 characters | The agent's own time zone (see Timezones): the app uses it for the current date and time while they are logged in. |
notes | text | Notes shown on the agent page (HTML). |
send_welcome_message | integer | 1 = 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_clients | integer | 1 = can see their assigned clients' information in the agent portal, 0 = cannot. |
a_sessions | integer | 1 = can see their assigned clients' sessions in the agent portal, 0 = cannot. |
a_reports | integer | 1 = can see reports and assessments, 0 = cannot. |
a_records | integer | 1 = can see records, 0 = cannot. |
a_accounting | integer | 1 = can see payments and invoices, 0 = cannot. |
a_payassist | integer | 1 = can make payments for their clients on the Pay Assist page (needs a_accounting = 1), 0 = cannot. |
a_smartlearn | integer | 1 = can manage Smart Learn (needs the Smart Learn module), 0 = cannot. |
username | string, up to 50 characters, nullable | Login name, lower case and unique across every account. Empty or null when the agent has no login. |
email | string, up to 510 characters, nullable | One 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
Parameters
| Parameter | In | Description |
|---|---|---|
limit | query | Records per page, 1 to 1000 (default 100). |
offset | query | Records 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"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/agents');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/agents', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.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
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The 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"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/agents/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/agents/42', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.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
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
first_name | string, up to 50 characters | yes | First name (or the organisation's contact). |
last_name | string, up to 50 characters | yes | Last name. |
status | string | yes | "active" or "inactive". Only active agents can log in. |
country | string, up to 50 characters | yes | Country. |
state | string, up to 50 characters | yes | State or province. |
city | string, up to 50 characters | no | City. |
address1 | string, up to 100 characters | no | Street address. |
address2 | string, up to 100 characters | no | Apartment, suite or unit. |
zipcode | string, up to 25 characters | no | Zip or postal code. |
p_phone | string, up to 100 characters | no | Primary phone. |
s_phone | string, up to 100 characters | no | Secondary phone. |
text_phone | string, up to 510 characters | no | Mobile number(s) for text messages, with the country code, comma separated. Stored without spaces, brackets or dashes. |
email | string, up to 510 characters | no | One e-mail address, or several separated by commas. Stored in lower case. |
notes | string | no | Private notes shown on the agent page (HTML allowed). |
timezone | string | no | A time zone from GET /api/v1/timezones (default: the account time zone). |
username | string, 4 to 50 characters | no | Login name, stored in lower case; needs password. Without one the agent has no login (see send_welcome_message). |
password | string, 4 to 72 characters | with username | Login password. Write only: it is never returned. |
send_welcome_message | boolean | no | true 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_clients | boolean | no | View client information. Default for this and every permission below: the account's agent permission profile, as the app's add page. |
a_sessions | boolean | no | View session information. |
a_reports | boolean | no | View reports and assessments. |
a_records | boolean | no | View records. |
a_accounting | boolean | no | View payments and invoices. |
a_payassist | boolean | no | Use Pay Assist (needs a_accounting). |
a_smartlearn | boolean | no | Manage 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"
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/agents');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"first_name": "Jordan",
"last_name": "Lee",
"status": "active",
"country": "Canada",
"state": "Ontario",
"city": "Toronto",
"email": "jordan.lee@example.com"
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/agents', {
method: 'POST',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"first_name": "Jordan",
"last_name": "Lee",
"status": "active",
"country": "Canada",
"state": "Ontario",
"city": "Toronto",
"email": "jordan.lee@example.com"
})
});
const data = await response.json();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
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
first_name | string, up to 50 characters | no | First name (cannot be emptied). |
last_name | string, up to 50 characters | no | Last name (cannot be emptied). |
status | string | no | "active" or "inactive". |
country | string, up to 50 characters | no | Country. An agent needs one: an update of an agent that has none on file must send it. |
state | string, up to 50 characters | no | State or province, needed as country. |
city | string, up to 50 characters | no | City. |
address1 | string, up to 100 characters | no | Street address. |
address2 | string, up to 100 characters | no | Apartment, suite or unit. |
zipcode | string, up to 25 characters | no | Zip or postal code. |
p_phone | string, up to 100 characters | no | Primary phone. |
s_phone | string, up to 100 characters | no | Secondary phone. |
text_phone | string, up to 510 characters | no | Mobile number(s) for text messages, as on create. |
email | string, up to 510 characters | no | One e-mail address or several, comma separated; "" removes them. |
notes | string | no | Notes (HTML allowed), replaced as sent. |
timezone | string | no | A time zone from GET /api/v1/timezones. |
username | string, 4 to 50 characters | no | Login name, stored in lower case. An agent without a password needs password in the same request. "" removes the login (username and password). |
password | string, 4 to 72 characters | no | New login password (needs a username). Write only. |
send_welcome_message | boolean | no | Stored setting only: an update never sends the welcome e-mail. |
a_clients | boolean | no | View client information. |
a_sessions | boolean | no | View session information. |
a_reports | boolean | no | View reports and assessments. |
a_records | boolean | no | View records. |
a_accounting | boolean | no | View payments and invoices. |
a_payassist | boolean | no | Use Pay Assist (needs a_accounting). |
a_smartlearn | boolean | no | Manage 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"
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/agents/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_POSTFIELDS => '{
"status": "inactive",
"p_phone": "416-555-0100"
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/agents/42', {
method: 'PATCH',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"status": "inactive",
"p_phone": "416-555-0100"
})
});
const data = await response.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"
} Delete an agent
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The 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"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/agents/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/agents/42', {
method: 'DELETE',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"id": 42,
"object": "agent",
"deleted": true
}