COSI API (0.1.0)

Download OpenAPI specification:

COSI API

The COSI API provides endpoints for managing a hearing assessment. The API handles authentication through magic links and JWT tokens, with different access levels for Super Admins, Admins, and Care Team members across various resources like clients, team members, content blocks, and organizations. The core functionality revolves around COSI (Client Oriented Scale of Improvement) assessments, which include managing questions, needs, and outcomes for clients' hearing situations, along with supporting features like email/SMS communications, reporting capabilities, and organization-specific branding.

This API documentation should be used in conjunction with the COSI 2.0 Integration Guide, which provides essential context about the system's workflow and business logic. The Integration Guide explains the two main organization types (In Person and Remote OTC) and their distinct assessment timelines, while this API documentation details the specific endpoints needed to implement those workflows. Together, these resources enable developers to properly sequence API calls through the complete COSI lifecycle - from client creation through assessment and outcomes stages.

Features

  • Authentication and user management
  • Client management
  • Notification delivery
  • Team member operations
  • Content management
  • Reporting capabilities

Auth

Authentication and authorization operations. Only the management of end users and related COSI operations are subject to authentication. Authentication for resources is handled via magic links and JWT tokens.

Operations:

  • Request a magic link
  • Verify a magic link
  • Refresh a JWT token
  • Logout

Roles:

Super Admin: Full access

Admin: Full access

Care Team: Full access

Request magic link for login

Requests a magic link for password-less authentication.

The process:

  • Validates email format
  • Checks if user exists
  • Sends magic link email if user is active
  • Returns same response regardless of user existence (for security)

The magic link:

  • Is valid for 15 minutes
  • Can only be used once
  • Includes a JWT token with user email
Request Body schema: application/json
required
email
required
string <email> (Email)

Email address to send magic link to

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "message": "If your email is registered, you will receive a magic link"
}

Verify magic link and login

Verifies a magic link token and creates an authentication session.

The verification:

  • Validates token authenticity
  • Checks token expiration
  • Confirms user status
  • Creates refresh and access tokens

Returns:

  • Access token (15 minute validity)
  • Refresh token (14 day validity)
  • User information
  • Organization details (if applicable)
query Parameters
magic_link_token
required
string (Magic Link Token)

Responses

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e",
  • "user": {
    }
}

Verify JWT token

Verifies a JWT token.

The verification:
- Validates token authenticity
- Checks token expiration
- Confirms user status
- Does NOT authenticate user yet

Returns:
- 200 if token is valid and user can set password
- 400 if token is invalid or expired
query Parameters
token
required
string (Token)

Responses

Response samples

Content type
application/json
null

Set user password and login

Sets the user's password after verifying the password setup JWT token and logs them in.

The process:
- Verifies password setup token
- Encrypts the provided password using bcrypt
- Saves encrypted password to user record
- Activates user if they were invited
- Creates access and refresh tokens

Returns:
- Access token (15 minute validity)
- Refresh token (14 day validity)
- User information
- Organization details (if applicable)
Request Body schema: application/json
required
password
required
string (Password)

New password to set for the user (must contain at least 8 characters, 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character)

token
required
string (Token)

Token from the password setup link

Responses

Request samples

Content type
application/json
{
  • "password": "SecurePass123!",
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci..."
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e",
  • "user": {
    }
}

Login with email and password

Authenticates a user using their email and password.

The process:
- Validates email and password format
- Finds user by email with proper role and status checks
- Verifies password using bcrypt
- Creates access and refresh tokens
- Activates invited users upon successful login

Security:
- Password is verified using bcrypt hashing
- Only active or invited users can login
- Only non-client users can login (superadmins or users with non-client roles)
- Returns same error for invalid email or password (for security)

Returns:
- Access token (15 minute validity)
- Refresh token (14 day validity)
- User information
- Organization details (if applicable)
Request Body schema: application/json
required
email
required
string <email> (Email)

User's email address

password
required
string (Password)

User's password

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "password": "securepassword123"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e",
  • "user": {
    }
}

Refresh access token

Generates a new access token using a valid refresh token.

The process:

  • Validates refresh token
  • Updates last used timestamp
  • Creates new access token
  • Returns updated user information

The refresh token:

  • Must be valid and not expired
  • Can be used multiple times within its validity period
Request Body schema: application/json
required
refresh_token
required
string (Refresh Token)

Valid refresh token from previous authentication

Responses

Request samples

Content type
application/json
{
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e"
}

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "user": {
    }
}

Logout user

Invalidates the current refresh token, effectively logging out the user.

The process:

  • Finds and deletes the refresh token
  • Returns success regardless of token existence
  • Prevents token reuse

Note: Access tokens will still be valid until expiration (15 minutes).

Request Body schema: application/json
required
refresh_token
required
string (Refresh Token)

Valid refresh token from previous authentication

Responses

Request samples

Content type
application/json
{
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e"
}

Response samples

Content type
application/json
{
  • "message": "Successfully logged out"
}

Look up user email and organization

Looks up a user by email and returns their organization and authentication method.

Used by the frontend to determine which authentication method to use for a user.
Users must authenticate with their configured auth_provider - no fallbacks.

Security: Returns the same response structure regardless of whether the email exists
to prevent user enumeration attacks.

Returns:
- Organization information (if user exists)
- User's configured auth_provider (if user exists and has one)
query Parameters
email
required
string (Email)

Responses

Response samples

Content type
application/json
{
  • "organization": {
    },
  • "auth_provider": "entra_id"
}

Initiate Provider OAuth login

Initiates the OAuth 2.0 authentication flow for a specific organization.

The process:

  • Creates authorization URL with state parameter
  • Returns URL for frontend to redirect user to SSO provider

Returns:

  • Authorization URL to redirect user to SSO provider
  • State parameter for security
path Parameters
auth_provider
required
string (Auth Provider)
organization_id
required
integer (Organization Id)

Responses

Response samples

Content type
application/json
{}

Handle Provider OAuth callback

Handles the callback from OAuth 2.0 authentication.

The process:

  • Receives authorization code from SSO provider (Okta, Google, or Entra ID)
  • Exchanges code for tokens using client secret
  • Gets user information from SSO provider
  • Creates or updates user in database
  • Creates SSO token for secure token delivery
  • Redirects to frontend with session token

Query Parameters:

  • code: Authorization code from SSO provider
  • state: State parameter for security validation

Returns:

  • HTTP 302 redirect to frontend with SSO token
path Parameters
auth_provider
required
string (Auth Provider)
query Parameters
code
required
string (Code)
state
required
string (State)

Responses

Response samples

Content type
application/json
null

Retrieve SSO token

Retrieves access and refresh tokens from a temporary SSO token. Used after OAuth callback to securely deliver tokens to frontend.

The session:

  • Must be valid and not expired
  • Contains access and refresh tokens
path Parameters
token
required
string (Token)

Responses

Response samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "refresh_token": "8f7d3f45-9f1a-4a5b-8e6c-7d2c3b1a9f0e",
  • "user": {
    }
}

Request password reset

Initiates a password reset process by sending a reset link to the user's email.

The process:
- Validates email format
- Checks if user exists with password authentication
- Sends password reset email with secure token
- Returns same response regardless of user existence (for security)

The reset link:
- Is valid for 15 minutes
- Contains a JWT token with user email
- Links to frontend password reset page

Security:
- Returns same response for valid and invalid emails (prevents user enumeration)
- Only users with password authentication can reset passwords
- Reset tokens are time-limited and single-use
Request Body schema: application/json
required
email
required
string <email> (Email)

User's email address

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "message": "If an account with that email exists, you will receive a password reset link shortly."
}

Reset user password

Resets a user's password using a valid reset token from the forgot-password email.

The process:
- Validates the reset token (JWT with email and expiration)
- Verifies token hasn't expired (15 minute validity)
- Finds user by email from token
- Encrypts and saves the new password
- Returns success confirmation

Security:
- Token must be valid and not expired
- Only users with password authentication can reset
- New password must meet security requirements
- User must log in separately after reset

Returns:
- 200 if password reset successfully
- 400 if token is invalid or expired
Request Body schema: application/json
required
token
required
string (Token)

Reset token from the password reset email

password
required
string (Password) >= 8 characters

New password to set (must contain at least 8 characters, 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character)

