🍿 @lorenzopant/tmdb

Add to Watchlist

Add a movie or TV show to the watchlist, or remove it.

Add a movie or TV show to an account's watchlist. Pass watchlist: false to remove an existing entry.

async add_to_watchlist(params: AccountMutationParams, body: AccountAddToWatchlistBody): Promise<AccountMutationResponse>

TMDB Reference: Add to Watchlist

Parameters

NameTypeRequiredDescription
account_idnumberThe TMDB account ID.
session_idstringSession ID for v3 session-based authentication.

Request Body

NameTypeRequiredDescription
media_type"movie" | "tv"The type of media to add to the watchlist.
media_idnumberThe TMDB ID of the movie or TV show.
watchlistbooleantrue to add, false to remove.

Returns

AccountMutationResponse

Errors

Errors are thrown as TMDBError and are never part of the return type:

HTTPTMDB codeCause
4013Invalid or missing access token.
4017Invalid session_id.
40434Account or media item not found.
42247Malformed request body (e.g. invalid JSON, wrong types).

Example

import { TMDB } from "@lorenzopant/tmdb";

const tmdb = new TMDB("your-access-token");

// Add to watchlist
await tmdb.account.add_to_watchlist({ account_id: 123 }, { media_type: "tv", media_id: 1396, watchlist: true });

// Remove from watchlist
await tmdb.account.add_to_watchlist({ account_id: 123 }, { media_type: "tv", media_id: 1396, watchlist: false });

On this page