Spotify Models Reference
Spotify models
- class AlbumModel(*, album_type: AlbumTypes, total_tracks: int, available_markets: Sequence[SpotifyMarketID] | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], name: str, release_date: date, release_date_precision: Literal['year', 'month', 'day'], restrictions: RestrictionsModel | None = None, type: Literal['album'], uri: SpotifyAlbumURI, artists: Sequence[SimplifiedArtistModel], album_group: str | None = None, tracks: PagedResultModel[SimplifiedTrackModel], copyrights: Sequence[CopyrightModel], external_ids: ExternalIdsModel | None = None, genres: Sequence[str], label: str | None = None, popularity: int | None = None)
Bases:
SimplifiedAlbumModelModel representing Spotify catalog information for a single album.
- album_group
This field describes the relationship between the artist and the album.
- available_markets
The markets in which the album is available.
- copyrights: Sequence[CopyrightModel]
The copyright statements of the album.
- external_ids: ExternalIdsModel | None
Known external IDs for the album.
- popularity: int | None
The popularity of the album. The value will be between 0 and 100, with 100 being the most popular.
- tracks: PagedResultModel[SimplifiedTrackModel]
The tracks of the album.
- class ArtistModel(*, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, name: str, type: Literal['artist'], uri: SpotifyArtistURI, followers: FollowersModel | None = None, genres: Sequence[str], images: Sequence[ImageModel], popularity: int | None = None)
Bases:
SimplifiedArtistModelModel representing Spotify catalog information for a single artist identified by their unique Spotify ID.
- followers: FollowersModel | None
Information about the followers of the artist.
- genres: Sequence[str]
A list of the genres the artist is associated with. If not yet classified, the array is empty.
- images: Sequence[ImageModel]
Images of the artist in various sizes, widest first.
- class CategoryModel(*, href: HttpUrl, icons: Sequence[ImageModel], id: str, name: str)
Bases:
BaseModelModel representing a single category used to tag items in Spotify.
- icons: Sequence[ImageModel]
The category icon, in various sizes.
- class CurrentUserModel(*, display_name: str | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: str, images: Sequence[ImageModel], type: Literal['user'], uri: SpotifyUserURI, followers: FollowersModel | None = None, country: SpotifyMarketID | None = None, email: str | None = None, explicit_content: ExplicitContentModel | None = None, product: str | None = None)
Bases:
UserModelModel representing detailed profile information about the current user.
- country: SpotifyMarketID | None
The country of the user, as set in the user’s account profile.
- explicit_content: ExplicitContentModel | None
The user’s explicit content settings.
- followers
Information about the followers of the user.
- class CurrentlyPlayingItemModel(*, context: ContextModel | None = None, timestamp: datetime, progress_ms: timedelta, is_playing: bool, item: TrackModel | EpisodeModel | None = None, currently_playing_type: SpotifyItemType | Literal['unknown'], actions: PlaybackActionsModel)
Bases:
BaseModelModel representing the item currently being played on the user’s Spotify account.
- classmethod convert_progress_ms_to_timedelta(value: int) timedelta
Converts track/episode progress given in milliseconds to timedelta object.
- Parameters:
value – Track/Episode progress [milliseconds].
- Returns:
Track/Episode progress as timedelta object.
- actions: PlaybackActionsModel
Allows to update the user interface based on which playback actions are available within the current context.
- context: ContextModel | None
A Context Object.
- currently_playing_type: SpotifyItemType | Literal['unknown']
The object type of the currently playing item.
- item: TrackModel | EpisodeModel | None
The currently playing track or episode.
- class DeviceModel(*, id: str | None = None, is_active: bool, is_private_session: bool, is_restricted: bool, name: str, type: str, volume_percent: int | None = None, supports_volume: bool)
Bases:
BaseModelModel representing information about an user’s Spotify Connect device.
- class EpisodeModel(*, audio_preview_url: HttpUrl | None = None, description: str, html_description: str, duration_ms: timedelta, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], is_externally_hosted: bool, is_playable: bool, language: str, languages: Sequence[str], name: str, release_date: date, release_date_precision: Literal['year', 'month', 'day'], resume_point: ResumePointModel | None = None, type: Literal['episode'], uri: SpotifyEpisodeURI, restrictions: RestrictionsModel | None = None, show: SimplifiedShowModel)
Bases:
SimplifiedEpisodeModelModel representing catalog information for a single episode identified by its unique Spotify ID.
- audio_preview_url
A URL to a 30 second preview (MP3 format) of the episode.
- language
The language used in the episode, identified by a ISO 639 code.
- show: SimplifiedShowModel
The show on which the episode belongs.
- class ImageModel(*, url: HttpUrl, height: int | None = None, width: int | None = None)
Bases:
BaseModelModel representing an image data.
- class PagedResultModel(*, href: HttpUrl, limit: int, next: HttpUrl | None = None, offset: int, previous: HttpUrl | None = None, total: int, items: Sequence)
-
Model representing the information about paged result.
- class PagedResultWithCursorsModel(*, href: HttpUrl, limit: int, next: HttpUrl | None = None, cursors: CursorsModel, items: Sequence, total: int | None = None)
-
Model representing the information about paged result with cursors used to find the next set of items.
- cursors: CursorsModel
The cursors used to find the next set of items.
- class PlayHistoryModel(*, track: TrackModel, played_at: datetime, context: ContextModel | None = None)
Bases:
BaseModelModel representing information about a play history.
- context: ContextModel | None
The context the track was played from.
- track: TrackModel
The track the user listened to.
- class PlaybackStateModel(*, context: ContextModel | None = None, timestamp: datetime, progress_ms: timedelta, is_playing: bool, item: TrackModel | EpisodeModel | None = None, currently_playing_type: SpotifyItemType | Literal['unknown'], actions: PlaybackActionsModel, device: DeviceModel, repeat_state: RepeatMode, shuffle_state: bool, smart_shuffle: bool | None = None)
Bases:
CurrentlyPlayingItemModelModel representing the playback state.
- device: DeviceModel
The device that is currently active.
- repeat_state: RepeatMode
off, track, context
- class PlaylistModel(*, collaborative: bool, description: str | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel] | None = None, name: str, owner: PlaylistOwnerModel, public: bool | None = None, snapshot_id: str, type: Literal['playlist'], uri: SpotifyPlaylistURI, items: PagedResultModel[PlaylistTrackModel])
Bases:
PlaylistBaseModelModel representing a playlist owned by a Spotify user.
- items: PagedResultModel[PlaylistTrackModel]
The tracks of the playlist.
- class PlaylistSummaryModel(*, href: HttpUrl, total: int)
Bases:
BaseModelModel representing information to retrieve full details of the playlist’s tracks.
- class PlaylistTrackModel(*, added_at: datetime | None = None, added_by: PlaylistOwnerModel | None = None, is_local: bool, item: TrackModel | EpisodeModel)
Bases:
BaseModelModel representing full details of the items of a playlist owned by a Spotify user.
- added_by: PlaylistOwnerModel | None
The Spotify user who added the track or episode.
- item: TrackModel | EpisodeModel
Information about the track or episode.
- class SavedAlbumModel(*, added_at: datetime, album: AlbumModel)
Bases:
BaseModelModel representing an album saved in the current Spotify user’s ‘Your Music’ library.
- added_at: datetime
The date and time the album was saved Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ
- album: AlbumModel
Information about the album.
- class SavedEpisodeModel(*, added_at: datetime, episode: EpisodeModel)
Bases:
BaseModelModel representing an episode saved in the current Spotify user’s library.
- added_at: datetime
The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
- episode: EpisodeModel
Information about the episode.
- class SavedShowModel(*, added_at: datetime, show: SimplifiedShowModel)
Bases:
BaseModelModel representing a show saved in the current Spotify user’s library.
- added_at: datetime
The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
- show: SimplifiedShowModel
Information about the show.
- class SavedTrackModel(*, added_at: datetime, track: TrackModel)
Bases:
BaseModelModel representing a track saved in the current Spotify user’s ‘Your Music’ library.
- added_at: datetime
The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
- track: TrackModel
Information about the track.
- class ShowModel(*, available_markets: Sequence[SpotifyMarketID] | None = None, copyrights: Sequence[CopyrightModel], description: str, html_description: str, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], is_externally_hosted: bool, languages: Sequence[str], media_type: str, name: str, publisher: str | None = None, type: Literal['show'], uri: SpotifyShowURI, total_episodes: int, episodes: PagedResultModel[SimplifiedEpisodeModel])
Bases:
SimplifiedShowModelModel representing catalog information for a single show identified by its unique Spotify ID.
- available_markets
A list of the countries in which the show can be played, identified by their ISO 3166-1 alpha-2 code.
- episodes: PagedResultModel[SimplifiedEpisodeModel]
The episodes of the show.
- publisher
The publisher of the show.
- class SimplifiedAlbumModel(*, album_type: AlbumTypes, total_tracks: int, available_markets: Sequence[SpotifyMarketID] | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], name: str, release_date: date, release_date_precision: Literal['year', 'month', 'day'], restrictions: RestrictionsModel | None = None, type: Literal['album'], uri: SpotifyAlbumURI, artists: Sequence[SimplifiedArtistModel], album_group: str | None = None)
Bases:
BaseModelModel representing simplified Spotify catalog information for a single album.
- classmethod fix_date_by_precision(data: dict) dict
Fixes the release_date field based on the release_date_precision field.
- Parameters:
data – The input data to validate.
- Returns:
The validated data with fixed release_date field.
- album_id: SpotifyItemID
The Spotify ID for the album.
- album_name: str
The name of the album. In case of an album takedown, the value may be an empty string.
- album_type: AlbumTypes
The type of the album.
- album_uri: SpotifyAlbumURI
The Spotify URI for the album.
- artists: Sequence[SimplifiedArtistModel]
The artists of the album.
- available_markets: Sequence[SpotifyMarketID] | None
The markets in which the album is available.
- external_urls: ExternalUrlsModel
Known external URLs for this album.
- images: Sequence[ImageModel]
The cover art for the album in various sizes, widest first.
- release_date_precision: Literal['year', 'month', 'day']
The precision with which release_date value is known.
- restrictions: RestrictionsModel | None
Included in the response when a content restriction is applied.
- class SimplifiedArtistModel(*, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, name: str, type: Literal['artist'], uri: SpotifyArtistURI)
Bases:
BaseModelModel representing simplified Spotify catalog information for a single artist.
- artist_id: SpotifyItemID
The Spotify ID for the artist.
- artist_uri: SpotifyArtistURI
The Spotify URI for the artist.
- external_urls: ExternalUrlsModel
Known external URLs for this artist.
- class SimplifiedEpisodeModel(*, audio_preview_url: HttpUrl | None = None, description: str, html_description: str, duration_ms: timedelta, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], is_externally_hosted: bool, is_playable: bool, language: str, languages: Sequence[str], name: str, release_date: date, release_date_precision: Literal['year', 'month', 'day'], resume_point: ResumePointModel | None = None, type: Literal['episode'], uri: SpotifyEpisodeURI, restrictions: RestrictionsModel | None = None)
Bases:
BaseModelModel representing simplified Spotify catalog information for a single episode.
- classmethod convert_duration_ms_to_timedelta(value: int) timedelta
Converts episode duration given in milliseconds to timedelta object.
- Parameters:
value – Episode duration [milliseconds].
- Returns:
Episode duration as timedelta object.
- classmethod fix_date_by_precision(data: dict) dict
Fixes the release_date field based on the release_date_precision field.
- Parameters:
data – The input data to validate.
- Returns:
The validated data with fixed release_date field.
- episode_id: SpotifyItemID
The Spotify ID for the episode.
- episode_uri: SpotifyEpisodeURI
The Spotify URI for the episode.
- external_urls: ExternalUrlsModel
External URLs for this episode.
- images: Sequence[ImageModel]
The cover art for the episode in various sizes, widest first.
- languages: Sequence[str]
A list of the languages used in the episode, identified by their ISO 639-1 code.
- release_date_precision: Literal['year', 'month', 'day']
The precision with which release_date value is known.
- restrictions: RestrictionsModel | None
Included in the response when a content restriction is applied.
- resume_point: ResumePointModel | None
The user’s most recent position in the episode
- class SimplifiedPlaylistModel(*, collaborative: bool, description: str | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel] | None = None, name: str, owner: PlaylistOwnerModel, public: bool | None = None, snapshot_id: str, type: Literal['playlist'], uri: SpotifyPlaylistURI, tracks: PlaylistSummaryModel | None = None)
Bases:
PlaylistBaseModelModel representing simplified Spotify catalog information for a single playlist.
- tracks: PlaylistSummaryModel | None
A collection containing a link ( href ) to the Web API endpoint where full details of the playlist’s tracks can be retrieved.
- class SimplifiedShowModel(*, available_markets: Sequence[SpotifyMarketID] | None = None, copyrights: Sequence[CopyrightModel], description: str, html_description: str, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, images: Sequence[ImageModel], is_externally_hosted: bool, languages: Sequence[str], media_type: str, name: str, publisher: str | None = None, type: Literal['show'], uri: SpotifyShowURI, total_episodes: int)
Bases:
BaseModelModel representing simplified Spotify catalog information for a single show.
- available_markets: Sequence[SpotifyMarketID] | None
A list of the countries in which the show can be played, identified by their ISO 3166-1 alpha-2 code.
- copyrights: Sequence[CopyrightModel]
The copyright statements of the show.
- external_urls: ExternalUrlsModel
External URLs for this show.
- images: Sequence[ImageModel]
The cover art for the show in various sizes, widest first.
- languages: Sequence[str]
A list of the languages used in the show, identified by their ISO 639 code.
- show_id: SpotifyItemID
The Spotify ID for the show.
- show_uri: SpotifyShowURI
The Spotify URI for the show.
- class SimplifiedTrackModel(*, artists: Sequence[SimplifiedArtistModel], available_markets: Sequence[SpotifyMarketID] | None = None, disc_number: int, duration_ms: timedelta, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, is_playable: bool | None = None, linked_from: LinkedFromModel | None = None, restrictions: RestrictionsModel | None = None, name: str, preview_url: str | None = None, track_number: int, type: Literal['track'], uri: SpotifyTrackURI, is_local: bool)
Bases:
BaseModelModel representing simplified Spotify catalog information for a single track.
- classmethod convert_duration_ms_to_timedelta(value: int) timedelta
Converts track duration given in milliseconds to timedelta object.
- Parameters:
value – Track duration [milliseconds].
- Returns:
Track duration as timedelta object.
- artists: Sequence[SimplifiedArtistModel]
The artists who performed the track.
- available_markets: Sequence[SpotifyMarketID] | None
A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code.
- external_urls: ExternalUrlsModel
Known external URLs for this track.
- is_playable: bool | None
Part of the response when Track Relinking is applied. If True, the track is playable in the given market. Otherwise False.
- linked_from: LinkedFromModel | None
Part of the response when Track Relinking is applied, and the requested track has been replaced with different track.
- restrictions: RestrictionsModel | None
Included in the response when a content restriction is applied.
- track_id: SpotifyItemID
The Spotify ID for the track.
- track_uri: SpotifyTrackURI
The Spotify URI for the track.
- class TrackModel(*, artists: Sequence[SimplifiedArtistModel], available_markets: Sequence[SpotifyMarketID] | None = None, disc_number: int, duration_ms: timedelta, explicit: bool, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, is_playable: bool | None = None, linked_from: LinkedFromModel | None = None, restrictions: RestrictionsModel | None = None, name: str, preview_url: str | None = None, track_number: int, type: Literal['track'], uri: SpotifyTrackURI, is_local: bool, album: SimplifiedAlbumModel, external_ids: ExternalIdsModel | None = None, popularity: int | None = None)
Bases:
SimplifiedTrackModelModel representing Spotify catalog information for a single track identified by its unique Spotify ID.
- album: SimplifiedAlbumModel
The album on which the track appears.
- available_markets
A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code.
- external_ids: ExternalIdsModel | None
Known external IDs for the track.
- linked_from
Part of the response when Track Relinking is applied, and the requested track has been replaced with different track.
- preview_url
A link to a 30 second preview (MP3 format) of the track.
- class UserModel(*, display_name: str | None = None, external_urls: ExternalUrlsModel, href: HttpUrl, id: str, images: Sequence[ImageModel], type: Literal['user'], uri: SpotifyUserURI, followers: FollowersModel | None = None)
Bases:
BaseModelModel representing public profile information about a Spotify user.
- external_urls: ExternalUrlsModel
Known external URLs for this user.
- followers: FollowersModel | None
Information about the followers of the user.
- images: Sequence[ImageModel]
The user’s profile image.
- user_uri: SpotifyUserURI
The Spotify URI for the user.
Spotify submodels
- class ContextModel(*, type: SpotifyItemType, href: HttpUrl, external_urls: ExternalUrlsModel, uri: SpotifyItemURI)
Bases:
BaseModelModel representing information about playback context.
- context_type: SpotifyItemType
The item type.
- context_uri: SpotifyItemURI
The Spotify URI for the context.
- external_urls: ExternalUrlsModel
External URLs for this context.
- class CopyrightModel(*, text: str, type: Literal['C', 'P'])
Bases:
BaseModelModel representing the copyright statements.
- class CursorsModel(*, after: str | None = None, before: str | None = None)
Bases:
BaseModelModel representing the cursors used to find the next set of items.
- class ExplicitContentModel(*, filter_enabled: bool, filter_locked: bool)
Bases:
BaseModelModel representing user’s explicit content settings.
- class ExternalIdsModel(*, isrc: str | None = None, ean: str | None = None, upc: str | None = None)
Bases:
BaseModelModel representing known external IDs.
- class ExternalUrlsModel(*, spotify: HttpUrl | None = None)
Bases:
BaseModelModel representing information about external URLs for an item.
- class FollowersModel(*, href: HttpUrl | None = None, total: int)
Bases:
BaseModelModel representing the information about the followers of an item.
- class LinkedFromModel(*, external_urls: ExternalUrlsModel, href: HttpUrl, id: SpotifyItemID, type: Literal['track'], uri: SpotifyTrackURI)
Bases:
BaseModelModel representing information about the Track Relinking.
- external_urls: ExternalUrlsModel
Known external URLs for this track.
- track_id: SpotifyItemID
The Spotify ID for the track.
- track_uri: SpotifyTrackURI
The Spotify URI for the track.
- class PlaybackActionsModel(*, interrupting_playback: bool | None = None, pausing: bool | None = None, resuming: bool | None = None, seeking: bool | None = None, skipping_next: bool | None = None, skipping_prev: bool | None = None, toggling_repeat_context: bool | None = None, toggling_shuffle: bool | None = None, toggling_repeat_track: bool | None = None, transferring_playback: bool | None = None)
Bases:
BaseModelModel representing information about playback actions that are available within the current context.
- class PlaylistOwnerModel(*, external_urls: ExternalUrlsModel, href: HttpUrl, id: str, type: Literal['user'], uri: SpotifyUserURI, display_name: str | None = None)
Bases:
BaseModelModel representing information about the user who owns the playlist.
- external_urls: ExternalUrlsModel
Known public external URLs for this user.
- user_uri: SpotifyUserURI
The Spotify URI for this user.
- class RestrictionsModel(*, reason: Literal['market', 'product', 'explicit'] | None = None)
Bases:
BaseModelModel representing content restriction.
- class ResumePointModel(*, fully_played: bool, resume_position_ms: timedelta)
Bases:
BaseModelModel representing user’s most recent position in the episode.