Responses

Request samples

Content type
application/json
{
  • "token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
  • "password": "NewSecurePass123!"
}

Response samples

Content type
application/json
{
  • "message": "Password reset successfully"
}

Users

Accessible By: Super Admins

Read only User operations. All operations are restricted to Super Admins.

Roles:

Super Admin: Full access on Users across all Organizations

Admin: No access

Care Team: No access ,

List and filter users

Retrieves a list of users with pagination and search support. Only accessible by Super Admins.

Users include:

  • Clients
  • Team Members
  • Organization Admins
  • Super Admins

Supports filtering by:

  • Search term (across name, email)
  • Pagination parameters

Results include:

  • User details
  • Associated organizations
  • Organization roles
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

_sort
string ( Sort)
Default: "last_name"

Field to sort by. Valid options: id, first_name, last_name, email, status, created_at

_order
string ( Order)
Default: "ASC"

Sort order: ASC or DESC

Q (string) or Q (null) (Q)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get detailed user information

Retrieves detailed information about a specific user. Only accessible by Super Admins.

The response includes:

  • Basic user information
  • Organization memberships
  • Associated jobs
  • Communication preferences
  • System access details
Authorizations:
HTTPBearer
path Parameters
user_id
required
integer (User Id)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "email": "user@example.com",
  • "first_name": "John",
  • "last_name": "Doe",
  • "status": "active",
  • "role": "client",
  • "organizations": [
    ],
  • "jobs": [
    ],
  • "phone": "+61412345678",
  • "sms_enabled": true,
  • "last_login": "2024-01-01T00:00:00Z"
}

Clients

Clients are Users that are the end users of the COSI application.

Operations:

  • List Clients
  • Get a Client
  • Create a Client
  • Update a Client

Roles:

Super Admin: Full access on Clients across all Organizations

Admin: Access to Clients in their Organization

Care Team: Access to Clients in their Organization

List and filter clients

Lists clients with optional filtering, sorting, and pagination.

Different users have different access levels:

  • Super Admins can see clients across all organizations
  • Admins and Care Team members can only see clients in their organization
  • Clients cannot access this endpoint

Supports filtering by:

  • Search term (name, email, mobile_phone_number)
  • Organization type (in_person, remote_otc)
  • COSI status (created, assessment_scheduled, assessment_done, outcomes_scheduled, outcomes_sent, outcomes_done, archived)
  • Order date ranges (all, last_7_days, last_14_days, last_30_days, last_100_days)

Supports sorting by:

  • User fields: first_name, last_name, email, mobile_phone_number
  • COSI fields: status, evaluation_date, order_date, outcomes_date
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

Q (string) or Q (null) (Q)

Search term to filter clients by name or email

OrganizationType (string) or Organization Type (null) (Organization Type)

Filter by in_person or remote_otc organization type

CosiStatus (string) or Status (null) (Status)

Filter by created, assessment_scheduled, assessment_done, assessment_done, outcomes_scheduled, outcomes_sent, outcomes_done, or archived status

order_date
string (Order Date)
Default: "all"

Filter by order date range: all, last_7_days, last_14_days, last_30_days, last_100_days, past, today

evaluation_date
string (Evaluation Date)
Default: "all"

Filter by evaluation date range: all, last_7_days, last_14_days, last_30_days, last_100_days, past, today

outcomes_date
string (Outcomes Date)
Default: "all"

Filter by outcomes date range: all, last_7_days, last_14_days, last_30_days, last_100_days, past, today

_sort
string ( Sort)
Default: "last_name"

Field to sort by. Valid options: first_name, last_name, email, mobile_phone_number, status, evaluation_date, order_date, outcomes_date

_order
string ( Order)
Default: "ASC"

Sort order: ASC or DESC

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new client

Creates a new client and associated COSI.

The client will be associated with:

  • For Super Admins: The organization specified in organization_name
  • For Admins and Care Team members: Their current organization

For In Person organizations:

  • Requires evaluation_date
  • Optionally accepts outcomes_date

For Remote OTC organizations:

  • Requires order_date

Returns the created client with their COSI details.

Authorizations:
HTTPBearer
Request Body schema: application/json
required
First Name (string) or First Name (null) (First Name)

Client's first name

Last Name (string) or Last Name (null) (Last Name)

Client's last name

Email Address (string) or Email Address (null) (Email Address)

Client's email address for notifications and communication

Mobile Phone (string) or Mobile Phone (null) (Mobile Phone)

Client's mobile phone number in E.164 format (e.g., +15105551212) for SMS notifications

Organization (string) or Organization (null) (Organization)

Organization name - required for Super Admins, ignored for Admins and Care Team members

Evaluation Date (string) or Evaluation Date (null) (Evaluation Date)

Evaluation date - required for In Person organizations

Order Date (string) or Order Date (null) (Order Date)

Order date - required for Remote OTC organizations

External ID (string) or External ID (null) (External ID)

External Id - optional

Responses

Request samples

Content type
application/json
{
  • "first_name": "string",
  • "last_name": "string",
  • "email": "string",
  • "mobile_phone_number": "string",
  • "organization_name": "string",
  • "evaluation_date": "2019-08-24T14:15:22Z",
  • "order_date": "2019-08-24T14:15:22Z",
  • "external_id": "string"
}

Response samples

Content type
application/json
Example
{
  • "id": 123,
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john@example.com",
  • "external_id": "ABC1234567890",
  • "mobile_phone_number": "+15105551212",
  • "status": "active",
  • "created_at": "2024-01-01T00:00:00Z",
  • "cosi": {
    }
}

Get a specific client's details

Retrieves detailed information about a specific client including their COSI data.

Different users have different access levels:

  • Super Admins can access any client
  • Admins and Care Team members can only access clients in their organization
Authorizations:
HTTPBearer
path Parameters
user_id
required
integer (User Id)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john@example.com",
  • "mobile_phone_number": "+15105551212",
  • "external_id": "ABC1234567890",
  • "status": "active",
  • "created_at": "2024-01-01T00:00:00Z",
  • "cosi": {
    }
}

Update a client's information

Updates a client's personal information and/or COSI details.

Different users have different access levels:

  • Super Admins can update any client
  • Admins and Care Team members can only update clients in their organization

Supports updating:

  • Personal information (name, email, phone)
  • COSI dates (evaluation, order, outcomes)
  • COSI status (archive)

Note: Date updates will trigger appropriate COSI status changes and email notifications.

Authorizations:
HTTPBearer
path Parameters
user_id
required
integer (User Id)
Request Body schema: application/json
required
First Name (string) or First Name (null) (First Name)

Client's first name

Last Name (string) or Last Name (null) (Last Name)

Client's last name

Email (string) or Email (null) (Email)

Client's email address for notifications

Mobile Phone Number (string) or Mobile Phone Number (null) (Mobile Phone Number)

Client's mobile phone number in E.164 format (e.g., +15105551212) for SMS notifications

Outcomes Date (string) or Outcomes Date (null) (Outcomes Date)

Date for In Person outcomes - updates COSI status to outcomes_scheduled

Evaluation Date (string) or Evaluation Date (null) (Evaluation Date)

Date for In Person evaluation - updates COSI status to assessment_scheduled

Order Date (string) or Order Date (null) (Order Date)

Date for Remote OTC order - updates COSI status based on current stage

Archive (boolean) or Archive (null) (Archive)

When true, archives the client's COSI

Archive Reason (string) or Archive Reason (null) (Archive Reason)

Reason for archiving the COSI

External Id (string) or External Id (null) (External Id)

External Id - optional

Responses

Request samples

Content type
application/json
{
  • "first_name": "string",
  • "last_name": "string",
  • "email": "string",
  • "mobile_phone_number": "string",
  • "outcomes_date": "2019-08-24T14:15:22Z",
  • "evaluation_date": "2019-08-24T14:15:22Z",
  • "order_date": "2019-08-24T14:15:22Z",
  • "archive": true,
  • "archive_reason": "string",
  • "external_id": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "email": "updated@example.com",
  • "first_name": "Updated",
  • "last_name": "Name",
  • "mobile_phone_number": "+15105551212",
  • "cosi": {
    }
}

Team Members

Team Members are Users that are administrators or care team members for a particular Organization.

