API Documentation

Integrate LearnFlow's learning platform into your applications. Our RESTful API provides comprehensive access to courses, users, enrollments, and certification data.

https://api.learnflow.com/v1
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API responses are returned in JSON format.

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.

Header 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.

POST /auth/refresh

Request Body

JSON { "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

Response (200 OK)

JSON { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 3600 }

Course Endpoints

Manage and retrieve course data, including metadata, pricing, and curriculum details.

GET /courses

Description

Retrieve a paginated list of available courses. Supports filtering by category, level, and search terms.

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerResults per page (max: 50)
categorystringFilter by category slug
searchstringFull-text search query

Response (200 OK)

JSON { "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 } }
POST /enrollments

Description

Enroll a user in a specific course. Requires valid authentication and sufficient funds or enterprise license.

Request Body

JSON { "user_id": "usr_7f3d9a", "course_id": "crs_8x92k1", "payment_method_id": "pm_visa_4242" }

Response (201 Created)

JSON { "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.

CodeMeaningDescription
200OKRequest succeeded
201CreatedResource successfully created
400Bad RequestMissing or invalid parameters
401UnauthorizedInvalid or expired API token
403ForbiddenInsufficient permissions
404Not FoundResource does not exist
429Too Many RequestsRate limit exceeded
500Server ErrorInternal platform error
JSON Error Response { "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.

Exceeding rate limits will result in 429 Too Many Requests responses. Wait until the limit resets before retrying.
PlanRequests/MinuteRequests/Day
Starter (Free)301,000
Professional30025,000
EnterpriseCustomUnlimited

Rate limit headers are included in every response:

Headers 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.