Tài nguyên
Whiteboards Content API

Whiteboards Content API

List, create, read, update, publish, and delete TutorFlow whiteboards. Includes request examples, revision handling, and course lesson linking.

Trên trang này

The TutorFlow Whiteboards Content API lists, creates, reads, updates, publishes, and deletes the boards educators use in a classroom. All operations use /v1/content/classrooms/{classroomId}/whiteboards and a classroom-authorized tf_content_ API key. Whiteboard API requests use 0 AI credits.

Content API clients supply their own cards. The Whiteboards editor offers AI creation and editing, at one credit per successful operation. See Content API pricing for other resource costs.

Endpoints and scopes

Paths in this table are relative to /v1/content/classrooms/{classroomId}. Send the key as Authorization: Bearer tf_content_....

MethodPathScopeSuccess response
GET/whiteboardscontent:read200 with paginated board previews.
POST/whiteboardscontent:write201 with the new draft.
GET/whiteboards/{id}content:read200 with the complete draft and its current revision.
PATCH/whiteboards/{id}content:write200 with the updated draft. Set publish: true to publish it.
GET/whiteboards/{id}/publishedcontent:read200 with the published title, cards, and revision.
DELETE/whiteboards/{id}content:write200 with the board ID and deletion status.

For generated clients, use the Content API OpenAPI document. For a safe place to try requests, use a test key and the API sandbox classroom.

Find a board

HTTP
GET /v1/content/classrooms/{classroomId}/whiteboards?page=1&limit=50&search=retro&publishedOnly=true
Authorization: Bearer tf_content_...

The list returns { "items", "totalCount" }. Items contain id, the current draft title, isPublished, and up to 20 lightweight previewCards. Results sort by creation time, newest first, then by ID. page starts at 1. limit defaults to 50 and is capped at 100. search matches a literal, case-insensitive substring of the draft title. Set publishedOnly=true to list boards that have a published snapshot.

Preview cards carry geometry and lightweight labels. Use Read the complete draft before editing.

Create a draft

Generate a UUID for each new board. Store it in your system and reuse it when retrying the create. A retry with the same ID returns the latest state of the existing board without replacing its contents. Use the environment variables from the Quickstart.

bash
curl -X POST "$TUTORFLOW_API_BASE_URL/v1/content/classrooms/$CLASSROOM_ID/whiteboards" \
  -H "Authorization: Bearer $TUTORFLOW_CONTENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "6b7dc281-b57e-4bc8-939d-a55281885267",
    "title": "Team retrospective",
    "cards": [
      {
        "id": "677b3538-868f-4490-bbd8-e249bc44b446",
        "kind": "note",
        "color": "mint",
        "x": 40,
        "y": 40,
        "w": 320,
        "h": 200,
        "text": "What should we keep doing?"
      }
    ]
  }'

A new board returns 201 with revision: 1, isPublished: false, and isCurrentPublished: false. Titles must contain non-whitespace text and can be up to 200 characters. A blank board uses cards: []. Use a new UUID for a new board after deletion.

Read the complete draft

HTTP
GET /v1/content/classrooms/{classroomId}/whiteboards/{id}
Authorization: Bearer tf_content_...

The response includes id, title, cards, revision, isPublished, and isCurrentPublished. Store revision from this response before saving.

JSON
{
  "id": "6b7dc281-b57e-4bc8-939d-a55281885267",
  "title": "Team retrospective",
  "cards": [
    {
      "id": "677b3538-868f-4490-bbd8-e249bc44b446",
      "kind": "note",
      "color": "mint",
      "x": 40,
      "y": 40,
      "w": 320,
      "h": 200,
      "text": "What should we keep doing?"
    }
  ],
  "revision": 1,
  "isPublished": false,
  "isCurrentPublished": false
}

Save or publish

PATCH replaces the entire draft. Read or retain the current revision, then send that value with the complete title, cards, and publish flag. The response carries the next revision. On 409 content_conflict, read the current draft, reconcile any edits, and retry with its revision.

bash
curl -X PATCH "$TUTORFLOW_API_BASE_URL/v1/content/classrooms/$CLASSROOM_ID/whiteboards/$BOARD_ID" \
  -H "Authorization: Bearer $TUTORFLOW_CONTENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Team retrospective",
    "revision": 1,
    "publish": true,
    "cards": [
      {
        "id": "677b3538-868f-4490-bbd8-e249bc44b446",
        "kind": "note",
        "color": "mint",
        "x": 40,
        "y": 40,
        "w": 320,
        "h": 200,
        "text": "What should we keep doing?"
      }
    ]
  }'

