Tvmaze API

If you want to add TV information to your website or app then you've come to the right place!

We provide a free, fast and clean REST API that's easy to use, returns JSON and conforms to the HATEOAS and HAL principles. The root url is http://api.tvmaze.com and the available endpoints are documented below. If you have any questions or suggestions regarding the API, please post them on our forums.

In addition to the free public API, there's a user-level API available for all Premium members. The documentation for the user API can be viewed here.

Endpoints

Search

Show search

Search through all the shows in our database by the show's name. A fuzzy algorithm is used (with a fuzziness value of 2), meaning that shows will be found even if your query contains small typos. Results are returned in order of relevancy (best matches on top) and contain each show's full information.

The most common usecase for this endpoint is when you're building a local mapping of show names to TVmaze ID's and want to make sure that you're mapping to exactly the right show, and not to a different show that happens to have the same name. By presenting each show's basic information in a UI, you can have the end-user pick a specific entry from that list, and have your application store the chosen show's ID or URL. Any subsequent requests for information on that show can then be directly made to that show's URL.

Show single search

In some scenarios you might want to immediately return information based on a user's query, without the intermediary step of presenting them all the possible matches. In that case, you can use the singlesearch endpoint which either returns exactly one result, or no result at all. This endpoint is also forgiving of typos, but less so than the regular search (with a fuzziness of 1 instead of 2), to reduce the chance of a false positive.

As opposed to the regular search endpoint, the singlesearch endpoint allows embedding additional information in the result. See the section embedding for more information.

Beware that if multiple shows exist with an identical name (for example, Top Gear) it's undefined which of them will be returned by this endpoint. If you want to be sure you're matching with the proper show, use the search endpoint instead.

Show Lookup

If you already know a show's tvrage, thetvdb or IMDB ID, you can use this endpoint to find this exact show on TVmaze. If the given ID can be matched, a HTTP 302 redirect to the show's URL will be returned. Otherwise, a HTTP 404 is sent.

People search

Search through all the people in our database, using the same mechanism as described for show searches.

Schedule

The schedule is a complete list of episodes that air in a given country on a given date. Episodes are returned in the order in which they are aired, and full information about the episode and the corresponding show is included.

Note that contrary to what you might expect, the ISO country code for the United Kingdom is not UK, but GB.

Full schedule

The full schedule is a list of all future episodes known to TVmaze, regardless of their country. Be advised that this endpoint's response is at least several MB large. As opposed to the other endpoints, results are cached for 24 hours.

Shows

Show main information

Retrieve all primary information for a given show. This endpoint allows embedding of additional information. See the section embedding for more information.

Show episode list

A complete list of episodes for the given show. Episodes are returned in their airing order, and include full episode information. By default, specials are not included in the list.

Episode by number

Retrieve one specific episode from this show given its season number and episode number. This either returns the full information for one episode, or a HTTP 404.

Episodes by date

Retrieve all episodes from this show that have aired on a specific date. This either returns an array of full episode info, or a HTTP 404. Useful for daily (talk) shows that don't adhere to a common season numbering.

Show seasons

A complete list of seasons for the given show. Seasons are returned in ascending order and contain the full information that's known about them.

Show cast

A list of main cast for a show. Each cast item is a combination of a person and a character. Items are ordered by importance, which is determined by the total number of appearances of the given character in this show.

Show crew

A list of main crew for a show. Each crew item is a combination of a person and their crew type.

Show AKA's

A list of AKA's (aliases) for a show. An AKA with its country set to null indicates an AKA in the show's original country. Otherwise, it's the AKA for that show in the given foreign country.

Show index

A list of all shows in our database, with all primary information included. You can use this endpoint for example if you want to build a local cache of all shows contained in the TVmaze database. This endpoint is paginated, with a maximum of 250 results per page. The pagination is based on show ID, e.g. page 0 will contain shows with IDs between 0 and 250. This means a single page might contain less than 250 results, in case of deletions, but it also guarantees that deletions won't cause shuffling in the page numbering for other shows.

