Skip to content

API Reference

CoursePipeline provides a comprehensive REST API that allows you to programmatically interact with your organization's data. This allows you to build custom integrations, extend functionality, and integrate with other systems.

Authentication

API requests are authenticated using API keys. Each organization can generate multiple API keys from their settings page. API keys should be included in one of the following ways:

  • As a Bearer token in the Authorization header: Authorization: Bearer YOUR_API_KEY
  • As an API key header: X-API-Key: YOUR_API_KEY
  • As a query parameter: ?apiKey=YOUR_API_KEY

WARNING

API keys provide full access to your organization's data. Keep them secure and never expose them in client-side code.

API Keys Management

API keys can be managed through the API itself or through the user interface.

Generate a New API Key

http
POST /api/api-keys
Authorization: Bearer SUPABASE_JWT_TOKEN
Content-Type: application/json

{
  "name": "My API Key",
  "expires_at": "2025-12-31T23:59:59Z" // Optional
}

List All API Keys

http
GET /api/api-keys
Authorization: Bearer SUPABASE_JWT_TOKEN

Revoke an API Key

http
POST /api/api-keys/{key_id}/revoke
Authorization: Bearer SUPABASE_JWT_TOKEN

Variables API

The Variables API allows you to retrieve and manage course variables.

List Variables

Retrieve all variables for your organization, with optional filtering.

http
GET /api/variables
X-API-Key: YOUR_API_KEY

Query parameters:

  • course_id - Filter by course ID
  • active - Filter by active status (true/false)

Get Variable Details

Retrieve details for a specific variable.

http
GET /api/variables/{variable_id}
X-API-Key: YOUR_API_KEY

Get Variable Values

Retrieve all values recorded for a specific variable.

http
GET /api/variables/{variable_id}/values
X-API-Key: YOUR_API_KEY

Query parameters:

  • learner_id - Filter by learner ID
  • limit - Maximum number of results (default: 100)
  • offset - Offset for pagination

Set Variable Value

Set a variable value for a specific learner.

http
POST /api/variables/set
X-API-Key: YOUR_API_KEY
Content-Type: application/json

{
  "variable_id": "uuid-of-variable",
  "learner_id": "uuid-of-learner",
  "course_run_id": "uuid-of-course-run", // Optional
  "value": "variable-value"
}

Get Variable Aggregation

Get aggregated data for a variable.

http
GET /api/variables/{variable_id}/aggregate
X-API-Key: YOUR_API_KEY

Courses API

The Courses API allows you to retrieve course information.

List Courses

http
GET /api/courses
X-API-Key: YOUR_API_KEY

Get Course Details

http
GET /api/courses/{course_id}
X-API-Key: YOUR_API_KEY

Get Course by External ID

http
GET /api/courses/external/{externalId}
X-API-Key: YOUR_API_KEY

Get Course Variables

http
GET /api/courses/{course_id}/variables
X-API-Key: YOUR_API_KEY

Get Course Statistics

http
GET /api/courses/{course_id}/stats
X-API-Key: YOUR_API_KEY

Learners API

The Learners API provides access to learner data.

List Learners

http
GET /api/learners
X-API-Key: YOUR_API_KEY

Query parameters:

  • limit - Maximum number of results (default: 100)
  • offset - Offset for pagination
  • search - Search term to filter by name or email

Get Learner Details

http
GET /api/learners/{learner_id}
X-API-Key: YOUR_API_KEY

Get Learner by Email

http
GET /api/learners/email/{email}
X-API-Key: YOUR_API_KEY

Get Learner Courses

http
GET /api/learners/{learner_id}/courses
X-API-Key: YOUR_API_KEY

Get Learner Variables

http
GET /api/learners/{learner_id}/variables
X-API-Key: YOUR_API_KEY

Query parameters:

  • course_id - Filter by course ID

Interactive API Documentation

A full interactive API documentation is available at /api/docs when running the application. This documentation is built using OpenAPI (Swagger) and allows you to test API endpoints directly from your browser.

Rate Limiting

The API is subject to rate limiting to ensure fair usage and system stability. Current limits are:

  • 100 requests per minute per API key
  • 5,000 requests per day per API key

If you exceed these limits, you will receive a 429 Too Many Requests response.

Error Handling

API errors follow a consistent format:

json
{
  "error": "Error code or name",
  "message": "Human-readable error message"
}

Common HTTP status codes:

  • 200 OK - Request succeeded
  • 201 Created - Resource created successfully
  • 400 Bad Request - Invalid request parameters
  • 401 Unauthorized - Invalid or missing API key
  • 404 Not Found - Resource not found
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error