Skip to content

API overview

Everything in Toto – the authoring interface, the player apps, the operator tools – uses the same HTTP API. All endpoints are served under https://api.toto.io/v2.

The complete reference with every endpoint, its parameters and responses is the Swagger documentation. Every endpoint there describes in its Access paragraph which login and which repository role it requires and whether it can be used with an api key.

Path Purpose
/v2/auth login, registration, passwords, passkeys
/v2/account the account of the logged in user
/v2/apikey personal api keys
/v2/edit/{repoId}/… building games: stories, challenges, elements, areas, variables, files
/v2/op/{repoId}/… operating running games: sessions, monitoring
/v2/session playing games
/v2/pub public data, no login required

POST /v2/auth/login sets a session cookie, which the browser sends with every request. Requests with a cookie that change data (POST, PUT, DELETE) need a CSRF token: the value of the cookie csrfToken sent in the header Csrf-Token.

A personal api key lets a program use the API on behalf of an account, for example a locally running MCP server used by an AI agent. Send it as header:

Authorization: Bearer toto_…
  • A key is created for a list of repositories. In each of them the key has the same role as the account – never more. If the account loses access to a repository, the key loses it immediately too.
  • readOnly keys can only use endpoints that read data. Keys can only delete data if they were created with allowDelete.
  • Only endpoints marked with “Api key: available” in the Swagger docs can be used with a key: the endpoints to read and build the content of a repository (/v2/edit/{repoId}/…, /v2/op/{repoId}/…). Account, login, admin and session endpoints answer 403.
  • A key expires after 1 to 365 days (default 30). Requests with a key need no CSRF token.

Keys are managed with the session cookie:

Method Path
POST /v2/apikey create a key – the response contains the key once
GET /v2/apikey list own keys
DELETE /v2/apikey/{id} revoke a key
GET /v2/apikey/self with the key: its repositories and the current role in each of them
  • Ids are UUIDs.
  • Dates are integers: milliseconds since 1970-01-01 (UTC).
  • Errors are returned as TotoError with a code (e.g. auth:70), a message and optional details. All codes: Error codes.
  • All values of enumerations (element types, scopes, …): Enumerations.