Admin Guide

API Reference

Complete reference for the RokuChannel Platform REST API. The API runs on port 8065 and uses JWT-based authentication. All responses are JSON.

API Request Flow

Client HTTP Request JWT Auth Decode + validate Rate Limit 100/min default Route Handler Business logic Database PostgreSQL + Redis JSON Response Status + body Bearer token 401 if invalid 429 if exceeded Pydantic schemas SQLAlchemy ORM GZip compressed

Figure 8: API Request Flow -- Client through JSON Response

Authentication

All authenticated endpoints require a JWT token obtained from ONETIMELOGIN SSO.

Header Format

http
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Alternatively, the token can be sent as an access_token cookie.

JWT Claims

ClaimDescriptionExample
subUser ID01905a3b-...
emailUser emailadmin@example.com
roleUser roleADMIN
permissionsPermission list["read", "write"]
site_codeSite identifierroku
tenant_idTenant partition keydefault

Base URL & Versioning

text
Base URL:  http://localhost:8065
API Prefix: /api
Version:    1.0.0 (see GET /api/info)
The API does not use URL-based versioning (e.g., /api/v1/). The version is returned in the GET /api/info response. Future breaking changes will be communicated through version bumps.

Error Response Format

All error responses follow a consistent format:

json
{
  "detail": "Channel not found"
}
Status CodeMeaningCommon Causes
400Bad RequestInvalid input, validation errors
401UnauthorizedMissing/invalid JWT token
403ForbiddenInsufficient role (admin required)
404Not FoundResource does not exist or is soft-deleted
422Unprocessable EntityPydantic validation failure
429Too Many RequestsRate limit exceeded (100/min)
500Internal Server ErrorServer-side failure

Rate Limiting

The API enforces rate limiting to protect against abuse:

  • Default limit: 100 requests per minute per client
  • Storage: Redis-backed (falls back to in-memory)
  • Response: Returns 429 Too Many Requests when exceeded
  • Configuration: Adjustable via rate_limit_default in settings
CSRF protection applies to state-changing methods (POST, PUT, DELETE, PATCH) when using cookie-based auth. API calls with Authorization: Bearer header bypass CSRF checks.

Complete Endpoint Reference

Channel Endpoints

MethodPathAuthDescription
POST/api/channelsUserCreate a new channel
GET/api/channelsUserList all channels (paginated: ?page=1&per_page=20)
GET/api/channels/{id}UserGet channel by ID
PUT/api/channels/{id}UserUpdate a channel (partial update)
DELETE/api/channels/{id}AdminDelete channel (soft-delete)

Video Endpoints

MethodPathAuthDescription
POST/api/episodes/{id}/videoUserCreate or update video asset (upsert)
GET/api/episodes/{id}/videoUserGet video asset for episode

Homework Endpoints

MethodPathAuthDescription
POST/api/episodes/{id}/homeworkUserCreate homework for episode
GET/api/episodes/{id}/homeworkUserList homework for episode
PUT/api/episodes/homework/{id}UserUpdate homework
DELETE/api/episodes/homework/{id}UserDelete homework (soft-delete)
POST/api/episodes/homework/{id}/submitUserSubmit homework (student)
PUT/api/episodes/homework/submissions/{id}/gradeUserGrade a homework submission

Test Endpoints

MethodPathAuthDescription
POST/api/episodes/{id}/testsUserCreate a test for episode
GET/api/episodes/{id}/testsUserList tests for episode
PUT/api/episodes/tests/{id}UserUpdate a test
DELETE/api/episodes/tests/{id}UserDelete a test (soft-delete)
POST/api/episodes/tests/{id}/questionsUserAdd question to test
GET/api/episodes/tests/{id}/questionsUserList questions in test
PUT/api/episodes/questions/{id}UserUpdate a question
DELETE/api/episodes/questions/{id}UserDelete a question (soft-delete)
POST/api/episodes/tests/{id}/attemptUserSubmit test attempt (auto-grades)

Student Endpoints

MethodPathAuthDescription
POST/api/enrollUserEnroll in a channel (idempotent)
GET/api/enrollmentsUserList my enrollments
POST/api/progressUserUpdate watch progress (upsert)
GET/api/progress/{episode_id}UserGet watch progress for episode
GET/api/gradesUserGet all my grades
GET/api/grades/{episode_id}UserGet grade for specific episode

Roku Feed Endpoint

MethodPathAuthDescription
GET/api/roku/feed/{channel_id}PublicPublic Roku JSON content feed (no auth)

Innovation Endpoints

MethodPathAuthDescription
POST/api/innovation/run/{agent_type}AdminTrigger innovation agent (content or engagement)
GET/api/innovation/statusUserGet LLM configuration status
GET/api/innovation/suggestionsUserList suggestions (?agent_type=&status=&page=)
PUT/api/innovation/suggestions/{id}AdminReview a suggestion

System Endpoints

MethodPathAuthDescription
GET/healthPublicHealth check (DB status, response time)
GET/api/infoPublicAPI info (name, version, SSO URL)
GET/api/csrf-tokenPublicGenerate CSRF token + set cookie

Endpoint Summary

CategoryCountAuth Level
Channel API5User (Delete: Admin)
Video API2User
Homework API6User
Test API9User
Student API6User
Roku Feed1Public
Innovation API4User (Run/Review: Admin)
System3Public
Total API Routes36
In addition to the 36 API routes, the application serves 14 static HTML pages (dashboard, channels, episodes, student views, etc.) for a total of 50 routes.

Pagination

List endpoints support pagination via query parameters:

http
GET /api/channels?page=1&per_page=20

Response:
{
  "items": [...],
  "total": 42,
  "page": 1,
  "per_page": 20,
  "pages": 3
}
  • page -- Page number (starts at 1)
  • per_page -- Items per page (default: 20, max: 100)