Ressourcen
Games over the Content API

Games over the Content API

The game object, its brief, and the metadata keys that shape its plan. Create, list, and update classroom games from an external system.

Auf dieser Seite

A game is a playable web page built from a practice objective. Games use the same operations and credit prices as the TutorFlow editor. Every route is under /v1/content/classrooms/{classroomId}/games and takes a tf_content_ key.

Planning, building, revising, restoring, and sharing work the same way for games and simulations, and are described once in Generation: Brief, Build, Revise. This page covers what is specific to games. The full route list is in the API Reference.

The game object

Create, read, update, and restore return the same shape. content appears only on GET /games/{gameId}.

FieldNotes
idUse as {gameId} on later calls.
classroomIdThe classroom the game belongs to.
title, descriptionDisplay text. description may be null.
visibilityPRIVATE or PUBLIC. A public game opens at its play link without an account.
slugA short label TutorFlow assigns. It is not part of any link.
metadataAn object you own. The keys in Metadata that shapes the plan feed the brief; other keys are stored untouched.
briefThe plan the build reads. null until a brief is generated or written. See The brief.
contentKeyStorage reference of the version being served. An opaque identifier, not a URL. null until the first build.
contentVersionThe version being served. 0 until the first build, then incremented by every build, revision, and restore.
buildHistoryOne entry per version: version, contentKey (opaque), createdAt, source (build, revision, or restore), note with the revision feedback when there was one, and restoredFromVersion on a restore.
thumbnailStorage reference of a capture of the opening screen, or null. An opaque identifier, not a URL.
contentThe built game as one complete HTML document, or null before the first build. Only on GET /games/{gameId}.
createdAt, updatedAtTimestamps. Sort the list by updatedAt to find recent changes.

content is the whole page and can be large, so lists never include it. To show a game to people, share its play link (see Share and delete) or serve the HTML from content yourself.

The brief

A generated brief has these fields. Write your own with PATCH /games/{gameId} and a brief object to skip the priced brief call.

FieldNotes
titleShort, concrete title for the game.
pitchOne sentence on what playing it is like.
coreLoopThe action the player repeats.
mechanicsTwo to five rules or devices the game is built from.
levelsTwo to six entries of name, goal, and twist.
winCondition, failConditionWhat ends a run either way.
controlsHow it is played, by keyboard and by touch.

Metadata that shapes the plan

The TutorFlow create wizard stores its answers on metadata, and the brief reads the same keys. All are optional. PATCH merges metadata: keys you send replace their old values, and keys you leave out stay.

KeyValuesNotes
topicFree textWhat the game teaches. Falls back to title.
audienceFree textWho plays it.
objectiveFocusFree textThe skill a round should exercise.
mechanicFree textA mechanic to build around, if you have one in mind.
dimension2d or 3dDefaults to 2d. It does not change the price.
persistencesession or localWhether progress survives a reload. Defaults to session.
playLengthshort, standard, or deepDefaults to standard.
visualStyleFree textArt direction for the page.
languageLanguage name or codeLanguage of on-screen text. Set it; it is not inferred.
referenceMarkdownMarkdownYour own material to ground the plan. POST /brief can override it per call.

Create a game

title and visibility are required. Keep new games PRIVATE until a person has played the build.

bash
curl -X POST "$TUTORFLOW_API_BASE_URL/v1/content/classrooms/$CLASSROOM_ID/games" \
  -H "Authorization: Bearer $TUTORFLOW_CONTENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: game:fractions-run:v1" \
  -d '{
    "title": "Fractions run",
    "description": "Practice comparing fractions under time pressure.",
    "visibility": "PRIVATE",
    "metadata": {
      "topic": "Comparing fractions with unlike denominators",
      "audience": "Grade 5",
      "objectiveFocus": "Decide which of two fractions is larger",
      "playLength": "short",
      "language": "en",
      "externalId": "game:fractions-run"
    }
  }'

The response is 201 with the game object, contentVersion: 0, brief: null.

List games

HTTP
GET /v1/content/classrooms/{classroomId}/games?page=1&limit=20&field=updatedAt&order=DESC&search=fraction
Authorization: Bearer tf_content_...
ParameterDefaultNotes
page11-based.
limit20Values above 100 are clamped to 100. take is a deprecated alias.
fieldcreatedAttitle, createdAt, or updatedAt. Anything else returns 422 with error.allowedValues.
orderDESCASC or DESC. Ties break on id.
searchCase-insensitive substring of title.
updatedSinceISO 8601 date-time. Only games updated at or after it.

The response is the list envelope with game objects without content. The same parameters work on every resource list; see List pages.

Update a game

PATCH /games/{gameId} is partial. It accepts title, description, visibility, brief, thumbnail, and metadata, and returns 200 with the updated game. contentKey and contentVersion belong to the build pipeline and cannot be set.

War diese Seite hilfreich?