API Reference

OpenAPI Specification

Download and use the OpenAPI 3.1 specification for the CourseForge API

The CourseForge API is fully documented using the OpenAPI 3.1 specification standard. This allows you to generate client libraries, validate requests, and integrate with API development tools.

ℹ️
What is OpenAPI?

OpenAPI (formerly Swagger) is an industry-standard specification for describing RESTful APIs. It enables automatic SDK generation, documentation, and testing tools.

Accessing the Specification

Generating Client SDKs

Use the OpenAPI specification to generate type-safe client libraries in your preferred language.

TypeScript SDK

Using openapi-typescript

# Install the generator
npm install -D openapi-typescript

# Generate TypeScript types
npx openapi-typescript https://courseforge.caringai.app/api/openapi \
  -o ./src/types/api.ts

# Use in your code
import type { paths } from './types/api'

type CourseResponse = paths['/api/v1/courses']['get']['responses']['200']['content']['application/json']

JavaScript/TypeScript SDK

Using @hey-api/openapi-ts

# Install the generator
npm install -D @hey-api/openapi-ts

# Generate client SDK
npx @hey-api/openapi-ts \
  -i https://courseforge.caringai.app/api/openapi \
  -o ./src/api-client \
  -c @hey-api/client-fetch

# Use in your code
import { CoursesService } from './api-client'

const courses = await CoursesService.listCourses({
  page: 1,
  per_page: 20
})

Python SDK

Using openapi-generator-cli

# Install the generator
npm install -g @openapitools/openapi-generator-cli

# Generate Python client
openapi-generator-cli generate \
  -i https://courseforge.caringai.app/api/openapi \
  -g python \
  -o ./courseforge-client \
  --package-name courseforge

# Use in your code
from courseforge import ApiClient, CoursesApi
from courseforge.configuration import Configuration

config = Configuration()
config.api_key['ApiKeyAuth'] = 'cf_prod_your_key'
config.host = 'https://courseforge.caringai.app/api/v1'

with ApiClient(config) as client:
    api = CoursesApi(client)
    courses = api.list_courses(page=1, per_page=20)

API Development Tools

Postman

Import the OpenAPI specification directly into Postman:

  1. Open Postman
  2. Click "Import"
  3. Select "Link" and paste: https://courseforge.caringai.app/api/openapi
  4. Click "Continue" to import all endpoints
  5. Configure authentication with your API key

Insomnia

Import the spec into Insomnia REST client:

  1. Open Insomnia
  2. Click "Create" → "Import from URL"
  3. Paste: https://courseforge.caringai.app/api/openapi
  4. All endpoints will be added to your workspace

VS Code

Use the OpenAPI extension for VS Code:

  1. Install the "OpenAPI (Swagger) Editor" extension
  2. Download the spec: curl https://courseforge.caringai.app/api/openapi > openapi.json
  3. Open the file in VS Code for syntax highlighting and validation

Specification Details

Version:OpenAPI 3.1.0
API Version:v1.0.0
Total Endpoints:24 endpoints
Authentication:API Key (Header) + Bearer Token
Response Format:JSON

Validation & Testing

Command Line Validation

Using Redocly CLI

npx @redocly/cli lint https://courseforge.caringai.app/api/openapi

Online Validation

Using Swagger Editor

  1. Visit: https://editor.swagger.io
  2. Click File → Import URL
  3. Paste the OpenAPI URL
  4. Review validation results and errors

Schema Updates

Automatic Updates:

The OpenAPI specification is automatically updated when new endpoints are added.

Caching:

The spec is cached for 1 hour to improve performance.

💡
Tip:

Add ?cache=false to the OpenAPI URL to bypass caching during development:/api/openapi?cache=false

Next Steps