Skip to content

Get all episodes

To get a list of all episodes from Rick and Morty API, construct your query like this:

Terminal window
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query":"query GetAllEpisodes { episodes { results { id name air_date episode created } } }"}' \
https://rickandmortyapi.com/graphql

The results will be a JSON object containing a results array. You can see an example of this below:

results shape
{
"data": {
"episodes": {
"results": [
{
"id": "1",
"name": "Pilot",
"air_date": "December 2, 2013",
"episode": "S01E01",
"created": "2017-11-10T12:56:33.798Z"
},
{
"id": "2",
"name": "Lawnmower Dog",
"air_date": "December 9, 2013",
"episode": "S01E02",
"created": "2017-11-10T12:56:33.916Z"
},
{
"id": "3",
"name": "Anatomy Park",
"air_date": "December 16, 2013",
"episode": "S01E03",
"created": "2017-11-10T12:56:34.022Z"
},
{
"id": "4",
"name": "M. Night Shaym-Aliens!",
"air_date": "January 13, 2014",
"episode": "S01E04",
"created": "2017-11-10T12:56:34.129Z"
},
{
"id": "5",
"name": "Meeseeks and Destroy",
"air_date": "January 20, 2014",
"episode": "S01E05",
"created": "2017-11-10T12:56:34.236Z"
},
{
"id": "6",
"name": "Rick Potion #9",
"air_date": "January 27, 2014",
"episode": "S01E06",
"created": "2017-11-10T12:56:34.339Z"
},
{
"id": "7",
"name": "Raising Gazorpazorp",
"air_date": "March 10, 2014",
"episode": "S01E07",
"created": "2017-11-10T12:56:34.441Z"
},
{
"id": "8",
"name": "Rixty Minutes",
"air_date": "March 17, 2014",
"episode": "S01E08",
"created": "2017-11-10T12:56:34.543Z"
},
{
"id": "9",
"name": "Something Ricked This Way Comes",
"air_date": "March 24, 2014",
"episode": "S01E09",
"created": "2017-11-10T12:56:34.645Z"
},
{
"id": "10",
"name": "Close Rick-counters of the Rick Kind",
"air_date": "April 7, 2014",
"episode": "S01E10",
"created": "2017-11-10T12:56:34.747Z"
},
{
"id": "11",
"name": "Ricksy Business",
"air_date": "April 14, 2014",
"episode": "S01E11",
"created": "2017-11-10T12:56:34.850Z"
},
{
"id": "12",
"name": "A Rickle in Time",
"air_date": "July 26, 2015",
"episode": "S02E01",
"created": "2017-11-10T12:56:34.953Z"
},
{
"id": "13",
"name": "Mortynight Run",
"air_date": "August 2, 2015",
"episode": "S02E02",
"created": "2017-11-10T12:56:35.055Z"
},
{
"id": "14",
"name": "Auto Erotic Assimilation",
"air_date": "August 9, 2015",
"episode": "S02E03",
"created": "2017-11-10T12:56:35.158Z"
},
{
"id": "15",
"name": "Total Rickall",
"air_date": "August 16, 2015",
"episode": "S02E04",
"created": "2017-11-10T12:56:35.261Z"
},
{
"id": "16",
"name": "Get Schwifty",
"air_date": "August 23, 2015",
"episode": "S02E05",
"created": "2017-11-10T12:56:35.364Z"
},
{
"id": "17",
"name": "The Ricks Must Be Crazy",
"air_date": "August 30, 2015",
"episode": "S02E06",
"created": "2017-11-10T12:56:35.467Z"
},
{
"id": "18",
"name": "Big Trouble in Little Sanchez",
"air_date": "September 13, 2015",
"episode": "S02E07",
"created": "2017-11-10T12:56:35.569Z"
},
{
"id": "19",
"name": "Interdimensional Cable 2: Tempting Fate",
"air_date": "September 20, 2015",
"episode": "S02E08",
"created": "2017-11-10T12:56:35.669Z"
},
{
"id": "20",
"name": "Look Who's Purging Now",
"air_date": "September 27, 2015",
"episode": "S02E09",
"created": "2017-11-10T12:56:35.772Z"
}
]
}
}
}

Customise the result

You can customise the resulting Json array by passing the following parameters:

  1. name

    Filter by the given name of the episode.

  2. episode

    Filter by the given episode code.

For example, to get only the episode named “Ricksy Business” you can use customise the name parameter like this:

Terminal window
curl 'https://rickandmortyapi.com/graphql/' \
-X POST \
-H 'Content-Type: application/json' \
-d '{"query":"query GetAllEpisodes { episodes(filter:{name: \"Ricksy Business\" }) { results { id name air_date episode created } }}"}'

Further reading

Read more on different ways you can use the Rick and Morty API at official docs and at the GraphQL playground.