API Overview
Welcome to the LearnFlow REST API. This documentation provides everything you need to integrate our learning management system into your applications. Our API follows RESTful conventions, uses standard HTTP status codes, and returns JSON-encoded responses.
Sign up for a developer account, generate your API key from the dashboard, and start making requests to api.learnflow.com. All endpoints require authentication via Bearer token.
Authentication
All API requests must include an Authorization header with your API key. LearnFlow uses Bearer token authentication.
Authorization: Bearer YOUR_API_KEY
API keys can be generated from your Developer Dashboard. Keep your keys secure and never expose them in client-side code. Use environment variables for server-side applications.
Base URL & Format
All requests should be made to our production endpoint:
https://api.learnflow.com/v1
All requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
Endpoints
Below are the core resources available through the LearnFlow API. Each endpoint supports standard filtering, sorting, and pagination parameters.
Courses
Retrieve a list of available courses. Supports filtering by category, level, and status.
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | int | Optional | Page number for pagination |
| limit | int | Optional | Results per page (max 100) |
| category | string | Optional | Filter by course category |
{
"data": [
{
"id": "course_8x2k9d",
"title": "Advanced React Patterns",
"category": "Frontend",
"level": "advanced",
"duration_hours": 24,
"price": { "amount": 4900, "currency": "USD" }
}
],
"meta": { "total": 142, "page": 1, "limit": 20 }
}
Create a new course. Requires instructor or admin privileges.
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Required | Course name (max 100 chars) |
| description | string | Required | HTML description |
| category | string | Required | Course category slug |
| instructor_id | string | Required | ID of the assigned instructor |
Students
Register a new student account or import existing users via CSV/bulk endpoint.
{
"email": "user@example.com",
"name": "Alex Rivera",
"role": "learner",
"metadata": { "organization": "Acme Corp" }
}
Enrollments
Enroll a student in a course. Automatically generates progress tracking and access credentials.
| Parameter | Type | Required | Description |
|---|---|---|---|
| student_id | string | Required | Target student ID |
| course_id | string | Required | Target course ID |
| coupon_code | string | Optional | Promotional discount code |
Analytics
Retrieve aggregated learning analytics, completion rates, and engagement metrics.
{
"total_enrollments": 1248,
"completion_rate": 0.78,
"avg_time_on_platform": "4h 22m",
"trending_courses": [
{ "id": "course_9s3k1", "enrollments_week": 142 }
]
}
Error Handling
LearnFlow uses conventional HTTP status codes to indicate the success or failure of a request. Codes in the 2xx range indicate success, 4xx indicate client errors, and 5xx indicate server errors.
Errors are returned as JSON with the following structure:
{
"error": {
"code": "invalid_request",
"message": "Missing required parameter: student_id",
"documentation_url": "https://docs.learnflow.com/errors#invalid_request"
}
}
Common Error Codes
Rate Limits
To ensure platform stability, LearnFlow implements rate limiting on all API endpoints. Limits are applied per API key and reset on a rolling basis.
Every response includes rate limit information in the headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 942
X-RateLimit-Reset: 1698765432 (Unix timestamp)
If you exceed the limit, you'll receive a 429 Too Many Requests response. Implement exponential backoff in your client to handle retries gracefully.
SDKs & Tools
Official and community-maintained libraries to accelerate your integration:
pip install learnflow-sdk - Official Python client with async supportnpm install @learnflow/api - Type-safe TypeScript wrappergem install learnflow-rb - Elegant Ruby integrationgo get github.com/learnflow/go-sdk - High-performance Go clientNo official SDK for your language? The API is fully documented and RESTful, making it easy to integrate with any HTTP client. Consider contributing a community SDK!