curl --request PUT \
--url https://myorg.tribalhabits.com/papi/users/{user_name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"active": false,
"groups": [
"Brisbane",
"Bundaberg"
]
}
'import requests
url = "https://myorg.tribalhabits.com/papi/users/{user_name}"
payload = {
"active": False,
"groups": ["Brisbane", "Bundaberg"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({active: false, groups: ['Brisbane', 'Bundaberg']})
};
fetch('https://myorg.tribalhabits.com/papi/users/{user_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://myorg.tribalhabits.com/papi/users/{user_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'active' => false,
'groups' => [
'Brisbane',
'Bundaberg'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://myorg.tribalhabits.com/papi/users/{user_name}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"active\": false,\n \"groups\": [\n \"Brisbane\",\n \"Bundaberg\"\n ]\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://myorg.tribalhabits.com/papi/users/{user_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": false,\n \"groups\": [\n \"Brisbane\",\n \"Bundaberg\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"user_name": "12345",
"first_name": "Bilbo",
"last_name": "Baggins",
"email": "bilbo@myorg.com",
"manager_email": "manager@company.com",
"manager_2_email": "manager2@company.com",
"manager_3_email": null,
"manager_4_email": null,
"manager_5_email": null,
"mentor_email": "mentor@company.com",
"lms_learner_id": "456",
"lms_reference": "Testlms",
"org_admin": false,
"creator": false,
"team_leader": false,
"created_at": "2019-04-01T15:46:31.586+11:00",
"updated_at": "2021-06-15T09:25:25.756+10:00",
"current_sign_in_at": "2022-06-15T09:25:25.756+10:00",
"admin_type": null,
"deactivate_scheduled_date": "2022-06-15T00:00:00.000+10:00",
"reactivate_scheduled_date": null,
"language": "en",
"created_by": "API",
"timezone": "Australia/Sydney",
"user_notifications_enabled": true,
"team_leader_report_frequency": "every_thursday",
"learner_report_frequency": null,
"assessor_report_frequency": "every_wednesday",
"default_landing_page": "Default",
"org_admin_access": "none",
"login": "internal",
"type": "Client",
"active": false,
"X-Country": "Australia",
"X-State": "Queensland",
"X-Preferred Name": "Jack",
"platform_champion": false,
"role_1": "Instructor",
"role_2": null,
"role_3": null,
"role_4": null,
"role_5": null,
"groups": "Brisbane;Bundaberg",
"goals": "Goal1;Goal2"
}"Bad request: Illegal value 'maybe' for 'active'""not found"{
"user_name": "12345",
"email": "not-an-email",
"params": {
"user_name": "12345",
"email": "not-an-email"
},
"reason": "Email is invalid",
"errors": [
"Email is invalid"
]
}{
"error": "Rate limit exceeded. Please slow down.",
"retry_after_seconds": 23
}Update a specific user
This endpoint updates a specific user. Only fields that are supplied will be updated. To clear an optional field, send an empty string, eg "manager_email": "". Returns 404 if the user does not exist.
user_name in the URL is the unique identifier of the person to update (case-insensitive).
Boolean fields accept true, 1 or "yes", and false, 0 or "no". Values are case-insensitive and can also be sent as strings, eg "true". Any other value returns 400.
The fields org_admin and admin_type cannot be set through the API. If supplied they are ignored. Administrator access must be granted in the Tribal Habits web interface.
Enrolment codes (enrolment_code_N) are not processed by this endpoint. To enrol users, use Batch create or update or Create or update topic or pathway enrolments.
curl --request PUT \
--url https://myorg.tribalhabits.com/papi/users/{user_name} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"active": false,
"groups": [
"Brisbane",
"Bundaberg"
]
}
'import requests
url = "https://myorg.tribalhabits.com/papi/users/{user_name}"
payload = {
"active": False,
"groups": ["Brisbane", "Bundaberg"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({active: false, groups: ['Brisbane', 'Bundaberg']})
};
fetch('https://myorg.tribalhabits.com/papi/users/{user_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://myorg.tribalhabits.com/papi/users/{user_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'active' => false,
'groups' => [
'Brisbane',
'Bundaberg'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://myorg.tribalhabits.com/papi/users/{user_name}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"active\": false,\n \"groups\": [\n \"Brisbane\",\n \"Bundaberg\"\n ]\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://myorg.tribalhabits.com/papi/users/{user_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"active\": false,\n \"groups\": [\n \"Brisbane\",\n \"Bundaberg\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"user_name": "12345",
"first_name": "Bilbo",
"last_name": "Baggins",
"email": "bilbo@myorg.com",
"manager_email": "manager@company.com",
"manager_2_email": "manager2@company.com",
"manager_3_email": null,
"manager_4_email": null,
"manager_5_email": null,
"mentor_email": "mentor@company.com",
"lms_learner_id": "456",
"lms_reference": "Testlms",
"org_admin": false,
"creator": false,
"team_leader": false,
"created_at": "2019-04-01T15:46:31.586+11:00",
"updated_at": "2021-06-15T09:25:25.756+10:00",
"current_sign_in_at": "2022-06-15T09:25:25.756+10:00",
"admin_type": null,
"deactivate_scheduled_date": "2022-06-15T00:00:00.000+10:00",
"reactivate_scheduled_date": null,
"language": "en",
"created_by": "API",
"timezone": "Australia/Sydney",
"user_notifications_enabled": true,
"team_leader_report_frequency": "every_thursday",
"learner_report_frequency": null,
"assessor_report_frequency": "every_wednesday",
"default_landing_page": "Default",
"org_admin_access": "none",
"login": "internal",
"type": "Client",
"active": false,
"X-Country": "Australia",
"X-State": "Queensland",
"X-Preferred Name": "Jack",
"platform_champion": false,
"role_1": "Instructor",
"role_2": null,
"role_3": null,
"role_4": null,
"role_5": null,
"groups": "Brisbane;Bundaberg",
"goals": "Goal1;Goal2"
}"Bad request: Illegal value 'maybe' for 'active'""not found"{
"user_name": "12345",
"email": "not-an-email",
"params": {
"user_name": "12345",
"email": "not-an-email"
},
"reason": "Email is invalid",
"errors": [
"Email is invalid"
]
}{
"error": "Rate limit exceeded. Please slow down.",
"retry_after_seconds": 23
}Authorizations
Your organisation's API key, sent as Authorization: my_api_key. The key can also be passed as an api_key query parameter. See Authentication.
Path Parameters
Body
A new unique identifier for the user. Stored in lower case
User's first name - used for display purposes
User's last name - used for display purposes
User's email address (must be unique within your organisation) - used for email notifications
Type of user. One of Client, Contractor, Customer, Director, Employee, Lead, Member, Parent, Partner, Practitioner, Prospect, Staff, Student, Subscriber, Supporter, Volunteer, Worker. Case-insensitive.
Email address of the user's manager - used for email notifications and team reporting
Email address of the user's 2nd manager - used for email notifications and team reporting
Email address of the user's 3rd manager - used for email notifications and team reporting
Email address of the user's 4th manager - used for email notifications and team reporting
Email address of the user's 5th manager - used for email notifications and team reporting
Email address of the user's mentor - used for email notifications
One of en, fj, fr, de, hi-IN, id, it, ja, ko, mi, ms, ne, pa-IN, pt, sm, zh-Hans, es, tl, ta, te, th, to, zh-Hant-HK, vi. Case-insensitive. Unrecognised values are ignored
User's time zone, eg Australia/Sydney
User's id in company LMS - used for matching users in Tribal Habits. The combination of lms_reference and lms_learner_id must be unique
Company LMS name - used for matching users in Tribal Habits
internal (Tribal Habits login) or external (single sign-on)
internal, external Specify false to deactivate the account, or true to reactivate it
Specify true to allow this user to create topics
User will receive email notifications
User must change their password at next login
Send the manager email report on the 1st of the month
Send the manager email report on the 15th of the month
8 to 72 characters, with at least one number, one upper case and one lower case character
A future date this account will be deactivated. Formats: 'yyyy-mm-dd', 'dd/mm/yyyy' or 'dd/mm/yy'
A future date this account will be reactivated. Same formats as deactivate_scheduled_date
Frequency of team leader report emails, if the user is a team leader. One of every_half, every_quarter, once_a_month, twice_a_month, every_monday, every_tuesday, every_wednesday, every_thursday, every_friday, every_weekday, every_day. none or an empty value clears it. Any other value returns 400
Frequency of learner report emails. Same values as team_leader_report_frequency
Frequency of assessor report emails, if the user is an assessor or creator. Same values as team_leader_report_frequency
One of Assess, Create, Admin, Dashboard - Overview, Dashboard - Calendar, Training - Enrolments, Profile. Case-insensitive. Returns 400 if the user does not have access to that page (eg Admin for a non-administrator). Unrecognised values are ignored
Name of the role assigned to the user in position 1. The role must already exist, otherwise 400 is returned. An empty value removes the role in that position
Name of the role assigned to the user in position 2. The role must already exist, otherwise 400 is returned. An empty value removes the role in that position
Name of the role assigned to the user in position 3. The role must already exist, otherwise 400 is returned. An empty value removes the role in that position
Name of the role assigned to the user in position 4. The role must already exist, otherwise 400 is returned. An empty value removes the role in that position
Name of the role assigned to the user in position 5. The role must already exist, otherwise 400 is returned. An empty value removes the role in that position
Group names separated with a semicolon, eg "groups": "Brisbane;Bundaberg", or an array of group names, eg "groups": ["Brisbane", "Bundaberg"]. Groups must already exist, otherwise 400 is returned. Replaces all of the user's current groups; an empty value removes the user from all groups
Goal names separated with a semicolon, eg "goals": "Goal1;Goal2", or an array of goal names, eg "goals": ["Goal1", "Goal2"]. Replaces all of the user's current goals. Goals must already exist, otherwise 400 is returned. An empty value removes all goals
Custom field. Replace [Custom] with the custom field name. See Custom fields
Specify true to send an invitation email to the user
Response
The updated user
The user object returned by the user endpoints. Custom fields are included as X- fields, see Custom fields.
Unique identifier of the user. Always stored and returned in lower case
User's first name
User's last name
User's email address
Email address of the user's manager. null if not set
Email address of the user's 2nd manager. null if not set
Email address of the user's 3rd manager. null if not set
Email address of the user's 4th manager. null if not set
Email address of the user's 5th manager. null if not set
Email address of the user's mentor
User's identifier in your company LMS
User's LMS name in your company LMS
true if the user is an administrator
true if the user can create topics
true if the user is the manager of at least one other user (derived from other users' manager emails)
Timestamp
Timestamp
Timestamp. null if the user has never signed in
Administrator type as a number: 0 = super, 1 = standard, 2 = knowledge, 3 = reporting, 4 = instructor, 5 = restricted, 6 = observer, 7 = people, 8 = library. null if not an administrator
Timestamp of the date on which the account is scheduled to be deactivated, or null
Timestamp of the date on which the account is scheduled to be reactivated, or null
Language code, eg en
How the user was created, eg API
User's time zone, eg Australia/Sydney
true if the user receives email notifications
Team leader report email frequency. See Update a specific user for values
Learner report email frequency. See Update a specific user for values
Assessor report email frequency. See Update a specific user for values
Page shown after login, or Default
Name of the administrator type (see admin_type), or none
internal or external
internal, external Type of user, eg Staff, Client
false if the account has been deactivated
Custom fields. See Custom fields
true if the user is a platform champion for your organisation
Name of the role in position 1, or null
Name of the role in position 2, or null
Name of the role in position 3, or null
Name of the role in position 4, or null
Name of the role in position 5, or null
Group names, sorted and separated by semicolons
Goal names, sorted and separated by semicolons