Operations:

  • List Team Members
  • Create a Team Member
  • Update a Team Member
  • Send an Invite to a Team Member

Roles:

Super Admin: Full access on Team Members across all Organizations

Admin: Access to Team Members in their Organization

Care Team: Access to Team Members in their Organization

List team members

Retrieves a list of team members with pagination and search support.

Access levels:

  • Super Admins: Can view all team members across organizations
  • Admins: Can only view team members in their organization
  • Care Team: Can only view team members in their organization

Team members include:

  • Admins
  • Care Team Members
  • Support Staff

Supports filtering by:

  • Search term (across name and email)
  • Pagination parameters

Results include:

  • User details
  • Associated organizations
  • Organization roles
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

Q (string) or Q (null) (Q)

Search term

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create team member

Creates a new team member and sends an invitation email.

Required fields:

  • email: Team member's email address
  • first_name: First name
  • last_name: Last name
  • role: Team member role (admin, care_team)
  • organization_name: Organization name (required for Super Admins)

The team member will receive:

  • Magic link for account setup
  • Organization-specific branding
Authorizations:
HTTPBearer
Request Body schema: application/json
required
first_name
required
string (First Name)

Team member's first name

last_name
required
string (Last Name)

Team member's last name

email
required
string (Email)

Team member's email address for login and notifications

Role (string) or Role (null) (Role)

Team member's role (admin, care_team, super_admin)

Organization Name (string) or Organization Name (null) (Organization Name)

Organization name (required for Super Admins creating team members)

Responses

Request samples

Content type
application/json
{
  • "first_name": "string",
  • "last_name": "string",
  • "email": "string",
  • "role": "string",
  • "organization_name": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "email": "newteam@example.com",
  • "first_name": "Jane",
  • "last_name": "Smith",
  • "status": "invited",
  • "organizations": [
    ],
  • "user_organizations": [
    ]
}

Update team member status

Updates a team member's status. Only accessible by Organization Admins and Super Admins.

Available statuses:

  • inactive: Team member access is disabled
Authorizations:
HTTPBearer
path Parameters
id
required
integer (Id)
Request Body schema: application/json
required
Status (string) or Status (null) (Status)

New status for the team member (e.g., 'inactive' to disable access)

Email (string) or Email (null) (Email)

Team member's email address for login and notifications

First Name (string) or First Name (null) (First Name)

Team member's first name

Last Name (string) or Last Name (null) (Last Name)

Team member's last name

Role (string) or Role (null) (Role)

Team member's role (admin, care_team, super_admin)

Auth Provider (string) or Auth Provider (null) (Auth Provider)

Team member's auth provider (okta, google, magic_link)

Organization Name (string) or Organization Name (null) (Organization Name)

Team member's organization name. Only Super Admins can change this.

Responses

Request samples

Content type
application/json
{
  • "status": "string",
  • "email": "string",
  • "first_name": "string",
  • "last_name": "string",
  • "role": "string",
  • "auth_provider": "string",
  • "organization_name": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "email": "team@example.com",
  • "first_name": "John",
  • "last_name": "Doe",
  • "status": "inactive",
  • "organizations": [
    ],
  • "user_organizations": [
    ]
}

Get team member details

Retrieves detailed information for a specific team member.

Access levels:

  • Super Admins: Can view any team member across organizations
  • Admins: Can only view team members in their organization
  • Care Team: Can only view team members in their organization

Returns:

  • first_name: Team member's first name
  • last_name: Team member's last name
  • email: Team member's email address
  • status: Team member's current status (active, inactive, invited)
  • organization_name: Team member's organization name
  • role: Team member's role in the organization
  • auth_provider: Team member's auth provider
  • created_at: Timestamp when the team member was created
Authorizations:
HTTPBearer
path Parameters
id
required
integer (Id)

Responses

Response samples

Content type
application/json
{
  • "first_name": "John",
  • "last_name": "Doe",
  • "email": "john.doe@example.com",
  • "status": "active",
  • "organization_name": "Example Clinic",
  • "role": "care_team",
  • "auth_provider": "magic_link",
  • "created_at": "2024-01-01T00:00:00Z"
}

Resend team member invitation

Resends the invitation email to a team member. Only accessible by Organization Admins and Super Admins.

The new invitation will:

  • Generate a new magic link
  • Reset any previous invitation links
  • Include organization branding
  • Expire after 7 days
Authorizations:
HTTPBearer
path Parameters
id
required
integer (Id)

Responses

Response samples

Content type
application/json
null

Jobs

Jobs are scheduled tasks such as sending email and SMS messages.

Operations:

  • Run all pending Jobs
  • Run a specific Job

Roles:

API: Execution of jobs on a peridoic basis.

Super Admins: Run individual jobs manually.

Admins: No access

Care Team: No access

Run a specific job

Manually triggers execution of a specific job. Only accessible by Super Admins.

Jobs can include:

  • Sending email or SMS invitations
  • Sending email summaries
Authorizations:
HTTPBearer
path Parameters
job_id
required
integer (Job Id)

Responses

Response samples

Content type
application/json
{
  • "message": "Job completed"
}

Run all pending jobs

Executes all pending scheduled jobs. Only accessible via API key authentication.

Jobs are processed in order of scheduled time.

header Parameters
X-API-Key
required
string (X-Api-Key)

Responses

Response samples

Content type
application/json
{
  • "message": "Jobs completed"
}

Organizations

Organizations are top-level entities that use the COSI application. Organization can be configured with a logo, name, and other branding elements.

Operations:

  • List Organizations
  • Get an Organization
  • Create an Organization
  • Update an Organization
  • Upload a Logo for an Organization

Roles:

Super Admin: Full access

Admin: No access

Care Team: No access

List supported countries

Get list of countries that have configured Twilio numbers for SMS notifications.

Each country entry includes:

  • Country code (2-letter ISO code)
  • Country name

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

List organizations

Retrieves a list of organizations with pagination and search support.

Access levels:

  • Super Admins: Can view all organizations (archived and non-archived)
  • Organization Admins: Can only view their organizations (by default shows non-archived only)
  • Care Team: Can only view their organizations (by default shows non-archived only)

Supports filtering by:

  • Search term (across name and type)
  • Archived status (true/false) - if not specified, non-superadmin users see only non-archived organizations
  • Pagination parameters
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

Q (string) or Q (null) (Q)

Search term

Archived (boolean) or Archived (null) (Archived)

Filter by archived status (true/false)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create organization

Creates a new organization. Only accessible by Super Admins.

Required fields:

  • name: Organization name (must be unique)
  • organization_type: Type of organization (in_person, remote_otc)
  • assessment_send_days: Days to send assessment
  • outcomes_send_days: Days to send outcomes
  • country: Country code for SMS notifications
  • primary_color: Brand color (hex code)
  • button_text_color: Button text color (hex code)
  • compact_display: Whether to use compact display mode for mobile web views
  • mail_from_name: Name to use in email notifications
  • store_pii: Whether the organization stores PII
  • routing_email: Email address used for routing emails when store_pii is false

Optional fields:

  • auth_provider: Authentication provider (okta, magic_link)
Authorizations:
HTTPBearer
Request Body schema: application/json
required
name
required
string (Name)

Organization's name

organization_type
required
string (Organization Type)

Type of organization (in_person or remote_otc)

Assessment Send Days (integer) or Assessment Send Days (null) (Assessment Send Days)

Number of days after which to send assessment reminders (optional; null when send_communications is false)

Outcomes Send Days (integer) or Outcomes Send Days (null) (Outcomes Send Days)

Number of days after which to send outcomes reminders (optional; null when send_communications is false)

Country (string) or Country (null) (Country)

Country code where organization operates

Mail From Name (string) or Mail From Name (null) (Mail From Name)

Display name used in email communications

Primary Color (string) or Primary Color (null) (Primary Color)

