Introduction
This documentation aims to provide all the information you need to work with our API.
Authenticating requests
This API is not authenticated.
Company Management
List Companies
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/companies?companyId=0&page=1&limit=50&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/companies"
);
const params = {
"companyId": "0",
"page": "1",
"limit": "50",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"company_list": [
{
"id": 11017,
"name": "R1 Learning",
"total_licenses": 200,
"assigned_licenses": 99,
"available_licenses": 101,
"license_renewal_date": "2025-12-31",
"status": "published"
},
{
"id": 12138,
"name": "R2 Learning",
"total_licenses": 100,
"assigned_licenses": 90,
"available_licenses": 10,
"license_renewal_date": "2025-09-30",
"status": "published"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create Company
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/companies" \
--header "Authorization: Bearer {token}" \
--header "Content-Type: application/json" \
--data "{
\"name\": \"Acme Corp\",
\"address1\": \"123 Main St\",
\"address2\": \"Suite 456\",
\"city\": \"New York\",
\"state\": \"NY\",
\"zip\": \"10001\",
\"country\": \"US\",
\"phone\": \"555-123-4567\",
\"email\": \"contact@r1.com\",
\"status\": \"published\",
\"total_licenses\": 100,
\"license_duration\": \"1-year\",
\"subscription_type\": \"basic\"
}"
const url = new URL(
"https://api.r1learning.com/api/v2/companies"
);
const headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Acme Corp",
"address1": "123 Main St",
"address2": "Suite 456",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "US",
"phone": "555-123-4567",
"email": "contact@r1.com",
"status": "published",
"total_licenses": 100,
"license_duration": "1-year",
"subscription_type": "basic"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200, Success):
{
"message": "Company created successfully",
"data": {
"id": 99,
"name": "FB Test Comp 3",
"address1": "15 North avenue",
"address2": "Suite 100",
"city": "Chicago",
"state": "IL",
"zip": "60610",
"country": "US",
"status": "published",
"total_licenses": "10",
"email1": "contact@example.com",
"license_renewal_date": "2025-10-01 00:41:10"
}
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update Company
requires authentication
Example request:
curl --request PUT \
"https://api.r1learning.com/api/v2/companies/1234" \
--header "Authorization: Bearer {token}" \
--header "Content-Type: application/json" \
--data "{
\"status\": \"published\",
\"total_licenses\": 10,
\"license_renewal_date\": \"2025-01-01\",
\"subscription_type\": \"individual\"
}"
const url = new URL(
"https://api.r1learning.com/api/v2/companies/1234"
);
const headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "published",
"total_licenses": 10,
"license_renewal_date": "2025-01-01",
"subscription_type": "individual"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201, Success):
{
"message": "Company updated successfully",
"data": {
"id": 10231,
"name": "Example Company",
"status": "published",
"total_licenses": "11",
"license_renewal_date": "2025-10-01"
}
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Example response (422, Validation Error):
{
"error": 1,
"message": "Total licenses cannot be less than currently assigned licenses",
"details": "You have 198 licenses assigned, please unassign licenses to reduce the total below 198."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Company Topics
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/companies/topics?companyId=0&page=1&limit=50&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/companies/topics"
);
const params = {
"companyId": "0",
"page": "1",
"limit": "50",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": "1",
"per_page": "50"
},
"topic_list": [
{
"company_id": 17532,
"topics": [
{
"topic_id": 1123,
"name": "Stages of Change (SUD)",
"video_url": "http://discover.r1learning.com/video-library/video/****"
},
{
"topic_id": 3321,
"name": "Healthy Boundaries",
"video_url": "http://discover.r1learning.com/video-library/video/****"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Company Activities
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/companies/activities?companyId=0&page=1&limit=50&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/companies/activities"
);
const params = {
"companyId": "0",
"page": "1",
"limit": "50",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 4,
"total_pages": 1,
"current_page": "1",
"per_page": "50"
},
"data": [
{
"company_id": 3124,
"activity_list": [
{
"topic_id": 123,
"topic_name": "Stages of Change (SUD)",
"activities": [
{
"id": 71,
"name": "Identify My Stage of Change",
"type": "sorting_cards",
"activity_url": "http://discover.r1learning.com/activity****"
},
{
"id": 98,
"name": "Explore the Stages of Change Model",
"type": "overview_definition_cards",
"activity_url": "http://discover.r1learning.com/activity****"
}
]
},
{
"topic_id": 242,
"topic_name": "Phases of Addiction",
"activities": [
{
"id": 27,
"name": "Identify My Phase of Addiction",
"type": "sorting_cards",
"activity_url": "http://discover.r1learning.com/activity****"
},
{
"id": 63,
"name": "Explore the Phases of Addiction Model",
"type": "overview_definition_cards",
"activity_url": "http://discover.r1learning.com/activity****"
}
]
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Locations & Programs
List Company Locations
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/locations/0?page=1&limit=50&sortby=1&locationOrder=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/locations/0"
);
const params = {
"page": "1",
"limit": "50",
"sortby": "1",
"locationOrder": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"location_list": [
{
"company_id": 12345,
"locations": [
{
"id": 1273,
"location_name": "R1 Location 1",
"status": "published"
},
{
"id": 5692,
"location_name": "R1 Location 2",
"status": "published"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create/Update Location
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/locations/1?location_name=Main+Office&address1=123+Main+St&address2=Apt+4B&city=New+York&state=NY&zip=10001&country=US&phone1=123-456-7890&email1=info%40company.com&status=published" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/locations/1"
);
const params = {
"location_name": "Main Office",
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "US",
"phone1": "123-456-7890",
"email1": "info@company.com",
"status": "published",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Example response (200, success):
{
"message": "Location created successfully",
"data": {
"id": 185672,
"location_name": "Main Office",
"company_item_id": "1234",
"address1": "123 Main St",
"address2": "Apt 4B",
"city": "New York",
"state": "NY",
"zip": "10001",
"country": "US",
"phone1": "123-456-7890",
"email1": "info@company.com",
"created_at": "2024-09-14T03:47:35.000000Z",
"updated_at": "2024-09-14T03:47:35.000000Z"
}
}
Example response (201, success):
{
"message": "Location updated successfully",
"data": 1
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Parent Programs
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/programs/parent?page=1&limit=50&sortBy=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/programs/parent"
);
const params = {
"page": "1",
"limit": "50",
"sortBy": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 3,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"parent_program_list": [
{
"id": 1,
"name": "ASAM Level .5 – Early Intervention",
"status": "published"
},
{
"id": 2,
"name": "ASAM Level 1 – Outpatient",
"status": "published"
},
{
"id": 3,
"name": "ASAM Level 2.1 – Intensive Outpatient",
"status": "published"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Company Programs
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/programs/0?page=1&limit=50&sortby=1&programOrder=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/programs/0"
);
const params = {
"page": "1",
"limit": "50",
"sortby": "1",
"programOrder": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"program_list": [
{
"company_id": 1432,
"programs": [
{
"program_id": 1937,
"program_name": "Detox",
"program_parent_id": 1,
"program_parent_name": "ASAM Level .5 – Early Intervention",
"status": "published"
},
{
"program_id": 4526,
"program_name": "PHP",
"program_parent_id": 4,
"program_parent_name": "ASAM Level 2.5 – Partial Hospitalization",
"status": "published"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create/Update Program
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/programs/1?name=%22New+Program%22&parent_id=1&status=published" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/programs/1"
);
const params = {
"name": ""New Program"",
"parent_id": "1",
"status": "published",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());Example response (200, Success):
{
"message": "The program \"New Program\" created successfully",
"data": {
"id": 18827,
"company_id": "1432",
"name": "New Program",
"parent_id": "2",
"status": "published",
"created_at": "2024-09-14T04:41:20.000000Z",
"updated_at": "2024-09-14T04:41:20.000000Z"
}
}
Example response (201, Success):
{
"message": "The program \"New Program\" updated successfully",
"data": 1
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
User Management
List Company Users
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/users/0?page=1&limit=50&maxDays=0&userStatus=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/users/0"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"userStatus": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": "1",
"per_page": "50",
"max_days": "400"
},
"user_list": [
{
"company_id": 127,
"users": [
{
"user_id": 29673,
"email": "acase@example.com",
"username": "acase@example.com",
"company_username": null,
"unique_id": "compid-user-000000000000946",
"status": "active",
"location_name": "R1 Location 1",
"program_name": "Sample Program",
"practitioner_email": "practitioner@example.com",
"member_updated_at": "2023-07-20T14:21:17.000000Z",
"last_activity_date": "2023-08-25T11:06:32.000000Z"
}
]
},
{
"company_id": 393,
"users": [
{
"user_id": 21333,
"email": "user@example.com",
"username": "user@example.com",
"company_username": null,
"unique_id": "compid-user-000000000002341",
"status": "active",
"location_name": "Company Location 2",
"program_name": "PHP",
"practitioner_email": "practitioner@example.com",
"member_updated_at": "2023-06-11T13:06:59.000000Z",
"last_activity_date": "2023-09-15T12:13:49.000000Z"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create/Update User
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/users/1" \
--header "Authorization: Bearer {token}" \
--header "Content-Type: application/json" \
--data "{
\"client_id\": \"r1-user-123456-01\",
\"username\": \"user123\",
\"company_username\": \"user123\",
\"first_name\": \"John\",
\"last_name\": \"Doe\",
\"client_email\": \"xyz@example.com\",
\"client_location\": \"AZ Treatment Center\",
\"client_program\": \"Virtual Outatient\",
\"client_practitioner\": \"practitioner_email@example.com\",
\"client_status\": \"active\"
}"
const url = new URL(
"https://api.r1learning.com/api/v2/users/1"
);
const headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"client_id": "r1-user-123456-01",
"username": "user123",
"company_username": "user123",
"first_name": "John",
"last_name": "Doe",
"client_email": "xyz@example.com",
"client_location": "AZ Treatment Center",
"client_program": "Virtual Outatient",
"client_practitioner": "practitioner_email@example.com",
"client_status": "active"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200, Success):
{
"error": 0,
"message": "User created successfully",
"data": {
"id": 67890,
"unique_id": "abcxyz123456",
"username": "johndoe",
"company_username": "johndoe_company",
"first_name": "John",
"last_name": "Doe",
"client_email": "johndoe@example.com"
}
}
Example response (201, Success):
{
"error": 0,
"message": "User updated successfully!",
"data": [
{
"id": 123456,
"unique_id": "test-user-1234",
"username": "user123456",
"company_username": "",
"first_name": "User",
"last_name": "Example",
"email": "user123456@example.com",
"location": "Sample Location",
"practitioner": "practitioner@example.com",
"program": "Sample Program",
"status": "active"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Example response (404, User Not Found):
{
"error": 1,
"message": "User not found",
"details": "The requested user with Unique ID 'abcxyz' does not exist or is not associated with the given company."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Admin Roles
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/admins/roles" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/admins/roles"
);
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 4,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"admin_roles": [
{
"name": "Admin",
"description": "View, Edit, and Create Users at same Program & Location"
},
{
"name": "Admin-Read",
"description": "View (not Edit) Users at same Program & Location"
},
{
"name": "Lead Admin",
"description": "View, Edit, and Create Admins and Users at same Program & Location"
},
{
"name": "Lead Admin - Read",
"description": "View (not Edit) Admins and Users at same Program & Location"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Company Admins
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/admins/0?page=1&limit=50&maxDays=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/admins/0"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": "1",
"per_page": "50",
"max_days": "0"
},
"admin_list": [
{
"company_id": 612,
"admins": [
{
"user_id": 12345,
"email": "john.smith@r1.com",
"username": "johnsmith",
"unique_id": "admin-r1-000000000012345",
"admin_type": "Company Admin",
"role_name": "Super Admin",
"default_location": "R1 Location 1",
"default_program": "PHP",
"status": "active",
"member_updated_at": "2024-09-15T00:51:20.000000Z",
"last_activity_date": "2024-01-07T16:50:19.000000Z"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Create/Update Admin
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/admins/1" \
--header "Authorization: Bearer {token}" \
--header "Content-Type: application/json" \
--data "{
\"admin_id\": \"r1-admin-123456-01\",
\"admin_email\": \"xyz@example.com\",
\"admin_username\": \"admin123\",
\"first_name\": \"John\",
\"last_name\": \"Doe\",
\"admin_role\": \"\\\"Admin-Read\\\"\",
\"admin_type\": \"Practitioner\",
\"admin_location\": \"AZ Treatment Center\",
\"admin_program\": \"PHP\",
\"admin_status\": \"active\"
}"
const url = new URL(
"https://api.r1learning.com/api/v2/admins/1"
);
const headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"admin_id": "r1-admin-123456-01",
"admin_email": "xyz@example.com",
"admin_username": "admin123",
"first_name": "John",
"last_name": "Doe",
"admin_role": "\"Admin-Read\"",
"admin_type": "Practitioner",
"admin_location": "AZ Treatment Center",
"admin_program": "PHP",
"admin_status": "active"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200, Success):
{
"error": 0,
"message": "Admin created successfully",
"data": {
"unique_id": "abcxyz",
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"admin_email": "johndoe@example.com",
"admin_role": "Admin-Read",
"admin_type": "Company Admin",
"admin_location": "R1 Location 1",
"admin_program": "General",
"admin_status": "active",
"created_at": "2024-08-30T14:30:00Z"
}
}
Example response (201, Success):
{
"error": 0,
"message": "Admin updated successfully",
"data": [
{
"unique_id": "r1-admin-example",
"username": "AdminExampele",
"first_name": "Admin",
"last_name": "Example",
"email": "admin@example.com",
"role": "Admin-Read",
"status": "active"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Example response (404, Admin Not Found):
{
"error": 1,
"message": "Admin not found",
"details": "The requested admin with UniqueID 'abcxyz' does not exist or is not associated with the given company."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update Admin/User Unique ID
requires authentication
Example request:
curl --request POST \
"https://api.r1learning.com/api/v2/users/1/uniqueId" \
--header "Authorization: Bearer {token}" \
--header "Content-Type: application/json" \
--data "{
\"unique_id\": \"r1-user-1234\"
}"
const url = new URL(
"https://api.r1learning.com/api/v2/users/1/uniqueId"
);
const headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"unique_id": "r1-user-1234"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (201, Success):
{
"message": "Unique ID Updated Successfully",
"data": {
"id": 32687,
"unique_id": "r1-admin-example"
}
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Example response (404, User Not Found):
{
"error": 1,
"message": "User not found",
"details": "User with R1 ID '123' does not exist or is associated with a company outside your access."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Global Username
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/usernames/check/global/xyz123" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/usernames/check/global/xyz123"
);
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
[
{
"username": "testUser",
"is_available": false,
"message": "Username is not available"
},
{
"username": "testUser2",
"is_available": true,
"message": "Username is available"
}
]
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Check Company Username
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/usernames/check/company/1/xyz123" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/usernames/check/company/1/xyz123"
);
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
[
{
"company_id": "1",
"company_username": "FB1234",
"is_available": true,
"message": "base.user_is_available_for_this_company"
},
{
"company_id": "1",
"company_username": "FB12345",
"is_available": false,
"message": "Username \"FB12345\" is already taken for this company"
}
]
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Activity Results
List Activities
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/activities/company/1/details?page=1&limit=50&maxDays=0&userType=1&activityType=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/activities/company/1/details"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"userType": "1",
"activityType": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": "1",
"per_page": "50",
"max_days": "0",
"company_id": "4121",
"***comment": "UserId/ActivityId visible if included in query",
"user_id": "21267",
"user_activity_id": "154340"
},
"activities": [
{
"id": 154340,
"user_id": 21267,
"company_id": 4121,
"topic_name": "Stages of Change (SUD)",
"activity_id": 312,
"activity_name": "Identify My Stage of Change",
"activity_type": "sorting_cards",
"created_at": "2024-04-20T15:03:11.000000Z",
"updated_at": "2024-04-20T21:21:01.000000Z",
"completed_date": "2024-04-20T21:21:01.000000Z",
"completed_status": "Activity Completed",
"report_url": "http://discover.r1learning.com/stages****",
"video_completed": false
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Activity Yes/No Cards
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/activities/company/1/cards?page=1&limit=50&maxDays=0&userType=1&activityType=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/activities/company/1/cards"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"userType": "1",
"activityType": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": "1",
"per_page": "50",
"max_days": "0",
"company_id": "1"
},
"activities": [
{
"user_activity_id": 15205,
"user_id": 21123,
"company_id": 123123,
"topic_id": 111222,
"cards": {
"yes_cards": [
{
"selected_id": 1,
"model_definition": "Maintenance",
"text": "I practice mindfulness and patience to support my substance-free lifestyle"
},
{
"selected_id": 2,
"model_definition": "Maintenance",
"text": "I am grateful for quitting and living a substance-free life"
}
],
"no_cards": [
{
"selected_id": 1,
"model_definition": "Preparation",
"text": "I have recently told others about my plans to quit"
},
{
"selected_id": 2,
"model_definition": "Pre Contemplation",
"text": "There is nothing I really need to change about my drinking or using;I am a fairly normal drinker or user "
}
]
}
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Activity Final Cards
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/activities/company/1/final-cards?page=1&limit=50&maxDays=0&userType=1&activityType=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/activities/company/1/final-cards"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"userType": "1",
"activityType": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": "1",
"per_page": "50",
"max_days": "0",
"company_id": "4132",
"***comment": "UserId/ActivityId visible if included in query",
"user_id": "2157",
"user_activity_id": "15026"
},
"activities": [
{
"user_activity_id": 15026,
"user_id": 2157,
"company_id": 4132,
"cards": [
{
"pyramid_id": 1,
"model_category": "Maintenance",
"card_detail": "I love my substance-free life and act daily to keep it"
},
{
"pyramid_id": 2,
"model_category": "Maintenance",
"card_detail": "I practice mindfulness and patience to support my substance-free lifestyle"
},
{
"pyramid_id": 3,
"model_category": "Maintenance",
"card_detail": "I am grateful for quitting and living a substance-free life"
},
{
"pyramid_id": 4,
"model_category": "Maintenance",
"card_detail": "I participate in healthy activities to avoid stress and reduce anxiety"
},
{
"pyramid_id": 5,
"model_category": "Maintenance",
"card_detail": "I am managing risk situations and/or temptations (triggering people, places, things, and situations) "
},
{
"pyramid_id": 6,
"model_category": "Maintenance",
"card_detail": "I am serving and supporting others who are not using substances"
},
{
"pyramid_id": 7,
"model_category": "Action",
"card_detail": "I am asking others for help"
},
{
"pyramid_id": 8,
"model_category": "Action",
"card_detail": "I am connecting with others and building a new network of healthy non-drinking or using friends"
},
{
"pyramid_id": 9,
"model_category": "Contemplation",
"card_detail": "I can see the benefits of quitting more clearly"
},
{
"pyramid_id": 10,
"model_category": "Action",
"card_detail": "I am not drinking or using, one day at a time"
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Activity Q&As
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/activities/company/1/questions?page=1&limit=50&maxDays=0&userType=1&activityType=0&sortby=1" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/activities/company/1/questions"
);
const params = {
"page": "1",
"limit": "50",
"maxDays": "0",
"userType": "1",
"activityType": "0",
"sortby": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 109,
"total_pages": 3,
"current_page": "1",
"per_page": "50",
"max_days": "0",
"company_id": "2296",
"***comment": "UserId/ActivityId visible if included in query",
"user_id": "32579",
"user_activity_id": "276321"
},
"activities": [
{
"user_activity_id": 276321,
"user_id": 32579,
"company_id": 2296,
"questions": [
{
"question_id": 1,
"question": "What substance did you examine in this activity?",
"question_type": "radio",
"answer": "Alcohol – beer, wine, liquor, hard cider, hard seltzer"
},
{
"question_id": 2,
"question": "As you think about what you've learned and your results, which stage do you think you are in right now?",
"question_type": "radio",
"answer": "Contemplation"
},
{
"question_id": 3,
"question": "How long do you think you have been in this stage?",
"question_type": "radio",
"answer": "1 year"
},
{
"question_id": 4,
"question": "What will be the benefit for you and others as you change your pattern of behavior?",
"question_type": "textarea",
"answer": "Less consequences in my life, probably happier."
},
{
"question_id": 5,
"question": "What individuals, groups, or resources can you turn to for help and support?",
"question_type": "textarea",
"answer": "My support group and friends."
}
]
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Metrics and Analytics
List Company Video Metrics
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/metrics/videos/companies/1?page=1&limit=50" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/metrics/videos/companies/1"
);
const params = {
"page": "1",
"limit": "50",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"data": {
"company_id": "1342",
"video_metrics": [
{
"video_log_id": 1,
"video_url": "",
"user_id": 19876,
"video_title": "Explore the Stages of Change Model",
"start_time_stamp": "2024-01-07T21:50:27.000000Z",
"completion_time_stamp": "2024-01-07T21:50:53.000000Z",
"watched_percentage": "100.00",
"watched_duration": "126.92"
}
]
}
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List User Video Metrics
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/metrics/videos/users/1?page=1&limit=50" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/metrics/videos/users/1"
);
const params = {
"page": "1",
"limit": "50",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 1,
"total_pages": 1,
"current_page": 1,
"per_page": 50
},
"data": {
"user_id": "17434",
"video_metrics": [
{
"video_log_id": 3,
"video_url": "",
"user_id": 17434,
"video_title": "Identify My Stage of Change",
"start_time_stamp": "2024-01-07T21:56:34.000000Z",
"completion_time_stamp": "2024-01-07T21:56:44.000000Z",
"watched_percentage": "100.00",
"watched_duration": "126.954666"
}
]
}
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Global Endpoints
List API Endpoints
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/system/endpoints" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/system/endpoints"
);
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"error": 0,
"message": "",
"data": [
{
"name": "List Companies",
"request": {
"url": {
"host": "http://r1discoverapi.local",
"path": "api/v2/companies",
"query": [
{
"key": "page",
"value": "1",
"description": "The current page number, defaults to 1.",
"disabled": false
},
{
"key": "limit",
"value": "50",
"description": "Number of records to return default 50, max 100.",
"disabled": false
}
],
"raw": "http://r1discoverapi.local/api/v2/companies?page=1&limit=50"
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {token}"
}
],
"body": null,
"description": ""
}
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (403, Unauthorized):
{
"error": 1,
"message": "Unauthorized",
"details": "You do not have the necessary permissions to perform this action."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
List Countries
requires authentication
Example request:
curl --request GET \
--get "https://api.r1learning.com/api/v2/system/countries?search=united&page=1&limit=50" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v2/system/countries"
);
const params = {
"search": "united",
"page": "1",
"limit": "50",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {token}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200, Success):
{
"meta": {
"total_items": 2,
"total_pages": 1,
"current_page": "1",
"per_page": "50"
},
"country_list": [
{
"code": "GB",
"name": "United Kingdom"
},
{
"code": "US",
"name": "United States"
}
]
}
Example response (401, Unauthenticated):
{
"error": 1,
"message": "Unauthenticated",
"details": "Authentication is required to access this resource."
}
Example response (500, Server Error):
{
"error": 1,
"message": "An unexpected error occurred",
"details": "The server encountered an unexpected condition that prevented it from fulfilling the request. Please try again later or contact support if the problem persists."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.