publish: true updates the snapshot used by every lesson linked to the board. publish: false saves the draft while linked lessons continue showing the previous snapshot. isPublished tells you whether any snapshot exists, and isCurrentPublished tells you whether it matches the current draft. Whiteboards use the body revision for concurrency and the client-generated id for create retries.

Read the published snapshot

HTTP
GET /v1/content/classrooms/{classroomId}/whiteboards/{id}/published
Authorization: Bearer tf_content_...

The response is { "id", "title", "cards", "revision" }. The revision belongs to the published snapshot and can be older than the draft revision. Use this endpoint to verify what linked lessons display. A board without a published snapshot returns 404 content_not_found.

Delete a board

bash
curl -X DELETE "$TUTORFLOW_API_BASE_URL/v1/content/classrooms/$CLASSROOM_ID/whiteboards/$BOARD_ID" \
  -H "Authorization: Bearer $TUTORFLOW_CONTENT_API_KEY"
JSON
{
  "id": "6b7dc281-b57e-4bc8-939d-a55281885267",
  "deleted": true,
  "success": true
}

Deletion removes the board from the Content API and classroom library. Lessons that already use the board keep showing its last published snapshot. Remove or replace the whiteboard lessons if learners should stop seeing that content. A deleted board cannot be linked to another lesson. Subsequent reads, saves, and delete requests for the board return 404. There is no restore endpoint.

Publish the board first, then create a lesson in the same classroom with type: "whiteboard". The content field is a string containing a JSON object with the board ID in assetId. Use the course and chapter IDs from the course curriculum routes.

bash
curl -X POST "$TUTORFLOW_API_BASE_URL/v1/content/classrooms/$CLASSROOM_ID/courses/$COURSE_ID/chapters/$CHAPTER_ID/lessons" \
  -H "Authorization: Bearer $TUTORFLOW_CONTENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: lesson:team-retrospective:v1" \
  -d '{
    "title": "Team retrospective",
    "type": "whiteboard",
    "isPublic": true,
    "content": "{\"assetId\":\"6b7dc281-b57e-4bc8-939d-a55281885267\"}"
  }'

isPublic makes the lesson visible to learners who can access the course. If you omit it, the lesson starts hidden. To replace the board on an existing whiteboard lesson, send a new content value with PATCH /courses/{courseId}/lessons/{lessonId}. A board that has no published snapshot or belongs to another classroom returns 404 when linked.

Card format

The cards array is ordered from back to front and accepts up to 150 cards. Each card needs a distinct UUID in id, a kind, text up to 2,000 characters, and integer x, y, w, and h in canvas units. Coordinates run from -100,000 to 100,000. Width and height run from 1 to 10,000.

FieldValues
kindnote, source, heading, ink, rectangle, ellipse, coordinatePlane, numberLine, graphPaper, ruledPaper, scene, or equation.
coloryellow, mint, blue, or pink.
previewOptional inline WebP data URL, up to 65,000 characters. Use this for previews of source files.
pointsOptional ink coordinates, alternating local x and y, at most 1,024 integers from 0 to 10,000.
strokeWidth, inkStyleInk width 1, 3, 6, 10, 18, or 30. Set inkStyle to marker for highlighter strokes.
connectionsUp to 32 outgoing links. Each has a distinct destination card to, a style (straight, elbow, or curve), optional heads (end, both, or none), and a label of up to 80 characters.
groupId, pinnedOptional UUID for grouped cards and boolean pin state.

POST and PATCH accept JSON bodies up to 12 MiB. The OpenAPI document contains the complete request and response schemas.

Error responses

StatusCodeWhat to check
401content_invalid_api_keySend a valid Content API key in the Authorization header.
403content_insufficient_scope or content_classroom_not_allowedUse a key with the endpoint's scope and classroom access.
404content_not_foundCheck the classroom and board IDs. A deleted board or missing published snapshot also returns this status.
409content_conflictA save used a stale draft revision. Read the draft and reconcile the changes.
413content_payload_too_largeKeep the JSON body at or below 12 MiB.
422content_invalid_requestCorrect invalid IDs, missing fields, or card data outside the schema limits.
429content_rate_limit_exceededUse the rate-limit response headers before retrying.

See Content API errors for the error envelope and additional key and access errors.

Trang này có hữu ích với bạn không?