Primary brand color in hex format (e.g., #FF0000)

Button Text Color (string) or Button Text Color (null) (Button Text Color)

Button text color in hex format (e.g., #FFFFFF)

compact_display
boolean (Compact Display)
Default: false

Whether to use compact display mode for mobile web views

Auth Provider (string) or Auth Provider (null) (Auth Provider)

Authentication provider for the organization (okta, magic_link)

store_pii
required
boolean (Store Pii)

Whether the organization stores PII

send_communications
boolean (Send Communications)
Default: true

Whether the organization sends communications (emails, SMS)

Routing Email (string) or Routing Email (null) (Routing Email)

Email address used for routing emails when store_pii is false

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "organization_type": "string",
  • "assessment_send_days": 0,
  • "outcomes_send_days": 0,
  • "country": "string",
  • "mail_from_name": "string",
  • "primary_color": "string",
  • "button_text_color": "string",
  • "compact_display": false,
  • "auth_provider": "string",
  • "store_pii": true,
  • "send_communications": true,
  • "routing_email": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "New Clinic",
  • "organization_type": "in_person",
  • "assessment_send_days": 7,
  • "outcomes_send_days": 30,
  • "primary_color": "#FF0000",
  • "button_text_color": "#FFFFFF",
  • "compact_display": false,
  • "country": "AU",
  • "mail_from_name": "New Clinic Support",
  • "auth_provider": "magic_link",
  • "store_pii": false
}

Update organization

Updates an existing organization's details. Only accessible by Super Admins.

Updatable fields:

  • name: Organization name (must remain unique)
  • organization_type: Type of organization
  • assessment_send_days: Days to send assessment
  • outcomes_send_days: Days to send outcomes
  • country: Country code
  • primary_color: Brand color
  • button_text_color: Button text color
  • compact_display: Compact display mode for mobile web views
  • mail_from_name: Email sender name
  • auth_provider: Authentication provider (okta, magic_link)
  • store_pii: Whether the organization stores PII
  • send_communications: Whether the organization sends communications (emails, SMS)
  • routing_email: Email address used for routing emails when store_pii is false
Authorizations:
HTTPBearer
path Parameters
organization_id
required
integer (Organization Id)
Request Body schema: application/json
required
Name (string) or Name (null) (Name)

Organization's name

Organization Type (string) or Organization Type (null) (Organization Type)

Type of organization (in_person or remote_otc)

Assessment Send Days (integer) or Assessment Send Days (null) (Assessment Send Days)

Number of days after which to send assessment reminders

Outcomes Send Days (integer) or Outcomes Send Days (null) (Outcomes Send Days)

Number of days after which to send outcomes reminders

Country (string) or Country (null) (Country)

Country code where organization operates

Mail From Name (string) or Mail From Name (null) (Mail From Name)

Display name used in email communications

Primary Color (string) or Primary Color (null) (Primary Color)

Primary brand color in hex format (e.g., #FF0000)

Button Text Color (string) or Button Text Color (null) (Button Text Color)

Button text color in hex format (e.g., #FFFFFF)

Compact Display (boolean) or Compact Display (null) (Compact Display)

Whether to use compact display mode for mobile web views

Auth Provider (string) or Auth Provider (null) (Auth Provider)

Authentication provider for the organization (okta, magic_link)

Store Pii (boolean) or Store Pii (null) (Store Pii)

Whether the organization stores PII

Send Communications (boolean) or Send Communications (null) (Send Communications)

Whether the organization sends communications (emails, SMS)

Archived (boolean) or Archived (null) (Archived)

Whether the organization is archived

Routing Email (string) or Routing Email (null) (Routing Email)

Email address used for routing emails when store_pii is false

Websocket Stt Enabled (boolean) or Websocket Stt Enabled (null) (Websocket Stt Enabled)

Whether to use the Deepgram WebSocket STT path (true) or the HTTP fallback (false)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "organization_type": "string",
  • "assessment_send_days": 0,
  • "outcomes_send_days": 0,
  • "country": "string",
  • "mail_from_name": "string",
  • "primary_color": "string",
  • "button_text_color": "string",
  • "compact_display": true,
  • "auth_provider": "string",
  • "store_pii": true,
  • "send_communications": true,
  • "archived": true,
  • "routing_email": "string",
  • "websocket_stt_enabled": true
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "Updated Clinic Name",
  • "organization_type": "in_person",
  • "assessment_send_days": -14,
  • "outcomes_send_days": 45,
  • "primary_color": "#00FF00",
  • "button_text_color": "#000000",
  • "compact_display": true,
  • "country": "AU",
  • "mail_from_name": "Updated Clinic Support",
  • "auth_provider": "okta",
  • "store_pii": true,
  • "routing_email": "email_routing@example.com"
}

Get organization details

Retrieves detailed information about a specific organization. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
organization_id
required
integer (Organization Id)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "Example Clinic",
  • "organization_type": "in_person",
  • "assessment_send_days": 7,
  • "outcomes_send_days": 30,
  • "primary_color": "#FF0000",
  • "button_text_color": "#FFFFFF",
  • "compact_display": false,
  • "country": "AU",
  • "mail_from_name": "Example Clinic Support",
  • "auth_provider": "magic_link",
  • "store_pii": false
}

Upload organization logo

Uploads a logo image for an organization. Only accessible by Super Admins.

Requirements:

  • File must be an image
  • Supported formats: PNG, JPG, JPEG
  • Logo will be stored in blob storage
  • Previous logo (if any) will be replaced
Authorizations:
HTTPBearer
path Parameters
organization_id
required
integer (Organization Id)
Request Body schema: multipart/form-data
required
logo
required
string <binary> (Logo)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "Example Clinic",
  • "organization_type": "IN_PERSON",
  • "assessment_send_days": 7,
  • "outcomes_send_days": 30,
  • "primary_color": "#FF0000",
  • "button_text_color": "#FFFFFF",
  • "compact_display": false,
  • "country": "AU",
  • "mail_from_name": "Example Clinic Support",
  • "auth_provider": "magic_link",
  • "store_pii": false
}

Bulk create clients for organization

Creates multiple clients for a specific organization in bulk. Only accessible by Super Admins.

This endpoint creates clients with:

  • Generated non-sequential identifiers that prefixed by the identifier_prefix
  • CLIENT role by default
  • Active status
  • Associated with the specified organization

Parameters:

  • identifier_prefix: Prefix for client identifiers (e.g., 'AB', 'DM')
  • count: Number of clients to create (1-1000)

Generated clients will have:

  • External ID: {identifier_prefix}-0034575, {identifier_prefix}-0123456, etc. (7-digit random numbers)
  • First name: blank
  • Last name: blank
  • Email: blank
Authorizations:
HTTPBearer
path Parameters
organization_id
required
integer (Organization Id)
Request Body schema: application/json
required
identifier_prefix
required
string (Identifier Prefix)

Prefix for the client identifiers (e.g., 'AB', 'DM')

count
required
integer (Count) [ 1 .. 1000 ]

Number of clients to create (1-1000)

Responses

Request samples

Content type
application/json
{
  • "identifier_prefix": "string",
  • "count": 1
}

Response samples

Content type
application/json
{
  • "created_count": 3
}

Content Blocks

Content Blocks are reusable blocks of text that are used in the COSI application. These blocks of text can be Organization specific or global (default) to all Organizations. Supports HTML formatting.

Operations:

  • List Content Blocks
  • Get a Content Block
  • Create a Content Block
  • Update a Content Block
  • Delete a Content Block

Roles:

Super Admin: Full access

Admin: No access

Care Team: No access

List and filter content blocks

Retrieves a list of content blocks with pagination and search support. Only accessible by Super Admins.

Content blocks are templates used for:

  • End user assessment and outcomes content
  • Email and SMS content
  • Terms and conditions and privacy policy content
  • Webhook responses

Supports filtering by:

  • Search term (name, organization_type, language, and content)
  • Organization type (in_person, remote_otc, none)
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

Q (string) or Q (null) (Q)

Search query string

Organization Type (string) or Organization Type (null) (Organization Type)

Filter by organization type

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a new content block

Creates a new content block template. Only accessible by Super Admins.

Content blocks can be:

  • Organization-specific (linked to an organization)
  • Default templates (no organization, used as fallbacks)
  • Language-specific (supports multiple languages)

Organization-specific blocks override default blocks for that organization.

Authorizations:
HTTPBearer
Request Body schema: application/json
required
name
required
string (Name)

Template identifier (e.g., COSI_OUTCOMES_SUMMARY_EMAIL)

content
required
string (Content)

The actual template content

Description (string) or Description (null) (Description)

Human-readable description of the template's purpose

Organization Type (string) or Organization Type (null) (Organization Type)

Type of organization this template is for (in_person, remote_otc, or None for global templates)

