MENU navbar-image

API Versions

API Version 1API Version 2

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."
}
 

Request      

GET api/v2/companies

Headers

Authorization        

Example: Bearer {token}

Query Parameters

companyId   integer  optional    

optional The id of the company (0 returns all companies). Example: 0

stripeCustomerId   string  optional    

optional The Stripe customer ID to filter companies. Example:

stripeSubscriptionId   string  optional    

optional The Stripe subscription ID to filter companies. Example:

page   integer  optional    

optional The current page number, defaults to 1. Example: 1

limit   integer  optional    

optional Number of records to return, default 50, max 100. Example: 50

sortby   integer  optional    

optional Sort companies by (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical), defaults to 1. Example: 1

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."
}
 

Request      

POST api/v2/companies

Headers

Authorization        

Example: Bearer {token}

Content-Type        

Example: application/json

Body Parameters

name   string     

The name of the company. Example: Acme Corp

address1   string     

The primary address of the company. Example: 123 Main St

address2   string  optional    

The secondary address of the company. Example: Suite 456

city   string     

The city of the company. Example: New York

state   string     

The state of the company. Example: NY

zip   string     

The zip code of the company. Example: 10001

country   string     

The country of the company. Example: US

phone   string  optional    

The primary phone number of the company. Example: 555-123-4567

email   string     

The email of the company Super Admin. Example: contact@r1.com

status   string     

The status of the company (published, expired). Example: published

total_licenses   integer     

The total number of licenses. Example: 100

license_duration   string     

The duration of the license (1-month, 1-year). Example: 1-year

stripe_customer_id   string  optional    

The Stripe customer ID. Example:

stripe_subscription_id   string  optional    

The Stripe subscription ID. Example:

subscription_type   string  optional    

The subscription type of the company (freemium, basic, professional, enterprise). Example: basic

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."
}
 

Request      

PUT api/v2/companies/{id}

Headers

Authorization        

Example: Bearer {token}

Content-Type        

Example: application/json

URL Parameters

id   integer     

The ID of the company to update. Example: 1234

Body Parameters

status   string  optional    

Update the status of the company (published, expired). Example: published

total_licenses   integer  optional    

Update the total number of licenses. Example: 10

license_renewal_date   string  optional    

Update the license renewal date. Example: 2025-01-01

stripe_customer_id   string  optional    

The Stripe customer ID. Example:

stripe_subscription_id   string  optional    

The Stripe subscription ID. Example:

subscription_type   string  optional    

The subscription type of the company (freemium, basic, professional, enterprise). Example: individual

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."
}
 

Request      

GET api/v2/companies/topics

Headers

Authorization        

Example: Bearer {token}

Query Parameters

companyId   integer     

The id of the company (0 returns all companies). Example: 0

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

sortby   integer     

Sort companies by (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical). Example: 1

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."
}
 

Request      

GET api/v2/companies/activities

Headers

Authorization        

Example: Bearer {token}

Query Parameters

companyId   integer  optional    

The id of the company, default 0 returns all companies. Example: 0

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

sortby   integer     

Sort companies by (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical). Example: 1

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."
}
 

Request      

GET api/v2/locations/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The company id (0 returns all companies). Example: 0

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

sortby   integer     

Sort companies by (1: Oldest, 2: Newest). Example: 1

locationOrder   integer     

Order of locations (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical). Example: 1

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."
}
 

Request      

POST api/v2/locations/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The ID of the company. Example: 1

Query Parameters

id   integer  optional    

The ID of the location to update. Leave blank for creating a new location. Example:

location_name   string     

The name of the location. Example: Main Office

address1   string  optional    

The primary address. Example: 123 Main St

address2   string  optional    

The secondary address (optional). Example: Apt 4B

city   string     

The city where the facility is located. Example: New York

state   string     

The state where the facility is located. Example: NY

zip   string     

The zip code of the facility. Example: 10001

country   string     

The 2-digit country code for the facility (See List Countries endpoint). Example: US

phone1   string  optional    

The contact phone number for the location. Example: 123-456-7890

email1   string  optional    

The contact email for the location. Example: info@company.com

status   string     

The status of the location (published, pending, draft). Example: published

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."
}
 

Request      

GET api/v2/programs/parent

Headers

Authorization        

Example: Bearer {token}

Query Parameters

page   integer  optional    

The current page number. Default: 1. Example: 1

limit   integer  optional    

Number of records to return. Default: 50, Max: 100. Example: 50

sortBy   integer     

Order of programs (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical). Example: 1

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."
}
 

Request      

GET api/v2/programs/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The company id (0 returns all companies). Example: 0

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

sortby   integer     

Sort companies by (1: Oldest, 2: Newest). Example: 1

programOrder   integer     

