Staff Accounts
The six endpoints that open, update and remove the staff accounts using the panel.
Overview
Staff accounts are the people who can sign into the panel. They live in a record set apart from clients, yet their e-mail addresses share one pool with them.
What an account can do rests on its privilege group, and which support tickets it sees on the departments it is assigned to. Both are handled at endpoints of their own.
The installation's founding account is guarded: it cannot be removed and its privileges cannot change. Your own account is guarded in part as well, since you can neither lower your own privileges nor remove yourself.
Reference
Listing the Staff
Returns the accounts that can sign into the panel.
curl 'https://panel.example.com/api/v1/admin/admins' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/admins', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// The founding account carries its own mark; leave it out when writing bulk work.
$staff = Api::Admins()->GetStaff()['data'];
$rest = array_filter($staff, fn ($s) => ! $s['is_root']);Opening a Staff Account
Opens a new account able to sign into the panel.
curl -X POST 'https://panel.example.com/api/v1/admin/admins' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"full_name":"Ayse Yilmaz","email":"[email protected]","password":"G1zliParola","password_confirmation":"G1zliParola","privilege":2,"lang":"tr"}'const res = await fetch('https://panel.example.com/api/v1/admin/admins', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
full_name: 'John Doe',
email: '[email protected]',
password: secret,
password_confirmation: secret,
privilege: 2,
lang: 'en',
departments: [1, 2],
}),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'full_name' => 'John Doe',
'email' => '[email protected]',
'password' => $secret,
'password_confirmation' => $secret,
'privilege' => 2,
'lang' => 'en',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// The privilege group decides WHAT THE ACCOUNT CAN DO; do not default to the widest one.
Api::Admins()->CreateStaff([
'full_name' => 'John Doe',
'email' => $email,
'password' => $secret,
'password_confirmation' => $secret,
'privilege' => $limitedGroupId,
'lang' => 'en',
]);Reading One Staff Member
Returns one staff account with all of its fields.
curl 'https://panel.example.com/api/v1/admin/admins/5' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.example.com/api/v1/admin/admins/${id}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// The password NEVER comes back, and on the verification side only method NAMES show.
$s = Api::Admins()->GetStaffMember(['id' => $id])['data'];Updating a Staff Member
Changes the staff account fields you send.
curl -X PATCH 'https://panel.example.com/api/v1/admin/admins/5' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"full_name":"Ayse Kaya","departments":[1,3]}'const res = await fetch(`https://panel.example.com/api/v1/admin/admins/${id}`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ full_name: 'Jane Doe', departments: [1, 3] }),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['full_name' => 'Jane Doe', 'departments' => [1, 3]]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// A department list REPLACES what was there; leave the field out to keep the current ones.
Api::Admins()->UpdateStaff(['id' => $id, 'full_name' => 'Jane Doe']);Removing a Staff Member
Removes a staff account.
curl -X DELETE 'https://panel.example.com/api/v1/admin/admins/6' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.example.com/api/v1/admin/admins/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// For someone who left, switch the account OFF rather than delete: past work keeps its owner.
Api::Admins()->UpdateStaff(['id' => $id, 'status' => 'passive']);Turning Off the Second Step
Takes away a staff member's second sign-in step.
curl -X POST 'https://panel.example.com/api/v1/admin/admins/5/disable-authentication' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"method":"GoogleAuthenticator"}'const res = await fetch(`https://panel.example.com/api/v1/admin/admins/${id}/disable-authentication`, {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ method: 'GoogleAuthenticator' }),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/admins/' . $id . '/disable-authentication');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['method' => 'GoogleAuthenticator']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// In the panel this asks for the ADMIN PASSWORD; over the API the key's scope is the only gate.
$s = Api::Admins()->GetStaffMember(['id' => $id])['data'];
foreach ($s['authentication_methods'] as $m)
Api::Admins()->DisableStaffAuthentication(['id' => $id, 'method' => $m]);Pitfalls
A staff account's e-mail has to be unique not only among staff but among clients too. The same address cannot carry both a client and a staff account. On an installation that also registers its own team as clients, this surfaces as an unexpected clash error.
The update call quietly ignores the privilege and status fields on the founding account and on your own. You cannot lock yourself out by accident, yet neither can you assume the value you sent was applied. Read the privilege group in the response and weigh it against what you expected.
Sending a department list on an update replaces what was assigned. Sending only the one you meant to add drops the rest. To keep the current assignments leave the field out entirely, and to add one, read the detail first and merge.
Turning off a staff member's second sign-in step asks for the administrator password in the panel, while here the key's scope is the only gate. A key carrying it can strip an account's extra protection outright. Weigh this scope on its own when handing keys out.
Deleting a staff member takes the account away, while the work they did, the replies they wrote and the notes they left keep pointing at them in the records. Switching the account off stops the sign-in and leaves the history readable. The founding account and your own cannot be removed at all.
Related Articles
Thanks for your feedback!
Our support team is here around the clock for anything you can't find above.