Organization Name (string) or Organization Name (null) (Organization Name)

Name of organization this template belongs to. If not provided, creates a default template

language
required
string (Language)

Language code for this template (e.g., 'en')

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "content": "string",
  • "description": "string",
  • "organization_type": "string",
  • "organization_name": "string",
  • "language": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "COSI_OUTCOMES_SUMMARY_EMAIL",
  • "content": "Your outcomes summary....",
  • "description": "Email sent to clients with their outcomes summary",
  • "language": "en",
  • "organization_type": "in_person",
  • "organization": {
    },
  • "is_default": false
}

Update a content block

Updates an existing content block's details. Only accessible by Super Admins.

Updatable fields:

  • name
  • content
  • description
  • language
  • organization_name
  • organization_type

Note: Changing organization may affect which clients see this content.

Authorizations:
HTTPBearer
path Parameters
content_block_id
required
integer (Content Block Id)
Request Body schema: application/json
required
Name (string) or Name (null) (Name)

Template identifier (e.g., COSI_OUTCOMES_SUMMARY_EMAIL)

Content (string) or Content (null) (Content)

The actual template content

Description (string) or Description (null) (Description)

Human-readable description of the template's purpose

Organization Type (string) or Organization Type (null) (Organization Type)

Type of organization this template is for (in_person, remote_otc, or None for global templates)

Organization Name (string) or Organization Name (null) (Organization Name)

Name of organization this template belongs to. If not provided, creates a default template

Language (string) or Language (null) (Language)

Language code for this template (e.g., 'en')

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "content": "string",
  • "description": "string",
  • "organization_type": "string",
  • "organization_name": "string",
  • "language": "string"
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "COSI_OUTCOMES_SUMMARY_EMAIL",
  • "content": "Updated instructions...",
  • "description": "Email sent to clients with their outcomes summary",
  • "language": "en",
  • "organization_type": "in_person",
  • "organization": {
    },
  • "is_default": false
}

Get a specific content block

Retrieves details of a specific content block by ID. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
content_block_id
required
integer (Content Block Id)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "COSI_OUTCOMES_SUMMARY_EMAIL",
  • "content": "Your outcomes summary....",
  • "description": "Email sent to clients with their outcomes summary",
  • "language": "en",
  • "organization_type": "in_person",
  • "organization": {
    },
  • "is_default": false
}

Delete a content block

Deletes a specific content block. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
content_block_id
required
integer (Content Block Id)

Responses

Response samples

Content type
application/json
{
  • "detail": "Content block not found"
}

COSI Questions

COSI Questions are the questions that are asked of the Client during the assessment stage. Every COSI Need is associated with a series of related COSI Questions.

Operations:

  • Get the next COSI Question
  • Save an answer to a COSI Question

Roles:

Client: Full access

Get next COSI question

Retrieves the next question in the assessment stage of the COSI.

The sequence is determined by:

  • situation: The current situation number
  • position: The question number within the situation

The response includes:

  • Question text
  • Example test
  • Answer (if any)
path Parameters
slug
required
string (Slug)
situation
required
integer (Situation)
position
required
integer (Position)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "situation": 1,
  • "position": 2,
  • "question": "In what situations do you experience the most difficulty?",
  • "created_at": "2024-01-01T00:00:00Z"
}

Submit answer to COSI question

Records a client's answer to a specific COSI question.

The submission:

  • Validates the answer format
  • Records the submission timestamp
  • Cannot be modified after submission
  • May trigger follow-up questions

Required fields:

  • situation: Current situation number
  • position: Question number within the situation
  • answer: Client's response text

The response includes validation results and any error messages.

path Parameters
slug
required
string (Slug)
Request Body schema: application/json
required
answer
required
string (Answer)

Client's response text

position
required
integer (Position)

Question number within the situation

situation
required
integer (Situation)

Current situation number

Responses

Request samples

Content type
application/json
{
  • "answer": "string",
  • "position": 0,
  • "situation": 0
}

Response samples

Content type
application/json
{
  • "id": 123,
  • "situation": 1,
  • "position": 2,
  • "question": "In what situations do you experience the most difficulty?",
  • "answer": "Noisy restaurants and social gatherings",
  • "is_valid": true,
  • "is_last": false,
  • "created_at": "2024-01-01T00:00:00Z"
}

Submit answer to COSI question (streaming)

Streaming variant of POST /cosies/{slug}/questions.

Records the client's answer and streams the AI-generated next question back as Server-Sent Events. Frames are discriminated by key presence (matching the vp-api convention):

  • data: {"message": "<text fragment>"}\n\n — incremental delta of the next question text. Multiple frames per response.
  • data: {"done": true, "question_id": ..., "is_last": ..., "next_action": ..., ...}\n\n — terminal success frame carrying the same fields as the non-streaming endpoint's CosiQuestionResponse, so the client can drive its existing branching logic without a follow-up GET.
  • data: {"error": "..."}\n\n — terminal error frame on validation failure or unexpected exception.

The response media type is text/plain. The endpoint is intentionally public for the same reasons as the non-streaming endpoint (partner-gated COSI assessment flow).

path Parameters
slug
required
string (Slug)
Request Body schema: application/json
required
answer
required
string (Answer)

Client's response text

position
required
integer (Position)

Question number within the situation

situation
required
integer (Situation)

Current situation number

Responses

Request samples

Content type
application/json
{
  • "answer": "string",
  • "position": 0,
  • "situation": 0
}

Response samples

Content type
application/json
null

COSI Needs

COSI Needs are the needs that are associated with a COSI during assessment.

Operations:

  • Get the next COSI Need
  • Save an outcome for a COSI Need

Roles:

Client: Full access

Get COSI need for situation

Retrieves the COSI need (question) for a specific situation number.

Situations represent different hearing needs in a COSI.

The response includes:

  • Need text
  • Situation number
  • Parent COSI id
  • Whether this is the last situation
path Parameters
slug
required
string (Slug)
situation
required
integer (Situation)

Responses

Response samples

Content type
application/json
{
  • "cosi_id": 456,
  • "need": "How often do you experience difficulty hearing in noisy situations?",
  • "situation": 1,
  • "is_last": false
}

Submit answer for COSI need

Records a client's answer for a specific COSI need situation.

The submission:

  • Saves the selected outcome
  • Records the submission timestamp
  • Cannot be modified after submission
  • Is used for generating the final COSI report

Required fields:

  • situation: The situation number being answered
  • outcome: The selected answer from available options. Must be one of: 'Much better', 'Better', 'Slightly better', 'No difference', or 'Worse'
path Parameters
slug
required
string (Slug)
Request Body schema: application/json
required
outcome
required
string (Outcome)

Client's selected answer. Must be one of: 'Much better', 'Better', 'Slightly better', 'No difference', or 'Worse'

situation
required
integer (Situation)

Sequence number of the situation being answered

Responses

Request samples

Content type
application/json
{
  • "outcome": "string",
  • "situation": 0
}

Response samples

Content type
application/json
{
  • "cosi_id": 456,
  • "need": "How often do you experience difficulty hearing in noisy situations?",
  • "situation": 1,
  • "is_last": false
}

COSIES

A COSI is the main entity in the COSI application. It represents several COSI Needs and the outcomes for each.

Operations:

  • Get a COSI
  • Get a COSI Summary
  • Start a COSI
  • Complete a COSI
  • Rate a COSI
  • Save an overall outcome for a COSI
  • Send an assessment invite to a COSI
  • Send an outcomes invite to a COSI

Roles:

Client: Full access

Send assessment invitation

Sends an assessment invitation (email and SMS) to a client. Only accessible by Super Admins and team members of the client's organization.

The invitation includes:

  • Personalized assessment link
  • Instructions for completing the assessment
  • Organization-specific branding
Authorizations:
HTTPBearer
path Parameters
cosi_id
required
integer (Cosi Id)

Responses

Response samples

Content type
application/json
null

Send outcomes invitation

Sends an outcomes invitation (email and SMS) to a client. Only accessible by Super Admins and team members of the client's organization.

The invitation includes:

  • Personalized outcomes link
  • Instructions for completing the outcomes assessment
  • Organization-specific branding
Authorizations:
HTTPBearer
path Parameters
cosi_id
required
integer (Cosi Id)

Responses

