1. Get the average ratings for Suicide Squad (2021) and the
number of people who rated the title.
Request:
{
# Get the Suicide squad
title(id: "tt6334354") {
ratingsSummary {
# Get the average rating for the suicide squad
aggregateRating
# Get the number of ratings given for the suicide squad
voteCount
}
}
}
Response:
{
"data": {
"title": {
"ratingsSummary": {
"aggregateRating": 7.6,
"voteCount": 98808
}
}
},
"extensions": {
"disclaimer": "Use of the IMDb data provided by this API is governed by the AWS Data Subscription Agreement and IMDb Content License Agreement."
}
}
Request:
{
# Get the title 'It'
title(id: "tt1396484") {
# Get the first two plot texts for It
plots(first: 2) {
edges {
node {
plotText {
plainText
}
}
}
}
# Get the genres for It
genres {
genres {
text
}
}
# Get the certificate for It
certificate {
# Get the rating
rating
# Get the country this certificate is from
country {
id
text
}
# Get why this rating was given for It
ratingReason
}
}
}
Response:
{
"data": {
"title": {
"plots": {
"edges": [
{
"node": {
"plotText": {
"plainText": "In the summer of 1989, a group of bullied kids band together to destroy a shape-shifting monster, which disguises itself as a clown and preys on the children of Derry, their small Maine town."
}
}
},
{
"node": {
"plotText": {
"plainText": "In the Town of Derry, the local kids are disappearing one by one. In a place known as 'The Barrens', a group of seven kids are united by their horrifying and strange encounters with an evil clown and their determination to kill It."
}
}
}
]
},
"genres": {
"genres": [
{
"text": "Horror"
}
]
},
"certificate": {
"rating": "R",
"country": {
"id": "US",
"text": "United States"
},
"ratingReason": "Rated R for violence/horror, bloody images, and for language"
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
2. Get the runtime, the release date and the coloration for the movie WALL·E.
Request:
{
# Get WALL·E
title(id: "tt0910970") {
# Get the runtime of WALL·E
runtime {
seconds
}
# Get the release day of WALL·E
releaseDate {
day
month
year
}
# Get the technical specifications of WALL·E
technicalSpecifications {
# Get the colourations that WALL·E was released in
colorations {
items {
text
}
}
}
}
}
Response:
{
"data": {
"title": {
"runtime": {
"seconds": 5880
},
"releaseDate": {
"day": 27,
"month": 6,
"year": 2008
},
"technicalSpecifications": {
"colorations": {
"items": [
{
"text": "Color"
}
]
}
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
3. For the movie WALL·E, get the name text and
the credit category of the first 2 credits.
Request:
{
# Get WALL·E
title(id: "tt0910970") {
# Get the first two credits for WALL·E
credits(first: 2) {
edges {
node {
# Get the name associated with that credit
name {
nameText {
text
}
}
# Get the category for that credit (e.g Actor, Director)
category {
text
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"node": {
"name": {
"nameText": {
"text": "Ben Burtt"
}
},
"category": {
"text": "Actor"
}
}
},
{
"node": {
"name": {
"nameText": {
"text": "Elissa Knight"
}
},
"category": {
"text": "Actress"
}
}
}
]
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
4. For the movie Inception, get the first two
credits. From those two credits, get the name associated with that credit. For
that name, find two titles that they are known for, the IMDb star rating of
that movie and the name of the character they played in that movie.
Request:
{
# Get the movie Inception
title(id: "tt1375666") {
# Get the first two credits on Inception
credits(first: 2) {
edges {
node {
# Get the name associated with a given credit
name {
nameText {
text
}
# Get the first two titles that name is known for
knownFor(first: 2) {
edges {
node {
title {
#Get the title text for the title that the name is known for
titleText {
text
}
# Get the rating for that title that the name is known for
ratingsSummary {
aggregateRating
}
}
summary {
# Get the name of the charachter that they played in the title they are known for
principalCharacters {
name
}
}
}
}
}
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"node": {
"name": {
"nameText": {
"text": "Leonardo DiCaprio"
},
"knownFor": {
"edges": [
{
"node": {
"title": {
"titleText": {
"text": "Inception"
},
"ratingsSummary": {
"aggregateRating": 8.8
}
},
"summary": {
"principalCharacters": [
{
"name": "Cobb"
}
]
}
}
},
{
"node": {
"title": {
"titleText": {
"text": "The Departed"
},
"ratingsSummary": {
"aggregateRating": 8.5
}
},
"summary": {
"principalCharacters": [
{
"name": "Billy"
}
]
}
}
}
]
}
}
}
},
{
"node": {
"name": {
"nameText": {
"text": "Joseph Gordon-Levitt"
},
"knownFor": {
"edges": [
{
"node": {
"title": {
"titleText": {
"text": "Inception"
},
"ratingsSummary": {
"aggregateRating": 8.8
}
},
"summary": {
"principalCharacters": [
{
"name": "Arthur"
}
]
}
}
},
{
"node": {
"title": {
"titleText": {
"text": "Looper"
},
"ratingsSummary": {
"aggregateRating": 7.4
}
},
"summary": {
"principalCharacters": [
{
"name": "Joe"
}
]
}
}
}
]
}
}
}
}
]
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
5. Get Inception and The Dark Knight. For those two
titles, get the first keyword and how interested users were with the keyword.
Request:
query {
# Get Inception and The Dark Knight
titles(ids: ["tt1375666", "tt0468569"]) {
# Get the first keyword for each title
keywords(first: 1) {
edges {
node {
# Get the keyword text
text
# Get the number of 'interesting' votes for this keyword
interestScore {
usersInterested
usersVoted
}
}
}
}
}
}
Response:
{
"data": {
"titles": [
{
"keywords": {
"edges": [
{
"node": {
"text": "dream",
"interestScore": {
"usersInterested": 22,
"usersVoted": 22
}
}
}
]
}
},
{
"keywords": {
"edges": [
{
"node": {
"text": "dc comics",
"interestScore": {
"usersInterested": 21,
"usersVoted": 21
}
}
}
]
}
}
]
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
6. Get episodes for the TV Series Futurama.
Request:
{
# Get Futurama
title(id: "tt0149460") {
# Get the title type of Futurama (TV Series)
titleType {
text
canHaveEpisodes
}
# Get the first three episodes of Futurama
episodes {
episodes(first: 3) {
edges {
node {
# Get the names of the episodes
titleText {
text
}
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"titleType": {
"text": "TV Series",
"canHaveEpisodes": true
},
"episodes": {
"episodes": {
"edges": [
{
"node": {
"titleText": {
"text": "Space Pilot 3000"
}
}
},
{
"node": {
"titleText": {
"text": "The Series Has Landed"
}
}
},
{
"node": {
"titleText": {
"text": "I, Roommate"
}
}
}
]
}
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
1. List the first three awards that Jennifer Lawrence, Morgan Freeman and Patrick Swayzee have won:
Request:
{
# Get Jennifer Lawrence, Morgan Freeman and Patrick Swayzee
names(ids: ["nm2225369", "nm0000664", "nm0000151"]) {
nameText {
text
}
# Get the first 3 awards that a given name won
awardNominations(first: 3, filter: { wins: WINS_ONLY }) {
edges {
node {
award {
# Get the award text for a given award
text
# Get the name of the event the award was given
event {
text
}
# Get the year of the award
year
}
}
}
}
}
}
Response:
{
"data": {
"names": [
{
"nameText": {
"text": "Jennifer Lawrence"
},
"awardNominations": {
"edges": [
{
"node": {
"award": {
"text": "Marcello Mastroianni Award",
"event": {
"text": "Venice Film Festival"
},
"year": 2008
}
}
},
{
"node": {
"award": {
"text": "Young Artist Award",
"event": {
"text": "Young Artist Awards"
},
"year": 2009
}
}
},
{
"node": {
"award": {
"text": "Golden Space Needle Award",
"event": {
"text": "Seattle International Film Festival"
},
"year": 2010
}
}
}
]
}
},
{
"nameText": {
"text": "Patrick Swayze"
},
"awardNominations": {
"edges": [
{
"node": {
"award": {
"text": "ShoWest Award",
"event": {
"text": "ShoWest Convention, USA"
},
"year": 1992
}
}
},
{
"node": {
"award": {
"text": "Most Performed Song from a Film",
"event": {
"text": "BMI Film & TV Awards"
},
"year": 1989
}
}
},
{
"node": {
"award": {
"text": "TV Prize",
"event": {
"text": "Aftonbladet TV Prize, Sweden"
},
"year": 1988
}
}
}
]
}
},
{
"nameText": {
"text": "Morgan Freeman"
},
"awardNominations": {
"edges": [
{
"node": {
"award": {
"text": "ALFS Award",
"event": {
"text": "London Critics Circle Film Awards"
},
"year": 1997
}
}
},
{
"node": {
"award": {
"text": "LAFCA Award",
"event": {
"text": "Los Angeles Film Critics Association Awards"
},
"year": 1987
}
}
},
{
"node": {
"award": {
"text": "KCFCC Award",
"event": {
"text": "Kansas City Film Critics Circle Awards"
},
"year": 1989
}
}
}
]
}
}
]
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
1. Get the opening weekend gross internationally
for WALL·E
Request:
{
# Get WALL·E
title(id: "tt0910970") {
# Get the international opening weekend gross for WALL·E
openingWeekendGross(boxOfficeArea: INTERNATIONAL) {
gross {
total {
amount
currency
}
}
# Get the date of the opening weekend end date
weekendEndDate
}
}
}
Response:
{
"data": {
"title": {
"openingWeekendGross": {
"gross": {
"total": {
"amount": 3159079,
"currency": "USD"
}
},
"weekendEndDate": "2008-06-29"
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
2. Get the international lifetime gross for Fight Club
Request:
{
# Get Fight Club
title(id: "tt0137523") {
# Get the lifetime gross for Fight Club in North America
lifetimeGross(boxOfficeArea: INTERNATIONAL) {
total {
amount
currency
}
}
}
}
Response:
{
"data": {
"title": {
"lifetimeGross": {
"total": {
"amount": 64179600,
"currency": "USD"
}
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
3. Get the production budget for Fight Club
Request:
{
# Get Fight Club
title(id: "tt0137523") {
# Get the production budget for Fight Club
productionBudget {
budget {
amount
currency
}
}
}
}
Response:
{
"data": {
"title": {
"lifetimeGross": {
"total": {
"amount": 64179600,
"currency": "USD"
}
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
1. Get the top 5 movie titles that most closely
match the search term Goodfellas.
Request:
{
# Get the top 5 movie titles that most closely match the search term Goodfellas.
mainSearch(
first: 5
options: {
searchTerm: "Goodfellas"
isExactMatch: false
type: TITLE
titleSearchOptions: { type: MOVIE }
}
) {
edges {
node {
entity {
# For returned Titles, get me the id and title text
... on Title {
id
titleText {
text
}
}
}
}
}
}
}
Response:
{
"data": {
"mainSearch": {
"edges": [
{
"node": {
"entity": {
"id": "tt0099685",
"titleText": {
"text": "Goodfellas"
}
}
}
},
{
"node": {
"entity": {
"id": "tt0035948",
"titleText": {
"text": "The Good Fellows"
}
}
}
},
{
"node": {
"entity": {
"id": "tt3732610",
"titleText": {
"text": "Hoodfella All In"
}
}
}
},
{
"node": {
"entity": {
"id": "tt0117494",
"titleText": {
"text": "Robin Goodfellow"
}
}
}
},
{
"node": {
"entity": {
"id": "tt7254624",
"titleText": {
"text": "Hoodfellaz Redux"
}
}
}
}
]
}
}
}
2. Get the top 10 name recommendations that match
the search term Jennifer.
Request:
{
# Get the top 10 name recommendations that match the search term Jennifer.
mainSearch(
first: 5
options: {
searchTerm: "Jennifer"
type: NAME,
includeAdult:false,
}
) {
edges {
node {
entity {
# For returned Names, get me the id and name text
... on Name {
id
nameText {
text
}
}
}
}
}
}
}
Response:
{
"data": {
"mainSearch": {
"edges": [
{
"node": {
"entity": {
"id": "nm0000098",
"nameText": {
"text": "Jennifer Aniston"
}
}
}
},
{
"node": {
"entity": {
"id": "nm0000492",
"nameText": {
"text": "Jennifer Jason Leigh"
}
}
}
},
{
"node": {
"entity": {
"id": "nm0000124",
"nameText": {
"text": "Jennifer Connelly"
}
}
}
},
{
"node": {
"entity": {
"id": "nm0004950",
"nameText": {
"text": "Jennifer Garner"
}
}
}
},
{
"node": {
"entity": {
"id": "nm0001349",
"nameText": {
"text": "Jennifer Love Hewitt"
}
}
}
}
]
}
}
}
The IMDb API allows you to specify parameters on certain field for pagination
and to control which results you receive. There are up to 6 different
parameters depending on the return type of the field.
Pagination is used to traverse the relationship between sets
of objects, more information on pagination is available on the GraphQL documentation. The
IMDb API uses cursor-based pagination based on the Relay implementation.
Cursors are available on the edge field,
which can be used for pagination in follow up queries. The cursor is dependent
on the edge’s position in the list, and may change if items are added/removed.
For queries that return a list, either the first or the last
parameter is required. These return the first (or last) n items respectively, and are mutually exclusive.
· Returns the first n
items after an optional cursor value. If no cursor value is specified it
returns the first n items in the list.
This is often useful if the client needs only a subset of
the dataset.
Request:
{
title(id: "tt0099685") {
credits(first: 3) {
edges {
node {
title {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"node": {
"title": {
"id": "tt0099685"
}
}
},
{
"node": {
"title": {
"id": "tt0099685"
}
}
},
{
"node": {
"title": {
"id": "tt0099685"
}
}
}
]
}
}
}
}
· Returns the last n items before
an optional cursor value. If no cursor value is specified it returns the last n items in the list.
This is useful if the client needs to reverse the page order
or return the last items in a sorted list.
Request:
{
title(id: "tt0099685") {
credits(last: 3) {
edges {
node {
title {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"node": {
"title": {
"id": "tt0099685"
}
}
},
{
"node": {
"title": {
"id": "tt0099685"
}
}
},
{
"node": {
"title": {
"id": "tt0099685"
}
}
}
]
}
}
}
}
· Used in conjunction with first
· Returns the last N results after an edge given
its cursor
Request:
{
title(id: "tt0099685") {
credits(first: 3) {
edges {
cursor
node {
name {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"cursor": "bm0wMDAwMTM0L3R0MDA5OTY4NS9hY3Rvcg==",
"node": {
"name": {
"id": "nm0000134"
}
}
},
{
"cursor": "bm0wMDAwNTAxL3R0MDA5OTY4NS9hY3Rvcg==",
"node": {
"name": {
"id": "nm0000501"
}
}
},
{
"cursor": "bm0wMDAwNTgyL3R0MDA5OTY4NS9hY3Rvcg==",
"node": {
"name": {
"id": "nm0000582"
}
}
}
]
}
}
}
}
If you want to get the first 3 results after bm0wMDAwNTAxL3R0MDA5OTY4NS9hY3Rvcg==, you can make
another query which uses this cursor field
as an argument for after:
{
title(id: "tt0099685") {
credits(first: 3, after: "bm0wMDAwNTAxL3R0MDA5OTY4NS9hY3Rvcg==") {
edges {
cursor
node {
title {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"cursor": "bm0wMDAwNTgyL3R0MDA5OTY4NS9hY3Rvcg==",
"node": {
"name": {
"id": "nm0000582"
}
}
},
{
"cursor": "bm0wMDAwOTY2L3R0MDA5OTY4NS9hY3RyZXNz",
"node": {
"name": {
"id": "nm0000966"
}
}
},
{
"cursor": "bm0wMDAwNjQ5L3R0MDA5OTY4NS9hY3Rvcg==",
"node": {
"name": {
"id": "nm0000649"
}
}
}
]
}
}
}
}
From this we can see that the 3rd node in the original query
with name id nm0000582 is now the first node in
this query since we specified for nodes after the
edge with the cursor bm0wMDAwNTAxL3R0MDA5OTY4NS9hY3Rvcg==.
This can be useful when the client needs to request the first
3 credits, and then make a follow up query later on to request the next 3
credits.
The below example is for when the client needs the first
three movies that Brad Pitt
is known for after the edge that has
a cursor ID "Mw==". This
pagination is useful for when you’ve already got the first N nodes and you want
more data, so you take the cursor of the last edge you have and get the other
edges onward from the edge you already have:
{ # Get Brad Pitt
name(id: "nm0000093") {
# Get the first 3 Movies that Brad Pitt is known for after the node with cursor "Mw=="
knownFor (first: 3, after: "Mw=="){
edges {
cursor
node {
title {
# Get the title text for a title that Brad Pitt is known for
titleText {
text
}
}
}
}
}
}
}
Response:
{
"data": {
"name": {
"knownFor": {
"edges": [
{
"cursor": "NA==",
"node": {
"title": {
"titleText": {
"text": "12 Monkeys"
}
}
}
},
{
"cursor": "NQ==",
"node": {
"title": {
"titleText": {
"text": "Inglourious Basterds"
}
}
}
},
{
"cursor": "Ng==",
"node": {
"title": {
"titleText": {
"text": "The Curious Case of Benjamin Button"
}
}
}
}
]
}
}
},
"extensions": {
"disclaimer": "Any use of IMDb Content accessed through this API is subject to any applicable license agreement between you and IMDb."
}
}
· Used in conjunction with last
· Returns the last N results before an edge given
its cursor
Request:
{
title(id: "tt0099685") {
credits(last: 3) {
edges {
cursor
node {
name {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"cursor": "bm0wMTcyMjc2L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm0172276"
}
}
},
{
"cursor": "bm0xMDE0NjUwL3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm1014650"
}
}
},
{
"cursor": "bm0wNjIyNDU1L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm0622455"
}
}
}
]
}
}
}
}
If you want to get the last 3 results before the node with
name id nm1014650 , you can make another query
which uses the cursor field of the edge as the parameter for before:
{
title(id: "tt0099685") {
credits(last: 3, before: "bm0xMDE0NjUwL3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz") {
edges {
cursor
node {
name {
id
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"credits": {
"edges": [
{
"cursor": "bm0wOTI2MDg1L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm0926085"
}
}
},
{
"cursor": "bm0wMTQ4ODQ0L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm0148844"
}
}
},
{
"cursor": "bm0wMTcyMjc2L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz",
"node": {
"name": {
"id": "nm0172276"
}
}
}
]
}
}
}
}
This has returned the last 3 items before bm0xMDE0NjUwL3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz which
includes bm0wMTQ4ODQ0L3R0MDA5OTY4NS9taXNjZWxsYW5lb3Vz from
the previous query.
· Requires first or
last
· Returns the first/last N results after/before
and including the id of the node specified
in jumpTo
· Based on the id of
the node rather than the cursor of the edge
For example, if you wanted to get the first 3 certificates
after and including the certificate with id ce0503172:
{
title(id: "tt0099685") {
certificates(first: 3, jumpTo: "ce0503172") {
edges {
node {
id
}
}
}
}
}
Response:
{
"data": {
"title": {
"certificates": {
"edges": [
{
"node": {
"id": "ce0503172"
}
},
{
"node": {
"id": "ce0056684"
}
},
{
"node": {
"id": "ce3212892"
}
}
]
}
}
}
}
This can be useful in pagination when you need to query
results after a specific nodes id instead of the
cursor of the edge which requires a
previous query.
· Filter results for a given field according the
corresponding filter input. This may be an inclusion-based filter (e.g. credits
for "directors", "producers" and "writers") or an
exclusion-based filter (e.g. exclude spoilers)
Request:
{
title(id: "tt0110357") {
id
credits(first: 2, filter: {categories: ["cast"]}) {
edges {
node {
name {
id
}
attributes {
text
}
}
}
}
}
}
Response:
{
"data": {
"title": {
"id": "tt0110357",
"credits": {
"edges": [
{
"node": {
"name": {
"id": "nm0000100"
},
"attributes": [
{
"text": "voice"
}
]
}
},
{
"node": {
"name": {
"id": "nm0000111"
},
"attributes": [
{
"text": "voice"
}
]
}
}
]
}
}
}
}