Skip to Content
Xeonr Developer Docs

Trakt

XMB links a viewer's account to their own trakt.tv account: what they play scrobbles there as it happens, and what Trakt already knows — watches recorded by other apps, positions paused in them — comes back as watched episodes and resume points.

One service carries the surface, under xmb.api.v1:

ServiceWhat it covers
TraktServiceMaking and managing the link, its three switches, and asking for a sync now

The link belongs to the person, not to a server. Link once, from any server's settings, and the account scrobbles what plays on every server the person is a member of and syncs against every shelf they can see. Watch state itself is kept the same way — a title is the same title wherever it is catalogued — so a film finished on one server reads finished on the next, and a Trakt watch lands once, for every server that holds the title.

Every TraktService request still carries a server_slug field. It is deprecated and ignored: the link is found from the caller's bearer token. Clients built before September 2026 always send it and keep working; new clients leave it empty.

The device flow

Trakt's device flow is the one link that works identically on a television, a phone and a browser: the API asks Trakt for a code, the surface shows it, the viewer types it at the verification URL on whatever has a keyboard, and the API polls Trakt for the outcome. Tokens never reach a client.

  1. BeginTraktDeviceLink returns user_code, verification_url, expires_at and poll_interval_seconds. Show the code large and do nothing else with it. Calling again abandons the previous attempt.
  2. PollTraktDeviceLink at that interval. The API relays to Trakt at most once per interval however eagerly a surface asks. The answer is PENDING (keep polling), or one of three terminal states: CONNECTED (with the connection, so the surface flips straight to the linked view), DENIED, or EXPIRED (start again).

GetTraktConnection is the one read a settings surface needs. Its status is NOT_CONFIGURED when the deployment has no Trakt application registered — a fact about the deployment, not the caller, so render nothing rather than a connect button that cannot work — DISCONNECTED, or CONNECTED with the connection: the linked trakt_username, connected_at, the optional last_synced_at, needs_reauth, the settings, unmatched_title_count and the optional last_sync_error.

needs_reauth means Trakt stopped honouring the grant (revoked there, or the refresh finally failed). Scrobbling and sync pause until the person links again; relinking lands on the same connection and keeps its settings.

Settings

UpdateTraktSettings replaces the whole set — three switches on one panel are one fact. All three default on; linking is itself the opt-in.

SettingMeaning
scrobbleSend what the person plays — on any server — as it happens: now watching, pauses, each finished play
pull_watchedBring watches recorded on Trakt back as watched episodes
pull_progressBring paused positions saved on Trakt back as resume points

DisconnectTrakt revokes the grant at Trakt where possible and deletes the stored tokens regardless. Watch history on both sides stays exactly as it was.

What syncs, and when

Scrobbling is the server's job: no player ever learns Trakt exists, and there is no scrobble method. A play beginning, pausing, resuming and stopping — including a session the platform closes because a tab crashed — reaches Trakt off the playback lifecycle, best-effort. Trakt counts a stop past 80% as watched; XMB counts 90%. Each side applies its own rule and the next pull reconciles the band between.

A durable reconcile runs for each linked account every six hours, and on demand. TriggerTraktSync queues one now rather than at the next pass: INCREMENTAL (what changed since the last checkpoint, both ways — the "sync now" button) or FULL (everything, both ways — the first-link import, and the repair button when somebody suspects drift). It returns once queued, not once done; last_synced_at reports completion.

The push is add-only, following Trakt's own guidance: unmarking a title here never deletes history there.

Matching is by ids only — imdb, tmdb, tvdb — never by title, because a wrong guess writes to somebody's real account. unmatched_title_count is the size of the gap: titles the person has watched that the last sync could not express to Trakt, either because nothing identified them or because their only ids are ones Trakt does not accept (AniList-only anime). A title on Trakt that no library has yet catalogued has nowhere to land until one does; a FULL sync afterwards picks it up.

Scopes

GetTraktConnection needs xmb:user:read; everything else needs xmb:user:write. There is no server to be a member of: the token is the whole authority.

On this page