Response samples

Content type
application/json
null

Save overall outcome

Saves the overall outcome rating for a COSI. This represents the client's final assessment of their progress.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)
Request Body schema: application/json
required
outcome
required
string (Outcome)

Client's overall rating of their progress

Responses

Request samples

Content type
application/json
{
  • "outcome": "string"
}

Response samples

Content type
application/json
null

Get COSI status

Retrieves the current status of a COSI.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "status": "assessment_scheduled"
}

Get COSI content for stage

Retrieves the content and configuration for a specific COSI stage (assessment or outcomes).

The response includes:

  • Introduction text
  • Terms and conditions
  • Organization branding (colors, logo)
  • Survey links (if applicable)
  • Completion messages
path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "slug": "john-doe-123",
  • "created_at": "2024-01-01T00:00:00Z",
  • "status": "assessment_scheduled",
  • "organization_name": "Example Org",
  • "intro_text": "Welcome to your COSI assessment...",
  • "instructions_text": "<div>Before you start...</div>",
  • "logo_and_company_text": "<div><img src='...'/>Example Org</div>",
  • "terms_text": "Terms and conditions...",
  • "last_question_text": "Final question...",
  • "primary_color": "#FF0000",
  • "button_text_color": "#FFFFFF",
  • "compact_display": false
}

Get COSI summary

Retrieves the summary of completed COSI stage (assessment or outcomes). Only available after the respective stage is completed.

The summary includes:

  • Client responses
  • Identified needs
path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "needs": [
    ]
}

Start COSI stage

Marks the start of a COSI stage (assessment or outcomes). Records the timestamp when the client begins the process.

path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
Src (string) or Src (null) (Src)
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
null

Complete COSI stage

Marks the completion of a COSI stage (assessment or outcomes).

Actions taken:

  • Records completion timestamp
  • Updates COSI status
  • Records device type used
  • Sends summary email
  • Moves to outcomes stage (when called during assessment) - Remote OTC only
path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
null

Generate summaries for all situations

Generates clinical goal summaries for all situations in the assessment.

This endpoint should be called after the conversation is complete (i.e., after the last answer submission returns next_action: 'completed').

It runs summary generation, evaluation, and refinement for all situations in parallel, saves the finalized goals to the database, and returns the assessment summary.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "needs": [
    ]
}

Rate COSI stage

Records the client's rating of their experience for a COSI stage.

The rating is stored as the human-readable label verbatim (e.g. "Very useful", "Somewhat useful"), matching how the outcomes fields are stored.

path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
rating
required
string (Rating) [ 1 .. 100 ] characters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
null

Submit COSI stage feedback

Records the client's feedback about their experience for a COSI stage.

The feedback is stored as free-form text and can be used for:

  • Understanding user experience
  • Identifying areas for improvement
  • Quality assurance and analysis
path Parameters
slug
required
string (Slug)
stage
required
string (Stage)
query Parameters
Token (string) or Token (null) (Token)
Request Body schema: application/json
required
feedback
required
string (Feedback) [ 1 .. 2500 ] characters

Client's feedback about their experience

Responses

Request samples

Content type
application/json
{
  • "feedback": "The assessment was very helpful and easy to understand."
}

Response samples

Content type
application/json
null

Get COSI details

Retrieves detailed information about a specific COSI by ID or slug. Only accessible by team members of the client's organization.

The identifier can be either:

  • A numeric ID (e.g., 123)
  • A slug (e.g., "john-doe-123")

The response includes:

  • Client information
  • COSI status
  • Assessment needs
  • Overall outcome
Authorizations:
HTTPBearer
path Parameters
identifier
required
string (Identifier)

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "user_id": 456,
  • "first_name": "John",
  • "last_name": "Doe",
  • "external_id": "1234567890",
  • "overall_outcome": "Very much",
  • "cosi_needs": [
    ],
  • "status": "assessment_done",
  • "assessment_feedback": "The assessment was very helpful and easy to understand.",
  • "outcomes_feedback": "The outcomes assessment provided valuable insights into my progress.",
  • "slug": "john-doe-123"
}

Save conversation state

Saves the conversation state for a COSI and updates the last accessed timestamp. Used to persist chat messages for potential recreation after page refresh.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)
Request Body schema: application/json
required
object (Conversation State)

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
null

Load conversation state

Loads the conversation state for a COSI if it was accessed within the last 5 minutes. If more than 5 minutes have passed, the conversation state is cleared and null is returned.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "state": {
    }
}

List COSIs for a user

Retrieves all COSIs for a specific user, ordered by most recent first.

Only accessible by Super Admins.

The response includes:

  • COSI status and organization type
  • Assessment and outcomes timestamps and ratings
  • Estimated cost and when it was last calculated
Authorizations:
HTTPBearer
query Parameters
user_id
required
integer (User Id)

User ID to filter COSIs by

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Audit Logs

Audit logs are records of actions taken in the COSI application.

Operations:

  • List Audit Logs

Roles:

Super Admin: Full access

Admin: No access

Care Team: No access

List and filter audit logs

Retrieves a list of audit logs with pagination and search support. Only accessible by Super Admins.

Audit logs track all API requests including:

  • User actions
  • System events
  • Authentication attempts
  • Resource modifications

Supports filtering by:

  • Search term (user name, context, organization name, and user agent)
  • Context (all, none, cosi_detail, auth, content_block)
Authorizations:
HTTPBearer
query Parameters
_start
integer ( Start)
Default: 0

Starting index for pagination

_end
integer ( End)

Ending index for pagination

Q (string) or Q (null) (Q)

Search query string

Context (string) or Context (null) (Context)

Filter by context. Available values: all, none, cosi_detail, auth, content_block

Responses

Response samples

Content type
application/json
[
  • {
    }
]

SMS

SMS management operations.

Operations:

  • Handle a SMS webhook from Twilio

Roles:

API: Full access

Super Admin: No access

Admin: No access

Care Team: No access

Reports

Report management operations.

Operations:

  • Team Interaction Report
  • Client Interaction Report

Roles:

Super Admin: Full access

Admin: No access

Care Team: No access

Download team interaction report

Downloads an Excel report of team member interactions with clients. Only accessible by Super Admins.

The report includes:

  • Team member details
  • Client interactions
  • Action timestamps
  • Communication methods
  • Organization details

Optional filters:

  • organization_id: Filter by specific organization
Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

Download client interaction report

Downloads an Excel report of client interactions and engagement. Accessible by Organization Admins and Super Admins.

The report includes:

  • Client details
  • Assessment completions
  • Outcome responses
  • Communication history
  • Engagement metrics

Optional filters:

  • organization_id: Filter by specific organization (Super Admins only)

Organization Admins can only access data for their organization.

Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

Download client COSI question report

Downloads an Excel report of client COSI questions. Accessible by Organization Admins and Super Admins.

Optional filters:

  • organization_id: Filter by specific organization (Super Admins only)

Organization Admins can only access data for their organization.

Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

Download client funnel report

Downloads an Excel report of client funnel events. Accessible by Organization Admins and Super Admins.

The report includes:

  • Client details
  • COSI details
  • Event details

Optional filters:

  • organization_id: Filter by specific organization (Super Admins only)

Organization Admins can only access data for their organization.

Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

Download client status history report

Downloads an Excel report of client status history. Accessible by Organization Admins and Super Admins.

The report includes:

  • Client details
  • COSI details
  • Status history details

Optional filters:

  • organization_id: Filter by specific organization (Super Admins only)

Organization Admins can only access data for their organization.

Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

Download message log report

Downloads an Excel report of message delivery logs and status. Accessible by Organization Admins and Super Admins.

The report includes:

  • Message delivery details (SMS, Email)
  • Delivery status tracking
  • Recipient information
  • Template names used
  • Error details for failed messages
  • Timestamps for sent messages

Optional filters:

  • organization_id: Filter by specific organization (Super Admins only)

Organization Admins can only access message logs for their organization. Super Admins can access all message logs or filter by specific organization.

This report helps track:

  • Message delivery success rates
  • Failed message patterns
  • Communication volume by organization
  • Template effectiveness
Authorizations:
HTTPBearer
query Parameters
Organization Id (string) or Organization Id (null) (Organization Id)

Filter by organization

Responses

Response samples

Content type
null

URLs

Redirect short URL

