API Documentation
Integrate LearnFlow's learning platform into your applications. Our RESTful API provides comprehensive access to courses, users, enrollments, and certification data.
Authentication
LearnFlow uses API keys and Bearer tokens for authentication. All authenticated requests must include an Authorization header.
API Keys
Generate your API keys from the Developer Dashboard. Keep your secret keys confidential and never expose them in client-side code.
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Token Refresh
Access tokens expire after 1 hour. Use the refresh token to obtain a new access token without requiring user re-authentication.
Request Body
{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response (200 OK)
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}
Course Endpoints
Manage and retrieve course data, including metadata, pricing, and curriculum details.
Description
Retrieve a paginated list of available courses. Supports filtering by category, level, and search terms.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
limit | integer | Results per page (max: 50) |
category | string | Filter by category slug |
search | string | Full-text search query |
Response (200 OK)
{
"data": [
{
"id": "crs_8x92k1",
"title": "Complete Web Development Bootcamp",
"instructor": "Dr. John Smith",
"category": "development",
"level": "all",
"price": { "amount": 49.99, "currency": "USD" },
"rating": 4.9,
"total_students": 12450
}
],
"meta": {
"current_page": 1,
"total_pages": 42,
"total_items": 2085
}
}
Description
Enroll a user in a specific course. Requires valid authentication and sufficient funds or enterprise license.
Request Body
{
"user_id": "usr_7f3d9a",
"course_id": "crs_8x92k1",
"payment_method_id": "pm_visa_4242"
}
Response (201 Created)
{
"id": "enr_2m4p1z",
"user_id": "usr_7f3d9a",
"course_id": "crs_8x92k1",
"status": "active",
"progress": 0,
"enrolled_at": "2024-01-15T09:30:00Z"
}
Error Handling
LearnFlow uses standard HTTP status codes to indicate the success or failure of an API request. Error responses include a machine-readable error code and a human-readable message.
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource successfully created |
| 400 | Bad Request | Missing or invalid parameters |
| 401 | Unauthorized | Invalid or expired API token |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Internal platform error |
{
"error": {
"code": "invalid_token",
"message": "The access token provided is expired or invalid.",
"request_id": "req_9x2k1m"
}
}
Rate Limits
To ensure platform stability, API requests are rate-limited based on your plan tier.
429 Too Many Requests responses. Wait until the limit resets before retrying.| Plan | Requests/Minute | Requests/Day |
|---|---|---|
| Starter (Free) | 30 | 1,000 |
| Professional | 300 | 25,000 |
| Enterprise | Custom | Unlimited |
Rate limit headers are included in every response:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 245
X-RateLimit-Reset: 1705312800
SDKs & Libraries
Official SDKs are available to simplify integration across your favorite languages and frameworks.
- JavaScript/Node.js:
npm install @learnflow/sdk - Python:
pip install learnflow-api - PHP:
composer require learnflow/sdk-php - Ruby:
gem install learnflow-ruby
All SDKs automatically handle authentication, pagination, retries, and error parsing.
Need help integrating? Check out our integration guides or join our developer community.