Because of this, you can implement a daily/weekly sync simply by starting at the page number where you last left off, and be sure you won't skip over any entries. For example, if the last show in your local cache has an ID of 1800, you would start the re-sync at page number floor(1800/250) = 7. After this, simply increment the page number by 1 until you receive a HTTP 404 response code, which indicates that you've reached the end of the list.

As opposed to the other endpoints, results from the show index are cached for up to 24 hours.

People

Person main information

Retrieve all primary information for a given person. This endpoint allows embedding of additional information. See the section embedding for more information.

Person cast credits

Retrieve all (show-level) cast credits for a person. A cast credit is a combination of both a show and a character. By default, only a reference to each show and character will be returned. However, this endpoint supports embedding, which means full information for the shows and characters can be included.

Person crew credits

Retrieve all (show-level) crew credits for a person. A crew credit is combination of both a show and a crew type. By default, only a reference to each show will be returned. However, this endpoint supports embedding, which means full information for the shows can be included.

Updates

Show updates

A list of all shows in the TVmaze database and the timestamp when they were last updated. Updating a direct or indirect child of a show will also mark the show itself as updated. For example; creating, deleting or updating an episode or an episode's gallery item will mark the episode's show as updated.

Embedding

As defined by the HAL convention, our API resources can contain links to related URLs. These URLs can refer to either a collection (like a list of episodes), or to an individual resource (like an episode). References to an individual resource are always advertised in the model's _links, for example as a show's _links.previousepisode or a cast credit's _links.character. References to collections are not actively advertised in the _links output, but are documented here. Both types of links can be embedded in the response by using the embed query parameter.

For example, http://api.tvmaze.com/shows/1?embed=episodes will serve the show's main information and its episode list in one single response. http://api.tvmaze.com/shows/1?embed=nextepisode would embed the details of that show's upcoming episode in the response, but only if one such episode currently exists. Embedding multiple links is possible with the array syntax: http://api.tvmaze.com/shows/1?embed[]=episodes&embed[]=cast

Images

Most resources available in the API have an image property that refers to that item's primary image. For shows, people and characters this is an image in poster format; for episodes the image is in landscape format. If an image exists, the image property will be a dictionary containing a "medium" and "original" key, referring to the image in fixed resized dimensions or in the original uploaded resolution. If no image exists yet, the image property will be NULL.

You are free to directly link ("hotlink") to our image CDN. However, for performance reasons we recommend to cache the images on your end: on your own server in case of a web application, or on the client in case of a desktop/mobile app. Images can safely be cached indefinitely: on our end the content of a specific image URL will never change; if an item's primary image changes, the item's image URL will change instead.

Caching

All output is cached by our HTTP load balancers for 60 minutes, so when information is updated on the site, please allow up to 1 hour for the changes to propagate to the API.

Rate limiting

API calls are rate limited to allow at least 20 calls every 10 seconds per IP address. If you exceed this rate, you might receive an HTTP 429 error. We say at least, because rate limiting takes place on the backend but not on the edge cache. So if your client is only requesting common/popular endpoints like shows or episodes (as opposed to more unique endpoints like searches or embedding), you're likely to never hit the limit. For an optimal throughput, simply let your client back off for a few seconds when it receives a 429.

Under special circumstances we may temporarily have to impose a stricter rate limit. So even if your client wouldn't normally exceed our rate limit, it's useful to gracefully handle HTTP 429 responses: simply retry the request after a small pause instead of treating it as a permanent failure.

While not required, we strongly recommend setting your client's HTTP User Agent to something that'll uniquely describe it. This allows us to identify your application in case of problems, or to proactively reach out to you.

CORS

All endpoints are CORS (Cross-origin resource sharing) enabled, which means our API can be used directly in web applications without having to resort to JSONP or HTTP proxying.

Licensing

Use of the TVmaze API is licensed by CC BY-SA. This means the data can freely be used for any purpose, as long as TVmaze is properly credited as source. You can do this by linking back to TVmaze from within your application or website, for example using the URLs available in the API.