Redirects a short URL to its original destination.

Short URLs are used for:

  • Assessment SMS invitations
  • Outcomes SMS invitations

The URL format is /{code}/hearing_needs where code is a unique identifier.

path Parameters
code
required
string (Code)

Responses

Response samples

Content type
text/plain
Redirecting to https://example.com/original-url

Webhooks

Handle Twilio incoming SMS callback

Processes incoming SMS messages from Twilio. Handles client responses to SMS notifications.

Available commands:

  • START: Enable SMS notifications
  • STOP: Disable SMS notifications
  • STATUS: Check current notification status

The endpoint:

  • Validates Twilio signature
  • Identifies user by phone number
  • Processes command
  • Returns TwiML response

Response messages are customized based on:

  • Command received
  • User's current notification status
  • Organization settings
Request Body schema: application/x-www-form-urlencoded
required
body
required
string (Body)
from_number
required
string (From Number)
to_number
required
string (To Number)
message_sid
required
string (Message Sid)

Responses

Response samples

Content type
null

Handle Twilio status callback

Processes status updates for SMS messages sent via Twilio. Updates MessageLog records with current delivery status.

Status types include:

  • QUEUED: Message is queued for delivery
  • SENT: Message has been sent from Twilio
  • DELIVERED: Message was successfully delivered to recipient
  • FAILED: Message delivery failed
  • UNDELIVERED: Message could not be delivered

The endpoint:

  • Validates Twilio signature for security
  • Looks up MessageLog by MessageSid
  • Updates status in database
  • Handles gracefully if message not found

This webhook is called automatically by Twilio when message status changes, allowing real-time tracking of SMS delivery status.

Request Body schema: application/x-www-form-urlencoded
required
from_number
required
string (From Number)
to_number
required
string (To Number)
message_sid
required
string (Message Sid)
message_status
required
string (Message Status)

Responses

Response samples

Content type
application/json
null

Handle SendGrid callback

Processes email event notifications from SendGrid. Updates MessageLog records with email delivery and engagement status.

Event types include:

  • PROCESSED: Email has been received and is ready for delivery
  • DELIVERED: Email was successfully delivered to recipient
  • OPENED: Recipient opened the email
  • CLICKED: Recipient clicked a link in the email
  • BOUNCE: Email bounced back
  • DROPPED: Email was dropped by SendGrid
  • DEFERRED: Email delivery was temporarily delayed
  • SPAM_REPORT: Email was marked as spam

The endpoint:

  • Verifies SendGrid signature using ECDSA cryptographic verification
  • Validates timestamp to prevent replay attacks
  • Processes multiple events in a single webhook payload
  • Extracts message ID prefix from full SendGrid message ID
  • Updates MessageLog status in database
  • Handles gracefully if message not found

SendGrid sends this webhook automatically when email events occur, enabling real-time tracking of email delivery and engagement metrics.

Security: Uses SendGrid's webhook signature verification with public key to ensure webhooks are authentic and haven't been tampered with.

Responses

Response samples

Content type
application/json
null

List webhooks

Retrieves a list of webhooks. Only accessible by Super Admins.

Optionally filter by organization_id.

Authorizations:
HTTPBearer
query Parameters
Organization Id (integer) or Organization Id (null) (Organization Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create webhook

Creates a new webhook for an organization. Only accessible by Super Admins.

Webhooks receive notifications when specific events occur, such as when a client's COSI status changes. The webhook will be called with the specified HTTP method (GET or POST) to the provided URL.

Required fields:

  • url: URL where webhook events will be sent
  • event_name: Name of the event that triggers this webhook (e.g., 'status_changed')
  • organization_id: ID of the organization this webhook belongs to
  • method: HTTP method to use (GET or POST)

Optional fields:

  • headers: JSON string of custom headers to include in webhook requests
Authorizations:
HTTPBearer
Request Body schema: application/json
required
url
required
string (Url)

URL where webhook events will be sent

event_name
required
string (Event Name)

Name of the event that triggers this webhook (e.g., 'status_changed')

organization_id
required
integer (Organization Id)

ID of the organization this webhook belongs to

method
required
string (Method)

HTTP method to use when sending webhook (GET or POST)

Headers (string) or Headers (null) (Headers)

JSON string of custom headers to include in webhook requests

Responses

Request samples

Content type
application/json
{
  • "url": "string",
  • "event_name": "string",
  • "organization_id": 0,
  • "method": "string",
  • "headers": "string"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "event_name": "status_changed",
  • "organization_id": 123,
  • "method": "POST",
  • "headers": "{\"Authorization\": \"Bearer token123\"}",
  • "created_at": "2024-01-01T00:00:00Z"
}

Get webhook details

Retrieves detailed information about a specific webhook. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
webhook_id
required
integer (Webhook Id)

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "event_name": "status_changed",
  • "organization_id": 123,
  • "method": "POST",
  • "headers": "{\"Authorization\": \"Bearer token123\"}",
  • "created_at": "2024-01-01T00:00:00Z"
}

Update webhook

Updates an existing webhook's details. Only accessible by Super Admins.

All fields are optional to support partial updates.

Updatable fields:

  • url: URL where webhook events will be sent
  • event_name: Name of the event that triggers this webhook
  • organization_id: ID of the organization this webhook belongs to
  • method: HTTP method to use (GET or POST)
  • headers: JSON string of custom headers
Authorizations:
HTTPBearer
path Parameters
webhook_id
required
integer (Webhook Id)
Request Body schema: application/json
required
Url (string) or Url (null) (Url)

URL where webhook events will be sent

Event Name (string) or Event Name (null) (Event Name)

Name of the event that triggers this webhook (e.g., 'status_changed')

Organization Id (integer) or Organization Id (null) (Organization Id)

ID of the organization this webhook belongs to

Method (string) or Method (null) (Method)

HTTP method to use when sending webhook (GET or POST)

Headers (string) or Headers (null) (Headers)

JSON string of custom headers to include in webhook requests

Responses

Request samples

Content type
application/json
{
  • "url": "string",
  • "event_name": "string",
  • "organization_id": 0,
  • "method": "string",
  • "headers": "string"
}

Response samples

Content type
application/json
{}

Delete webhook

Deletes a webhook. Only accessible by Super Admins.

Once deleted, the webhook will no longer receive event notifications.

Authorizations:
HTTPBearer
path Parameters
webhook_id
required
integer (Webhook Id)

Responses

Response samples

Content type
application/json
{
  • "detail": "User does not have admin access to delete webhooks"
}

SSO Providers

List SSO providers

Retrieves a list of SSO provider configurations. Only accessible by Super Admins.

Optionally filter by organization_id.

Authorizations:
HTTPBearer
query Parameters
Organization Id (integer) or Organization Id (null) (Organization Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create SSO provider

Creates a new SSO provider configuration for an organization. Only accessible by Super Admins.

SSO providers store OAuth configuration for an organization's authentication flow. The client_secret is encrypted at rest and is never returned by this API.

Required fields:

  • organization_id: ID of the organization this provider belongs to
  • provider_type: Provider type (e.g., 'okta', 'google', 'entra_id')
  • client_id: OAuth client ID
  • client_secret: OAuth client secret (encrypted at rest)
  • redirect_uri: OAuth redirect URI

Optional fields:

  • domain: Provider-specific domain (Okta)
  • tenant_id: Provider-specific tenant ID (Entra ID)
  • name: Friendly name

Important constraints:

  • There can only be one unarchived (active) SSO provider per organization.
  • Creation is blocked if the organization already has an unarchived provider.
Authorizations:
HTTPBearer
Request Body schema: application/json
required
organization_id
required
integer (Organization Id)

ID of the organization this SSO provider belongs to

provider_type
required
string (Provider Type)

SSO provider type (e.g., 'okta', 'google', 'entra_id')

client_id
required
string (Client Id)

OAuth client ID

client_secret
required
string (Client Secret)

OAuth client secret (will be encrypted at rest)

redirect_uri
required
string (Redirect Uri)

OAuth redirect URI

Domain (string) or Domain (null) (Domain)

Provider-specific domain (Okta)

Tenant Id (string) or Tenant Id (null) (Tenant Id)

Provider-specific tenant ID (Entra ID)

Name (string) or Name (null) (Name)

Friendly name

Responses

Request samples

Content type
application/json
{
  • "organization_id": 0,
  • "provider_type": "string",
  • "client_id": "string",
  • "client_secret": "string",
  • "redirect_uri": "string",
  • "domain": "string",
  • "tenant_id": "string",
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "provider_type": "entra_id",
  • "client_id": "your-client-id",
  • "tenant_id": "your-tenant-id",
  • "name": "Partner Entra ID",
  • "archived": false,
  • "created_at": "2024-01-01T00:00:00Z"
}

Get SSO provider details

Retrieves detailed information about a specific SSO provider configuration. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
sso_provider_id
required
integer (Sso Provider Id)

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "provider_type": "entra_id",
  • "client_id": "your-client-id",
  • "tenant_id": "your-tenant-id",
  • "name": "Partner Entra ID",
  • "archived": false,
  • "created_at": "2024-01-01T00:00:00Z"
}

