### REST API Request for Characters (First Page) Source: https://rickandmortyapi.com/documentation Example GET request to retrieve the first page of character data from the REST API. Responses include pagination information. ```http GET https://rickandmortyapi.com/api/character ``` -------------------------------- ### GET /episode Source: https://rickandmortyapi.com/documentation Retrieve a list of all episodes. ```APIDOC ## GET /episode ### Description Access the list of all episodes in the series. ### Method GET ### Endpoint https://rickandmortyapi.com/api/episode ### Response #### Success Response (200) - **info** (object) - Pagination information. - **results** (array) - List of episode objects. ``` -------------------------------- ### REST API Request for Character Data (Page 19) Source: https://rickandmortyapi.com/documentation Example GET request to fetch character data specifically from page 19 of the API. The `page` parameter controls pagination. ```http GET https://rickandmortyapi.com/api/character/?page=19 ``` -------------------------------- ### Get all characters Source: https://rickandmortyapi.com/documentation Retrieve a paginated list of all characters. ```http GET https://rickandmortyapi.com/api/character ``` ```json { "info": { "count": 826, "pages": 42, "next": "https://rickandmortyapi.com/api/character/?page=2", "prev": null }, "results": [ { "id": 1, "name": "Rick Sanchez", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "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" }, // ... ] } ``` -------------------------------- ### Get All Episodes Source: https://rickandmortyapi.com/documentation Access the list of all episodes. Use pagination parameters to retrieve specific pages. ```HTTP GET https://rickandmortyapi.com/api/episode ``` ```JSON { "info": { "count": 51, "pages": 3, "next": "https://rickandmortyapi.com/api/episode?page=2", "prev": null }, "results": [ { "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" }, // ... ] } ``` -------------------------------- ### Example JSON response for multiple episodes Source: https://rickandmortyapi.com/documentation The API returns an array of episode objects when multiple IDs are requested. ```json [ { "id": 10, "name": "Close Rick-counters of the Rick Kind", "air_date": "April 7, 2014", "episode": "S01E10", "characters": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2", // ... ], "url": "https://rickandmortyapi.com/api/episode/10", "created": "2017-11-10T12:56:34.747Z" }, { "id": 28, "name": "The Ricklantis Mixup", "air_date": "September 10, 2017", "episode": "S03E07", "characters": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2", // ... ], "url": "https://rickandmortyapi.com/api/episode/28", "created": "2017-11-10T12:56:36.618Z" } ] ``` -------------------------------- ### GET /api Source: https://rickandmortyapi.com/documentation Retrieve the base URL information for all available API resources. ```APIDOC ## GET /api ### Description Returns the base URLs for the available resources: characters, locations, and episodes. ### Method GET ### Endpoint https://rickandmortyapi.com/api ### Response #### Success Response (200) - **characters** (string) - URL to the character resource - **locations** (string) - URL to the location resource - **episodes** (string) - URL to the episode resource #### Response Example { "characters": "https://rickandmortyapi.com/api/character", "locations": "https://rickandmortyapi.com/api/location", "episodes": "https://rickandmortyapi.com/api/episode" } ``` -------------------------------- ### Get All Characters Source: https://rickandmortyapi.com/documentation Retrieves a list of all characters available in the API. Supports pagination. ```APIDOC ## GET /api/character ### Description Fetches a list of all characters. The response includes pagination information. ### Method GET ### Endpoint https://rickandmortyapi.com/api/character ### Response #### Success Response (200) - **info** (object) - Pagination details (count, pages, next, prev). - **results** (array) - An array of character objects. ### Response Example ```json { "info": { "count": 826, "pages": 42, "next": "https://rickandmortyapi.com/api/character/?page=2", "prev": null }, "results": [ { "id": 1, "name": "Rick Sanchez", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "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" } ] } ``` ``` -------------------------------- ### GET /episode/:id Source: https://rickandmortyapi.com/documentation Retrieve a single episode by its ID. ```APIDOC ## GET /episode/:id ### Description Get details for a specific episode by its ID. ### Method GET ### Endpoint https://rickandmortyapi.com/api/episode/:id ### Parameters #### Path Parameters - **id** (int) - Required - The ID of the episode. ``` -------------------------------- ### GET /api/character Source: https://rickandmortyapi.com/documentation Retrieve a paginated list of characters. ```APIDOC ## GET /api/character ### Description Returns a list of characters. The response is paginated with 20 items per page. ### Method GET ### Endpoint https://rickandmortyapi.com/api/character ### Parameters #### Query Parameters - **page** (int) - Optional - The page number to retrieve. ### Response #### Success Response (200) - **info** (object) - Pagination metadata (count, pages, next, prev) - **results** (array) - List of character objects #### Response Example { "info": { "count": 826, "pages": 42, "next": "https://rickandmortyapi.com/api/character/?page=2", "prev": null }, "results": [] } ``` -------------------------------- ### GraphQL Query for Characters, Location, and Episodes Source: https://rickandmortyapi.com/documentation Example GraphQL query to fetch character information filtered by name and page, details of a specific location, and a list of episodes by their IDs. Requires a GraphQL client. ```graphql query { characters(page: 2, filter: { name: "rick" }) { info { count } results { name } } location(id: 1) { id } episodesByIds(ids: [1, 2]) { id } } ``` -------------------------------- ### Get All Locations Source: https://rickandmortyapi.com/documentation Access the list of all locations. Use pagination parameters to retrieve specific pages. ```HTTP GET https://rickandmortyapi.com/api/location ``` ```JSON { "info": { "count": 126, "pages": 7, "next": "https://rickandmortyapi.com/api/location?page=2", "prev": null }, "results": [ { "id": 1, "name": "Earth", "type": "Planet", "dimension": "Dimension C-137", "residents": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2", // ... ], "url": "https://rickandmortyapi.com/api/location/1", "created": "2017-11-10T12:42:04.162Z" } // ... ] } ``` -------------------------------- ### Retrieve multiple episodes via HTTP GET Source: https://rickandmortyapi.com/documentation Use a comma-separated list of IDs in the URL path to fetch multiple episode resources simultaneously. ```http GET https://rickandmortyapi.com/api/episode/10,28 ``` -------------------------------- ### Detailed Character Data Example Source: https://rickandmortyapi.com/documentation A sample JSON object representing a single character, including details like ID, name, status, species, origin, location, image URL, and associated episodes. ```json { "info": { "count": 826, "pages": 42, "next": "https://rickandmortyapi.com/api/character/?page=20", "prev": "https://rickandmortyapi.com/api/character/?page=18" }, "results": [ { "id": 361, "name": "Toxic Rick", "status": "Dead", "species": "Humanoid", "type": "Rick's Toxic Side", "gender": "Male", "origin": { "name": "Alien Spa", "url": "https://rickandmortyapi.com/api/location/64" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "image": "https://rickandmortyapi.com/api/character/avatar/361.jpeg", "episode": [ "https://rickandmortyapi.com/api/episode/27" ], "url": "https://rickandmortyapi.com/api/character/361", "created": "2018-01-10T18:20:41.703Z" }, // ... ] } ``` -------------------------------- ### GET /location Source: https://rickandmortyapi.com/documentation Retrieve a list of all locations or filter them by name, type, or dimension. ```APIDOC ## GET /location ### Description Access the list of all locations or filter them using query parameters. ### Method GET ### Endpoint https://rickandmortyapi.com/api/location ### Parameters #### Query Parameters - **name** (string) - Optional - Filter by location name. - **type** (string) - Optional - Filter by location type. - **dimension** (string) - Optional - Filter by location dimension. ### Response #### Success Response (200) - **info** (object) - Pagination information. - **results** (array) - List of location objects. ``` -------------------------------- ### Get Multiple Episodes Source: https://rickandmortyapi.com/documentation Retrieve multiple episodes by providing a comma-separated list of episode IDs in the URL. ```APIDOC ## GET /api/episode/[ids] ### Description Fetches a list of episodes based on the provided IDs. ### Method GET ### Endpoint /api/episode/[1,2,3] or /api/episode/1,2,3 ### Query Parameters - **ids** (string) - Required - A comma-separated string of episode IDs (e.g., "10,28"). ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the episode. - **name** (string) - The name of the episode. - **air_date** (string) - The air date of the episode. - **episode** (string) - The episode code (e.g., "S01E10"). - **characters** (array of strings) - A list of URLs to the characters featured in the episode. - **url** (string) - The URL of the episode resource. - **created** (string) - The date the episode was created in the API. #### Response Example ```json [ { "id": 10, "name": "Close Rick-counters of the Rick Kind", "air_date": "April 7, 2014", "episode": "S01E10", "characters": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2" ], "url": "https://rickandmortyapi.com/api/episode/10", "created": "2017-11-10T12:56:34.747Z" }, { "id": 28, "name": "The Ricklantis Mixup", "air_date": "September 10, 2017", "episode": "S03E07", "characters": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2" ], "url": "https://rickandmortyapi.com/api/episode/28", "created": "2017-11-10T12:56:36.618Z" } ] ``` ``` -------------------------------- ### Get a single character Source: https://rickandmortyapi.com/documentation Retrieve details for a specific character by providing their ID. ```http GET https://rickandmortyapi.com/api/character/2 ``` ```json { "id": 2, "name": "Morty Smith", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "image": "https://rickandmortyapi.com/api/character/avatar/2.jpeg", "episode": [ "https://rickandmortyapi.com/api/episode/1", "https://rickandmortyapi.com/api/episode/2", // ... ], "url": "https://rickandmortyapi.com/api/character/2", "created": "2017-11-04T18:50:21.651Z" } ``` -------------------------------- ### Get Single Character Source: https://rickandmortyapi.com/documentation Retrieves a specific character by their unique ID. ```APIDOC ## GET /api/character/{id} ### Description Fetches a single character's details using their ID. ### Method GET ### Endpoint https://rickandmortyapi.com/api/character/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the character. ### Response #### Success Response (200) - **id** (integer) - The character's unique ID. - **name** (string) - The name of the character. - **status** (string) - The status of the character (Alive, Dead, Unknown). - **species** (string) - The species of the character. - **type** (string) - The type of the character. - **gender** (string) - The gender of the character. - **origin** (object) - Information about the character's origin. - **location** (object) - Information about the character's current location. - **image** (string) - URL of the character's image. - **episode** (array) - List of episodes the character appeared in. - **url** (string) - URL to the character's endpoint. - **created** (string) - Date the character was created. ### Response Example ```json { "id": 2, "name": "Morty Smith", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "image": "https://rickandmortyapi.com/api/character/avatar/2.jpeg", "episode": [ "https://rickandmortyapi.com/api/episode/1", "https://rickandmortyapi.com/api/episode/2" ], "url": "https://rickandmortyapi.com/api/character/2", "created": "2017-11-04T18:50:21.651Z" } ``` ``` -------------------------------- ### Get multiple characters Source: https://rickandmortyapi.com/documentation Retrieve multiple characters by providing a comma-separated list of IDs. ```http GET https://rickandmortyapi.com/api/character/1,183 ``` ```json [ { "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": "Earth (Replacement Dimension)", "url": "https://rickandmortyapi.com/api/location/20" }, "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": 183, "name": "Johnny Depp", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth (C-500A)", "url": "https://rickandmortyapi.com/api/location/23" }, "location": { "name": "Earth (C-500A)", "url": "https://rickandmortyapi.com/api/location/23" }, "image": "https://rickandmortyapi.com/api/character/avatar/183.jpeg", "episode": [ "https://rickandmortyapi.com/api/episode/8" ], "url": "https://rickandmortyapi.com/api/character/183", "created": "2017-12-29T18:51:29.693Z" } ] ``` -------------------------------- ### GET /location/:id Source: https://rickandmortyapi.com/documentation Retrieve a single location or multiple locations by their IDs. ```APIDOC ## GET /location/:id ### Description Get details for a specific location by ID, or multiple locations by providing a comma-separated list of IDs. ### Method GET ### Endpoint https://rickandmortyapi.com/api/location/:id ### Parameters #### Path Parameters - **id** (int/string) - Required - The ID or comma-separated IDs of the location(s). ``` -------------------------------- ### Get Multiple Locations by IDs Source: https://rickandmortyapi.com/documentation Fetch multiple locations by specifying a comma-separated list of IDs in the URL path. ```HTTP GET https://rickandmortyapi.com/api/location/3,21 ``` ```JSON [ { "id": 3, "name": "Citadel of Ricks", "type": "Space station", "dimension": "unknown", "residents": [ "https://rickandmortyapi.com/api/character/8", "https://rickandmortyapi.com/api/character/14", // ... ], "url": "https://rickandmortyapi.com/api/location/3", "created": "2017-11-10T13:08:13.191Z" }, { "id": 21, "name": "Testicle Monster Dimension", "type": "Dimension", "dimension": "Testicle Monster Dimension", "residents": [ "https://rickandmortyapi.com/api/character/7", "https://rickandmortyapi.com/api/character/436" ], "url": "https://rickandmortyapi.com/api/location/21", "created": "2017-11-18T19:41:01.605Z" } ] ``` -------------------------------- ### Get Single Episode by ID Source: https://rickandmortyapi.com/documentation Retrieve a specific episode by providing its unique ID in the URL path. ```HTTP GET https://rickandmortyapi.com/api/episode/28 ``` ```JSON { "id": 28, "name": "The Ricklantis Mixup", "air_date": "September 10, 2017", "episode": "S03E07", "characters": [ "https://rickandmortyapi.com/api/character/1", "https://rickandmortyapi.com/api/character/2", // ... ], "url": "https://rickandmortyapi.com/api/episode/28", "created": "2017-11-10T12:56:36.618Z" } ``` -------------------------------- ### Get Multiple Characters by IDs Source: https://rickandmortyapi.com/documentation Retrieves multiple characters by providing a comma-separated list of their IDs. ```APIDOC ## GET /api/character/[id1,id2,...] ### Description Fetches multiple characters by specifying their IDs in the URL path. ### Method GET ### Endpoint https://rickandmortyapi.com/api/character/[id1,id2,...] ### Parameters #### Path Parameters - **ids** (array of integers) - Required - A comma-separated list of character IDs. ### Response #### Success Response (200) - Returns an array of character objects matching the provided IDs. ### Response Example ```json [ { "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": "Earth (Replacement Dimension)", "url": "https://rickandmortyapi.com/api/location/20" }, "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": 183, "name": "Johnny Depp", "status": "Alive", "species": "Human", "type": "", "gender": "Male", "origin": { "name": "Earth (C-500A)", "url": "https://rickandmortyapi.com/api/location/23" }, "location": { "name": "Earth (C-500A)", "url": "https://rickandmortyapi.com/api/location/23" }, "image": "https://rickandmortyapi.com/api/character/avatar/183.jpeg", "episode": [ "https://rickandmortyapi.com/api/episode/8" ], "url": "https://rickandmortyapi.com/api/character/183", "created": "2017-12-29T18:51:29.693Z" } ] ``` ``` -------------------------------- ### Get Single Location by ID Source: https://rickandmortyapi.com/documentation Retrieve a specific location by providing its unique ID in the URL path. ```HTTP GET https://rickandmortyapi.com/api/location/3 ``` ```JSON { "id": 3, "name": "Citadel of Ricks", "type": "Space station", "dimension": "unknown", "residents": [ "https://rickandmortyapi.api/character/8", "https://rickandmortyapi.com/api/character/14", // ... ], "url": "https://rickandmortyapi.com/api/location/3", "created": "2017-11-10T13:08:13.191Z" } ``` -------------------------------- ### REST API Base URL Source: https://rickandmortyapi.com/documentation The base URL for accessing all REST API resources. All requests are GET requests and responses are in JSON format. ```http GET https://rickandmortyapi.com/api ``` -------------------------------- ### REST API Resources Overview Source: https://rickandmortyapi.com/documentation JSON response detailing the available REST API resources: characters, locations, and episodes, with their respective endpoints. ```json { "characters": "https://rickandmortyapi.com/api/character", "locations": "https://rickandmortyapi.com/api/location", "episodes": "https://rickandmortyapi.com/api/episode" } ``` -------------------------------- ### Character Data Response with Pagination Info Source: https://rickandmortyapi.com/documentation JSON structure for a character resource response, including pagination details like count, pages, and links to next/previous pages. ```json { "info": { "count": 826, "pages": 42, "next": "https://rickandmortyapi.com/api/character/?page=2", "prev": null }, "results": [ // ... ] } ``` -------------------------------- ### Filter Episodes Source: https://rickandmortyapi.com/documentation Filter episodes based on their name or episode code. ```APIDOC ## GET /api/episode/ ### Description Filters episodes based on provided query parameters. ### Method GET ### Endpoint /api/episode/ ### Query Parameters - **name** (string) - Optional - Filters episodes by their name. - **episode** (string) - Optional - Filters episodes by their episode code (e.g., "S01E10"). ### Request Example ``` GET https://rickandmortyapi.com/api/episode/?name=Pilot&episode=S01E01 ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the episode. - **name** (string) - The name of the episode. - **air_date** (string) - The air date of the episode. - **episode** (string) - The episode code (e.g., "S01E10"). - **characters** (array of strings) - A list of URLs to the characters featured in the episode. - **url** (string) - The URL of the episode resource. - **created** (string) - The date the episode was created in the API. #### Response Example ```json { "info": { "count": 1, "pages": 1, "next": null, "prev": null }, "results": [ { "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" } ] } ``` ``` -------------------------------- ### Filter characters Source: https://rickandmortyapi.com/documentation Apply query parameters to filter character results by attributes like name or status. ```http GET https://rickandmortyapi.com/api/character/?name=rick&status=alive ``` ```json "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", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "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 Source: https://rickandmortyapi.com/documentation Retrieves characters based on specified filter criteria. ```APIDOC ## GET /api/character/?= ### Description Fetches characters with support for filtering by name, status, species, type, and gender using query parameters. ### Method GET ### Endpoint https://rickandmortyapi.com/api/character/ ### Parameters #### Query Parameters - **name** (string) - Optional - Filter by the given name. - **status** (string) - Optional - Filter by status (`alive`, `dead`, or `unknown`). - **species** (string) - Optional - Filter by the given species. - **type** (string) - Optional - Filter by the given type. - **gender** (string) - Optional - Filter by gender (`female`, `male`, `genderless`, or `unknown`). ### Request Example ``` GET https://rickandmortyapi.com/api/character/?name=rick&status=alive ``` ### Response #### Success Response (200) - **info** (object) - Pagination details. - **results** (array) - An array of character objects matching the filter criteria. ### Response Example ```json { "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", "url": "https://rickandmortyapi.com/api/location/1" }, "location": { "name": "Earth", "url": "https://rickandmortyapi.com/api/location/20" }, "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 Locations Source: https://rickandmortyapi.com/documentation Filter locations by name, type, or dimension using query parameters. ```HTTP GET https://rickandmortyapi.com/api/location?name=earth&type=planet ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.