How to hit the Rick and Morty API

The Rick and Morty API at https://rickandmortyapi.com/api covers every character, location, and episode. It's paginated, filterable, and also available as GraphQL.

Authentication

None — no key, no signup. Every example runs as-is.

Full reference: https://rickandmortyapi.com/documentation

Get a character

By id; pass several as /character/1,2,3.

curl https://rickandmortyapi.com/api/character/1
Run in PostTaco
Example response (trimmed)
{
  "id": 1,
  "name": "Rick Sanchez",
  "status": "Alive",
  "species": "Human",
  "type": "",
  "gender": "Male",
  "origin": {
    "name": "Earth (C-137)",
    "url": "https://rickandmortyapi.com/api/location/1"
  },
  "location": {
    "name": "Citadel of Ricks",
    "url": "https://rickandmortyapi.com/api/location/3"
  },
  "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",
  "episode": [
    "https://rickandmortyapi.com/api/episode/1",
    "https://rickandmortyapi.com/api/episode/2"
  ],
  "url": "https://rickandmortyapi.com/api/character/1",
  "created": "2017-11-04T18:48:46.250Z"
}

Filter characters

Filter by name, status, species, gender.

curl "https://rickandmortyapi.com/api/character/?name=rick&status=alive"
Run in PostTaco
Example response (trimmed)
{
  "info": {
    "count": 29,
    "pages": 2,
    "next": "https://rickandmortyapi.com/api/character/?page=2&name=rick&status=alive",
    "prev": null
  },
  "results": [
    {
      "id": 1,
      "name": "Rick Sanchez",
      "status": "Alive",
      "species": "Human",
      "type": "",
      "gender": "Male",
      "origin": {
        "name": "Earth (C-137)",
        "url": "https://rickandmortyapi.com/api/location/1"
      },
      "location": {
        "name": "Citadel of Ricks",
        "url": "https://rickandmortyapi.com/api/location/3"
      },
      "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",
      "episode": [
        "https://rickandmortyapi.com/api/episode/1",
        "https://rickandmortyapi.com/api/episode/2"
      ],
      "url": "https://rickandmortyapi.com/api/character/1",
      "created": "2017-11-04T18:48:46.250Z"
    },
    {
      "id": 48,
      "name": "Black Rick",
      "status": "Alive",
      "species": "Human",
      "type": "",
      "gender": "Male",
      "origin": {
        "name": "unknown",
        "url": ""
      },
      "location": {
        "name": "Citadel of Ricks",
        "url": "https://rickandmortyapi.com/api/location/3"
      },
      "image": "https://rickandmortyapi.com/api/character/avatar/48.jpeg",
      "episode": [
        "https://rickandmortyapi.com/api/episode/22",
        "https://rickandmortyapi.com/api/episode/28"
      ],
      "url": "https://rickandmortyapi.com/api/character/48",
      "created": "2017-11-05T11:15:26.044Z"
    }
  ]
}

Get an episode

Includes the URL of every character in it.

curl https://rickandmortyapi.com/api/episode/1
Run in PostTaco
Example response (trimmed)
{
  "id": 1,
  "name": "Pilot",
  "air_date": "December 2, 2013",
  "episode": "S01E01",
  "characters": [
    "https://rickandmortyapi.com/api/character/1",
    "https://rickandmortyapi.com/api/character/2"
  ],
  "url": "https://rickandmortyapi.com/api/episode/1",
  "created": "2017-11-10T12:56:33.798Z"
}

Query with GraphQL

Ask for just the fields you want.

curl -X POST https://rickandmortyapi.com/graphql \
  -H "Content-Type: application/json" \
  -d '{"query": "{ characters(filter: {name: \"morty\"}) { info { count } results { name status } } }"}'
Run in PostTaco
Example response (trimmed)
{
  "data": {
    "characters": {
      "info": {
        "count": 68
      },
      "results": [
        {
          "name": "Morty Smith",
          "status": "Alive"
        },
        {
          "name": "Alien Morty",
          "status": "unknown"
        }
      ]
    }
  }
}