Update SSO provider

Updates an existing SSO provider configuration. Only accessible by Super Admins.

All fields are optional to support partial updates.

Updatable fields:

  • organization_id
  • provider_type
  • client_id
  • client_secret (encrypted at rest, never returned)
  • redirect_uri
  • domain
  • tenant_id
  • name
  • archived

Important constraints:

  • If an SSO provider is set to unarchived (active), any other unarchived provider for the same organization will be automatically archived.
Authorizations:
HTTPBearer
path Parameters
sso_provider_id
required
integer (Sso Provider Id)
Request Body schema: application/json
required
Organization Id (integer) or Organization Id (null) (Organization Id)

ID of the organization this SSO provider belongs to

Provider Type (string) or Provider Type (null) (Provider Type)

SSO provider type (e.g., 'okta', 'google', 'entra_id')

Client Id (string) or Client Id (null) (Client Id)

OAuth client ID

Client Secret (string) or Client Secret (null) (Client Secret)

OAuth client secret (will be encrypted at rest)

Redirect Uri (string) or Redirect Uri (null) (Redirect Uri)

OAuth redirect URI

Domain (string) or Domain (null) (Domain)

Provider-specific domain (Okta)

Tenant Id (string) or Tenant Id (null) (Tenant Id)

Provider-specific tenant ID (Entra ID)

Name (string) or Name (null) (Name)

Friendly name

Archived (boolean) or Archived (null) (Archived)

Whether this provider is archived (inactive)

Responses

Request samples

Content type
application/json
{
  • "organization_id": 0,
  • "provider_type": "string",
  • "client_id": "string",
  • "client_secret": "string",
  • "redirect_uri": "string",
  • "domain": "string",
  • "tenant_id": "string",
  • "name": "string",
  • "archived": true
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "provider_type": "entra_id",
  • "client_id": "your-client-id-updated",
  • "tenant_id": "your-tenant-id",
  • "name": "Partner Entra ID",
  • "archived": false,
  • "created_at": "2024-01-01T00:00:00Z"
}

Partner Auths

List partner auths

Retrieves a list of partner auths. Only accessible by Super Admins.

Optionally filter by organization_id.

Authorizations:
HTTPBearer
query Parameters
Organization Id (integer) or Organization Id (null) (Organization Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create partner auth

Creates a new partner auth for an organization. Only accessible by Super Admins.

Each organization can have at most one partner auth. The JWT secret is encrypted before storage.

Authorizations:
HTTPBearer
Request Body schema: application/json
required
organization_id
required
integer (Organization Id)

ID of the organization this belongs to

jwt_secret
required
string (Jwt Secret)

JWT secret for verifying partner tokens

jwt_algorithm
string (Jwt Algorithm)
Default: "HS256"

JWT algorithm used for token verification

Responses

Request samples

Content type
application/json
{
  • "organization_id": 0,
  • "jwt_secret": "string",
  • "jwt_algorithm": "HS256"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "jwt_algorithm": "HS256",
  • "enabled": true,
  • "created_at": "2024-01-01T00:00:00Z"
}

Get partner auth

Retrieves details of a specific partner auth. Only accessible by Super Admins.

Authorizations:
HTTPBearer
path Parameters
partner_auth_id
required
integer (Partner Auth Id)

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "jwt_algorithm": "HS256",
  • "enabled": true,
  • "created_at": "2024-01-01T00:00:00Z"
}

Update partner auth

Updates an existing partner auth. Only accessible by Super Admins.

All fields are optional to support partial updates. If jwt_secret is provided, it will be re-encrypted before storage.

Authorizations:
HTTPBearer
path Parameters
partner_auth_id
required
integer (Partner Auth Id)
Request Body schema: application/json
required
Jwt Secret (string) or Jwt Secret (null) (Jwt Secret)

JWT secret for verifying partner tokens

Jwt Algorithm (string) or Jwt Algorithm (null) (Jwt Algorithm)

JWT algorithm used for token verification

Enabled (boolean) or Enabled (null) (Enabled)

Whether this is enabled

Responses

Request samples

Content type
application/json
{
  • "jwt_secret": "string",
  • "jwt_algorithm": "string",
  • "enabled": true
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "organization_id": 123,
  • "jwt_algorithm": "HS256",
  • "enabled": true,
  • "created_at": "2024-01-01T00:00:00Z"
}

Policies

Get policy content

Retrieves the HTML content for a specific policy document. Accessible by all users.

Available policies:

  • PRIVACY: Data collection and usage policies
  • TERMS: Terms and conditions for using the service

The content is returned as formatted HTML ready for display.

path Parameters
policy_name
required
string (Policy Name)

Responses

Response samples

Content type
application/json
{
  • "html": "<div><h1>Privacy Policy</h1><p>This privacy policy describes how we collect...</p></div>"
}

Events

Create event

Creates an event for a COSI.

path Parameters
slug
required
string (Slug)
Request Body schema: application/json
required
name
required
string (Name)

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
null

Service Usages

Get service usages for a COSI

Retrieves all service usage records for a specific COSI.

Only accessible by Super Admins.

Returns usage records ordered by ID descending (most recent first), including token counts, rates, and estimated costs per agent operation.

Authorizations:
HTTPBearer
path Parameters
slug
required
string (Slug)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Record client-side service usage

Records service usage reported by the client (e.g. Deepgram STT seconds captured during the assessment chat).

Public endpoint — partner token required when the organization has partner auth enabled.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)
Request Body schema: application/json
required
service
required
string (Service)

The service name (currently only 'deepgram' is supported)

Value: "deepgram"
model
required
string (Model)

The model used (must be valid for the service)

units
required
number (Units) > 0

Usage amount (must be positive)

Responses

Request samples

Content type
application/json
{
  • "service": "deepgram",
  • "model": "string",
  • "units": 0
}

Response samples

Content type
application/json
{
  • "message": "Usage recorded",
  • "units": 46
}

Calculate cost for a COSI

Calculates the total cost for a COSI by looking up pricing for all service usage records and updating estimated costs.

Only accessible by Super Admins.

Updates each ServiceUsage record with the current rate and estimated cost, and sets the COSI's estimated_cost and cost_calculated_at fields.

Authorizations:
HTTPBearer
path Parameters
slug
required
string (Slug)

Responses

Response samples

Content type
application/json
{
  • "message": "Cost calculated",
  • "estimated_cost": "0.042000"
}

Deepgram

Get a temporary Deepgram API key for client-side STT

Mints a short-lived, scoped Deepgram API key (90-minute TTL, usage:write) for use in the cosi assessment chat's client-side WebSocket STT.

Public endpoint — partner token required when the organization has partner auth enabled.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)

Responses

Response samples

Content type
application/json
{
  • "api_key": "abcdef0123456789..."
}

Transcribe an uploaded audio file via Deepgram (HTTP fallback)

HTTP fallback for the cosi assessment chat's STT — used by clients on networks that block WebSockets to Deepgram. Accepts an uploaded audio file, calls Deepgram's REST API server-side, records usage, and returns the transcript.

Public endpoint — partner token required when the organization has partner auth enabled.

path Parameters
slug
required
string (Slug)
query Parameters
Token (string) or Token (null) (Token)
Request Body schema: multipart/form-data
required
audio_file
required
string <binary> (Audio File)

Responses

Response samples

Content type
application/json
{
  • "transcript": "Hello, how are you?"
}

Health Check

Responses

Response samples

Content type
application/json
null