Order of programs (1: Oldest, 2: Newest, 3: Alphabetical, 4: Reverse Alphabetical). Example: 1

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."
}
 

Request      

POST api/v2/programs/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The ID of the company. Example: 1

Query Parameters

id   integer  optional    

The ID of the program to update (if updating, leave blank to create). Example:

name   string     

The name of the program. Example: "New Program"

parent_id   integer     

The ID of the parent program. Example: 1

status   string     

string The status of the program (published, pending, draft). Example: published

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."
}
 

Request      

GET api/v2/users/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The company id (0 returns all companies). Example: 0

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userStatus   integer  optional    

1 = active, 2 = inactive, default 0 which returns all users. Example: 0

uniqueID   string  optional    

stringThe unique ID of the user from the integration partner system. Example:

location_id   integer  optional    

Pull users from a location, defaults blank to returns all records. Example:

program_id   integer  optional    

Pull users from a Program, defaults blank to returns all records. Example:

sortby   integer     

User order (1: Oldest, 2: Newest, 3: Least Recently Active, 4: Recently Active). Example: 1

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."
}
 

Request      

POST api/v2/users/{companyId}

Headers

Authorization        

Example: Bearer {token}

Content-Type        

Example: application/json

URL Parameters

companyId   integer     

The ID of the company. Example: 1

Body Parameters

client_id   string     

The unique ID of the user from the tech partner system. Example: r1-user-123456-01

username   string  optional    

The user global username, leave blank to autogenerate. Example: user123

company_username   string  optional    

The company specific username for the user. Example: user123

first_name   string  optional    

The first name of the user. Example: John

last_name   string  optional    

The last name of the user. Example: Doe

initial_password   string  optional    

The initial password for new users only, leave blank to autogenerate. Example:

client_email   string  optional    

The email of the client. Example: xyz@example.com

client_location   string  optional    

The location of the client. Example: AZ Treatment Center

client_program   string  optional    

The program of the client. Example: Virtual Outatient

client_practitioner   string  optional    

The practitioner of the client. Example: practitioner_email@example.com

client_status   string  optional    

The status of the client (active/inactive). Example: active

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."
}
 

Request      

GET api/v2/admins/roles

Headers

Authorization        

Example: Bearer {token}

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."
}
 

Request      

GET api/v2/admins/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The company id (0 returns all companies). Example: 0

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userStatus   integer  optional    

1 = active, 2 = inactive, default 0/blank which returns all users. Example:

uniqueID   string  optional    

The unique ID of the admin from the integration partner system. Example:

location_id   integer  optional    

Pull users from a location, defaults blank to returns all records. Example:

program_id   integer  optional    

Pull users from a Program, defaults blank to returns all records. Example:

practitioners   integer  optional    

1 = Pull only practitioners, 0/blank (default) returns all users. Example:

sortby   integer     

User order (1: Oldest, 2: Newest, 3: Least Recently Active, 4: Recently Active). Example: 1

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."
}
 

Request      

POST api/v2/admins/{companyId}

Headers

Authorization        

Example: Bearer {token}

Content-Type        

Example: application/json

URL Parameters

companyId   integer     

The ID of the company. Example: 1

Body Parameters

admin_id   string     

The unique ID of the admin from the tech partner system. Example: r1-admin-123456-01

admin_email   string  optional    

The email of the admin. Example: xyz@example.com

admin_username   string  optional    

The username of the admin (OK to use email here also). Example: admin123

first_name   string  optional    

The first name of the admin. Example: John

last_name   string  optional    

The last name of the admin. Example: Doe

admin_role   string  optional    

The role of the admin, default Admin-Read (See Admin Roles Endpoint). Example: "Admin-Read"

admin_type   string  optional    

The admin type of the admin. Example: Practitioner

admin_location   string  optional    

The location name. Example: AZ Treatment Center

admin_program   string  optional    

The program name. Example: PHP

admin_status   string  optional    

The status of the admin (active or inactive). Example: active

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."
}
 

Request      

POST api/v2/users/{id}/uniqueId

Headers

Authorization        

Example: Bearer {token}

Content-Type        

Example: application/json

URL Parameters

id   integer     

The R1 ID of the user/admin to update. Example: 1

Body Parameters

unique_id   string     

The new unique ID (integration partner unique ID) for the member. Example: r1-user-1234

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."
}
 

Request      

GET api/v2/usernames/check/global/{username}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

username   string     

Global username to check. Example: xyz123

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."
}
 

Request      

GET api/v2/usernames/check/company/{companyId}/{companyUsername}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The ID of the company. Example: 1

companyUsername   string     

Company-specific username to check. Example: xyz123

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."
}
 

Request      

GET api/v2/activities/company/{companyId}/details

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The id of the company. Example: 1

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userId   integer  optional    

The R1 ID of the user. If provided, returns all activities for this user in the specified company. Example:

uniqueId   string  optional    

