Location

There is a total of 126 locations sorted by id.

Location schema

KeyTypeDescription
idintThe id of the location.
namestringThe name of the location.
typestringThe type of the location.
dimensionstringThe dimension in which the location is located.
residentsarray (urls)List of character who have been last seen in the location.
urlstring (url)Link to the location’s own endpoint.
createdstringTime at which the location was created in the database.

Get all locations

You can access the list of locations by using the /location endpoint.

GET https://therickandmortyapi.vercel.app/api/location
{
  "info": {
    "count": 126,
    "pages": 7,
    "next": "https://therickandmortyapi.vercel.app/api/location?page=2",
    "prev": null
  },
  "results": [
    {
      "id": 1,
      "name": "Earth (C-137)",
      "type": "Planet",
      "dimension": "Dimension C-137",
      "residents": [
        "https://therickandmortyapi.vercel.app/api/character/38",
        "https://therickandmortyapi.vercel.app/api/character/45"
        // ...
      ],
      "url": "https://therickandmortyapi.vercel.app/api/location/1",
      "created": "2017-11-10T07:42:04.162Z"
    }
    // ...
  ]
}

Get a single location

You can get a single location by adding the id as a parameter: /location/77

GET https://therickandmortyapi.vercel.app/api/location/77
{
  "id": 77,
  "name": "Earth (Fascist Dimension)",
  "type": "Planet",
  "dimension": "Fascist Dimension",
  "residents": [
    "https://therickandmortyapi.vercel.app/api/character/242",
    "https://therickandmortyapi.vercel.app/api/character/498"
    // ...
  ],
  "url": "https://therickandmortyapi.vercel.app/api/location/77",
  "created": "2020-05-02T04:39:49.158Z"
}

Get multiple locations

You can get multiple locations by adding an array of ids as parameter: /location/1,2,3

GET https://therickandmortyapi.vercel.app/api/location/53,22
[
  {
    "id": 22,
    "name": "Signus 5 Expanse",
    "type": "unknown",
    "dimension": "Cromulon Dimension",
    "residents": [
      "https://therickandmortyapi.vercel.app/api/character/24",
      "https://therickandmortyapi.vercel.app/api/character/309"
    ],
    "url": "https://therickandmortyapi.vercel.app/api/location/22",
    "created": "2017-11-18T15:27:26.218Z"
  },
  {
    "id": 53,
    "name": "Mr. Meeseeks Box",
    "type": "Box",
    "dimension": "unknown",
    "residents": [],
    "url": "https://therickandmortyapi.vercel.app/api/location/53",
    "created": "2017-12-30T12:52:12.217Z"
  }
]

Filter locations

Available parameters:

  • name: filter by the given name.
  • type: filter by the given type.
  • dimension: filter by the given dimension.

If you want to know how to use queries, check the Query Filters Guide.