API Reference

Complete API documentation with interactive explorer and OpenAPI specification.

API Reference

The CurryCMS API is documented using the OpenAPI 3.0 specification. You can explore the API interactively or download the specification for code generation.

Interactive API Explorer

Use Swagger UI to explore and test API endpoints directly in your browser:

Open API Explorer →

The explorer lets you:
- Browse all available endpoints
- See request/response schemas
- Try out requests with your API token
- View example responses

OpenAPI Specification

Download the OpenAPI specification for use with code generators or API clients:

Code Generation

Use the OpenAPI spec to generate client libraries:

# Using openapi-generator
openapi-generator generate -i openapi.yaml -g ruby -o ./client

# Using swagger-codegen
swagger-codegen generate -i openapi.yaml -l javascript -o ./client

Available Endpoints

Curricula

Method Endpoint Description
GET /api/v1/curricula List curricula for your organization
GET /api/v1/curricula/:id Get a specific curriculum with root nodes

Content Nodes

Method Endpoint Description
GET /api/v1/content_nodes/:id Get a content node with direct children
GET /api/v1/content_nodes/:id/resolved Get resolved content (merged inheritance)

User

Method Endpoint Description
GET /api/v1/me Get current authenticated user info

Response Caching

The API supports HTTP caching via ETags for efficient polling:

# First request - get the ETag
curl -i -H "Authorization: Bearer TOKEN" \
  https://your-domain.com/api/v1/curricula/123

# Response includes: ETag: "abc123"

# Subsequent request - use If-None-Match
curl -i -H "Authorization: Bearer TOKEN" \
  -H "If-None-Match: \"abc123\"" \
  https://your-domain.com/api/v1/curricula/123

# Returns 304 Not Modified if unchanged (no body, saves bandwidth)

Lazy Loading Pattern

Content nodes use a lazy-loading pattern for efficient tree traversal:

  1. Each node includes a has_children boolean
  2. Children are returned as direct descendants only (not full subtree)
  3. Traverse deeper by fetching child nodes as needed
// Recursive tree loading example
async function loadNode(nodeId) {
  const response = await fetch(`/api/v1/content_nodes/${nodeId}`, {
    headers: { 'Authorization': 'Bearer TOKEN' }
  });
  const { data } = await response.json();

  // Children are included in the response
  for (const child of data.relationships.children.data) {
    if (child.attributes.has_children) {
      // Fetch deeper children on demand
      await loadNode(child.id);
    }
  }
}

Error Codes

HTTP Status Code Description
401 unauthorized Invalid or missing API token
403 forbidden Token doesn't have access to this resource
404 not_found Resource doesn't exist
429 rate_limit_exceeded Too many requests
500 internal_error Server error (contact support)

Was this page helpful? |