The integration partner ID of the user. If provided, returns all activities for this user in the specified company. Example:

userActivityId   integer  optional    

The ID of the specific user activity. If provided, returns details for this activity only. Example:

userType   integer  optional    

The type of user. 0 for all, 1 for Users, 2 for Admins. Example: 1

activityType   integer  optional    

The type of activity. 0 for all, 1 for Pyramid, 2 for Explore. Example: 0

topicId   integer  optional    

The ID of the topic. If provided, returns all activities for this topic in the specified company. Example:

activityId   integer  optional    

The ID of the activity. If provided, returns all activities for this activity in the specified company. Example:

sortby   integer     

User order (1: Oldest, 2: Newest). Example: 1

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."
}
 

Request      

GET api/v2/activities/company/{companyId}/cards

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The id of the company. Example: 1

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userId   integer  optional    

The R1 ID of the user. If provided, returns all activities for this user in the specified company. Example:

uniqueId   string  optional    

The integration partner ID of the user. If provided, returns all activities for this user in the specified company. Example:

userActivityId   integer  optional    

The ID of the specific user activity. If provided, returns details for this activity only. Example:

userType   integer  optional    

The type of user. 0 for all, 1 for Users, 2 for Admins. Example: 1

activityType   integer  optional    

The type of activity. 0 for all, 1 for Pyramid, 2 for Definition. Example: 0

topicId   integer  optional    

The ID of the topic. If provided, returns all activities for this topic in the specified company. Example:

activityId   integer  optional    

The ID of the activity. If provided, returns all activities for this activity in the specified company. Example:

sortby   integer     

User order (1: Oldest, 2: Newest). Example: 1

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."
}
 

Request      

GET api/v2/activities/company/{companyId}/final-cards

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The id of the company. Example: 1

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userId   integer  optional    

The R1 ID of the user. If provided, returns all activities for this user in the specified company. Example:

uniqueId   string  optional    

The integration partner ID of the user. If provided, returns all activities for this user in the specified company. Example:

userActivityId   integer  optional    

The ID of the specific user activity. If provided, returns details for this activity only. Example:

userType   integer  optional    

The type of user. 0 for all, 1 for Users, 2 for Admins. Example: 1

activityType   integer  optional    

The type of activity. 0 for all, 1 for Pyramid, 2 for Explore. Example: 0

topicId   integer  optional    

The ID of the topic. If provided, returns all activities for this topic in the specified company. Example:

activityId   integer  optional    

The ID of the activity. If provided, returns all activities for this activity in the specified company. Example:

sortby   integer     

User order (1: Oldest, 2: Newest). Example: 1

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."
}
 

Request      

GET api/v2/activities/company/{companyId}/questions

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The id of the company. Example: 1

Query Parameters

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50

maxDays   integer  optional    

Pull records from last x days, default 0 which returns all records. Example: 0

userId   integer  optional    

The ID of the user. If provided, returns all activities for this user in the specified company. Example:

uniqueId   string  optional    

The integration partner ID of the user. If provided, returns all activities for this user in the specified company. Example:

userActivityId   integer  optional    

The ID of the specific user activity. If provided, returns details for this activity only. Example:

userType   integer  optional    

The type of user. 0 for all, 1 for Users, 2 for Admins. Example: 1

activityType   integer  optional    

The type of activity. 0 for all, 1 for Pyramid, 2 for Definition. Example: 0

topicId   integer  optional    

The ID of the topic. If provided, returns all activities for this topic in the specified company. Example:

activityId   integer  optional    

The ID of the activity. If provided, returns all activities for this activity in the specified company. Example:

sortby   integer     

User order (1: Oldest, 2: Newest). Example: 1

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."
}
 

Request      

GET api/v2/metrics/videos/companies/{companyId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

companyId   integer     

The ID of the company. Example: 1

Query Parameters

page   integer  optional    

The page number for pagination. Default: 1: Example: 1

limit   integer  optional    

The number of records per page. Default: 50, Max: 100: Example: 50

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."
}
 

Request      

GET api/v2/metrics/videos/users/{userId}

Headers

Authorization        

Example: Bearer {token}

URL Parameters

userId   integer     

The ID of the user. Example: 1

Query Parameters

page   integer  optional    

The page number for pagination. Default: 1: Example: 1

limit   integer  optional    

The number of records per page. Default: 50, Max: 100: Example: 50

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."
}
 

Request      

GET api/v2/system/endpoints

Headers

Authorization        

Example: Bearer {token}

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."
}
 

Request      

GET api/v2/system/countries

Headers

Authorization        

Example: Bearer {token}

Query Parameters

search   string  optional    

optional Search term to filter countries. Example: united

page   integer     

The current page number, defaults to 1. Example: 1

limit   integer     

Number of records to return default 50, max 100. Example: 50