The Coggno Rest API
API REFERENCE
The Coggno API is organized around REST. It features predictable, resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication methods, and verbs.
You can use the Coggno API in test mode, which doesn't affect your live data or interact with banking networks. The endpoint and API key you use to authenticate the request determine whether the request is in live mode or test mode.
ENDPOINTS
| Test | https://beta.coggno.com |
| Live | https://coggno.com/capp |
AUTHENTICATION
The Coggno API uses API keys to authenticate requests. You can view and manage your API keys on the Settings > API Keys page in your account (see screenshot below).
Test mode secret keys begin with the prefix test_, while live mode secret keys begin with the prefix live_.
Your API keys carry significant privileges, so it's important to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, or similar environments.
All API requests must be made over HTTPS. Requests made over plain HTTP will fail, as will any requests that lack proper authentication.
CONNECTED ACCOUNTS
To act as a connected account, clients can issue requests using the Coggno-LMS special header. Ensure that this header contains a valid Coggno LMS account ID. For example, to list all groups associated with the connected LMS account with ID 1, execute:
curl /api/v1/groups -H "Coggno-LMS: 1" -u API_KEY:
ERRORS
Coggno uses conventional HTTP response codes to indicate the success or failure of an API request:
- 2xx codes indicate success.
- 4xx codes indicate client-side errors, such as missing parameters or failed operations.
- 5xx codes indicate server-side errors on Coggno’s end.
Some 4xx errors include an error code that can be handled programmatically, providing a brief explanation of the issue encountered.
| 200 | OK | Everything worked as expected |
| 400 | Bad Request | The request was unacceptable |
| 401 | Not Authorized | No valid API key provided |
| 403 | Forbidden | The API key doesn’t have permissions to perform the request. |
| 404 | Not Found | The requested resource doesn’t exist |
| 422 | Unprocessable Entity | The server understands the request's syntax and content type, but cannot process it due to semantic errors or invalid data |
| 500, 502, 504 | Server Error | Something went wrong on Coggno’s end |
COMPANIES
The Company object represents a single LMS account. Each company contains multiple groups and users. All companies created via the API are treated as connected accounts.
Create Company:
POST /api/v1/companies
Parameters:
| email * | Valid email address |
| first_name * | |
| last_name * | |
| password * | 6-40 chars password |
| name | Company name |
| login | Login name, uses email if not set |
Request:
curl /api/v1/companies
-u API_KEY:
-d email=EMAIL
-d login=LOGIN_NAME
-d first_name=FIRST_NAME
-d last_name=LAST_NAME
-d name=COMPANY_NAME
-d password=PASSWORD
Response:
{
"id":1,
"user_id": 1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson",
"name":"Company Name"
}
Get Connected Companies:
GET /api/v1/companiesRequest:
curl /api/v1/companies -u API_KEY:
Response:
[{
"id":1,
"user_id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson",
"name":"Company Name"
}]
GROUPS
Use Coggno Groups to manage your clients, or entire departments, of your organization's LMS.
Create Group:
POST /api/v1/groups
Parameters:
| name * | Group name |
| description |
Request:
curl /api/v1/groups -u API_KEY: -d name=groupName
Response:
{
"id":1,
"name":"My group",
"description":"My group description"
}
Get All Groups:
GET /api/v1/groups
Request:
curl /api/v1/groups -u API_KEY:
Response:
[{
"id":1,
"name":"My group",
"description":"My group description"
}]
Get Specific Group:
GET /api/v1/groups/groupIDRequest:
curl /api/v1/groups/groupID -u API_KEY:
Response:
{
"id":1,
"name":"My group",
"description":"My group description"
}
Delete Group:
DELETE /api/v1/groups/groupIDParameters:
| name * | Group name |
Request:
curl -X DELETE /api/v1/groups -u API_KEY: -d name=groupName
Response:
{
"id":16,
"name":"My group"
}
USERS
User management methods
List All Users:
GET /api/v1/usersRequest:
curl /api/v1/users -u API_KEY:
Response:
[{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}]
Retrieve User:
GET /api/v1/users/userIDRequest:
curl /api/v1/users/userID -u API_KEY:
Response:
[{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}]
Note: this method supports using login name as userID, for example
curl /api/v1/users/testuser -u API_KEY: where 'testuser' is login name,
Create User:
POST /api/v1/usersCreates a new user and adds him to LMS and optionally to a group. If such a user is registered already then returns a validation error 422.
Parameters:
| email * | Valid email address |
| first_name * | |
| last_name * | |
| password * | 6-40 chars password |
| login | Login name, uses email if not set |
| group_id | Group ID where to add the user |
Request:
curl /api/v1/users -u API_KEY:
-d email=EMAIL
-d login=LOGIN_NAME
-d first_name=FIRST_NAME
-d last_name=LAST_NAME
-d password=PASSWORD
-d group_id=GROUP_ID
Response:
{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}
Delete User :
DELETE /api/v1/users/userIDThis method deletes the user from the LMS and all groups, but the user still stays in the Coggno database as a regular user.
Request:
curl -X DELETE /api/v1/users/userID -u API_KEY:
Response:
{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}
Get User Licenses:
GET /api/v1/users/userID/licenses
Request:
curl /api/v1/users/userID/licenses -u API_KEY:
Response includes document and license information:
{
"user":{
"id":1,
"first_name":"John",
"last_name":"Johnson"
},
"licenses":[{
"amount":1,
"used":0,
"views":0,
"start_date":null,
"complete_date":null,
"total_time":0,
"score":0,
"status":"not started",
"passed":false,
"created_at":"2025-01-15",
"document":{
"id":1,
"title":"Training"
}
}]
}
List Group Users:
GET /api/v1/groups/groupID/usersRequest:
curl /api/v1/groups/groupID/users -u API_KEY:
Response:
{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}
Retrieve Group User:
GET /api/v1/groups/groupID/users/userIDRequest:
curl /api/v1/groups/groupID/users/userID -u API_KEY:
Response:
[{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}]Note: this method supports using login name as userID, for example
curl /api/v1/groups/123/users/testuser -u API_KEY:
Add User to Group:
POST /api/v1/groups/groupID/usersThe user must exist in LMS (or in any connected LMS), otherwise it gives 404 error
Parameters:
| ID * | UserID |
Request:
curl /api/v1/groups/groupID/users -u API_KEY: -d id=UserID
Response:
{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}
Remove user from group:
DELETE /api/v1/groups/groupID/users/userIDThis method removes the user from the group, but the user still stays in LMS.
Request:
curl -X DELETE /api/v1/groups/groupID/users/userID -u API_KEY:
Response:
{
"id":1,
"login":"testuser",
"first_name":"John",
"last_name":"Johnson"
}DOCUMENTS
Get information about training content.
Get All Documents:
GET /api/v1/documentsRequest:
curl /api/v1/documents -u API_KEY:
Response:
[{
"id":1,
"title":"Training",
"published":1,
"type":"ScormDocument",
"published_at":"2025-01-15",
"created_at":"2025-01-15"
}]
Get Document Licenses:
GET /api/v1/documents/documentID/licensesRequest:
curl /api/v1/documents/documentID/licenses -u API_KEY:
Response includes document and license information:
{
"document":{
"id":1,
"title":"Training"
},
"licenses":[{
"amount":1,
"used":0,
"views":0,
"start_date":null,
"complete_date":null,
"total_time":0,
"score":0,
"status":"not started",
"passed":false,
"created_at":"2025-01-15",
"user":{
"id":1,
"first_name":"John",
"last_name":"Johnson"
}
}]
}