# Rick and Morty Scraper (`ninhothedev/rick-and-morty-scraper`) Actor

$0.5/1K 🔥 Fast Rick and Morty scraper! Characters, locations & episodes — status, species, origin, images & more. JSON, CSV, Excel or API in seconds. Search & pull the full multiverse for apps, datasets & demos ⚡

- **URL**: https://apify.com/ninhothedev/rick-and-morty-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Rick and Morty Scraper 🛸

Scrape **characters, locations and episodes** from the entire *Rick and Morty*
universe into clean, structured JSON. Built on the free
[Rick and Morty API](https://rickandmortyapi.com/) — **no API key, no login,
no proxy required**. Filter by name, paginate automatically and export to JSON,
CSV, Excel or feed straight into your app.

> Perfect for fan apps, ready-made datasets, portfolio demos and coding
> tutorials.

***

### ✨ What it does

Pick a **mode** and a **search query**, and the actor returns every matching
entity across all result pages:

| Mode | Filters by | Returns |
|------|------------|---------|
| `characters` | name | status, species, gender, origin, current location, image, episode count |
| `locations` | name | dimension, location type, resident count |
| `episodes` | name | air date, episode code (e.g. `S01E01`), character count |

Pagination follows the API's `info.next` link automatically, so you always get
the full result set up to your `maxItems` limit.

***

### 🚀 Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | select | `characters` | `characters`, `locations` or `episodes` |
| `query` | string | `rick` | Name filter for the selected mode |
| `maxItems` | integer | `100` (max `1000`) | Cap on total items scraped |

Example input:

```json
{
  "mode": "characters",
  "query": "rick",
  "maxItems": 100
}
```

***

### 📦 Output

Every record is flat and analytics-ready. Example character:

```json
{
  "type": "character",
  "id": 1,
  "name": "Rick Sanchez",
  "status": "Alive",
  "species": "Human",
  "gender": "Male",
  "origin": "Earth (C-137)",
  "location": "Citadel of Ricks",
  "image": "https://rickandmortyapi.com/api/character/avatar/1.jpeg",
  "episode_count": 51,
  "url": "https://rickandmortyapi.com/api/character/1",
  "scraped_at": "2026-07-03T00:00:00+00:00"
}
```

Example location:

```json
{
  "type": "location",
  "id": 1,
  "name": "Earth (C-137)",
  "dimension": "Dimension C-137",
  "location_type": "Planet",
  "residents_count": 27,
  "url": "https://rickandmortyapi.com/api/location/1",
  "scraped_at": "2026-07-03T00:00:00+00:00"
}
```

Example episode:

```json
{
  "type": "episode",
  "id": 1,
  "name": "Pilot",
  "air_date": "December 2, 2013",
  "episode_code": "S01E01",
  "characters_count": 19,
  "url": "https://rickandmortyapi.com/api/episode/1",
  "scraped_at": "2026-07-03T00:00:00+00:00"
}
```

Export in one click as **JSON, CSV, Excel, XML or HTML** from the Apify UI or
API.

***

### 💡 Use cases

- **Fan apps** — power a character explorer, trivia game or wiki bot.
- **Datasets** — grab a clean, ready-to-analyze *Rick and Morty* dataset for
  data-science and ML practice.
- **Demos** — a fast, reliable actor to showcase in tutorials or portfolios.
- **Education** — teach APIs, pagination and data cleaning with a fun dataset.

***

### 💰 Pricing

This actor is lightweight and runs on the free public API, so it's cheap to
run: roughly **$0.50 per 1,000 items** (input **and** output combined),
depending on your Apify plan and compute settings. A typical full-character run
costs just a few cents.

***

### 🆚 Why this actor?

- **No API key or account** — works out of the box.
- **No proxy needed** — datacenter IPs work fine, keeping runs cheap.
- **Three entity types** in one actor (characters, locations, episodes).
- **Clean, flattened output** — nested names and array counts pre-computed.
- **Automatic pagination** and safe `maxItems` capping.

Compared to writing your own script, you get retries, a hosted schedule,
one-click exports and structured storage for free.

***

### 🔗 Related actors

- [Pokémon Scraper](https://apify.com/ninhothedev/pokemon-scraper)
- [TVmaze TV Scraper](https://apify.com/ninhothedev/tvmaze-tv-scraper)
- [Anime Scraper](https://apify.com/ninhothedev/anime-scraper)
- [Deezer Music Scraper](https://apify.com/ninhothedev/deezer-music-scraper)

***

### 🛟 Support

Found a bug or want another field? Open an issue on the actor page and we'll
respond quickly. Feature requests welcome.

***

**Keywords:** rick and morty scraper, rick and morty api, character scraper,
episode scraper, location scraper, tv show data, fan app dataset, json api
scraper, apify actor, pop culture dataset

# Actor input Schema

## `mode` (type: `string`):

What to scrape from the Rick and Morty API: characters, locations or episodes. Each mode filters by name using the query field.

## `query` (type: `string`):

Name filter applied to the selected mode (e.g. 'rick' for characters, 'earth' for locations, 'pilot' for episodes). Leave empty to fetch everything for the mode.

## `maxItems` (type: `integer`):

Maximum number of items to scrape across all result pages. Pagination follows the API's info.next link automatically.

## Actor input object example

```json
{
  "mode": "characters",
  "query": "rick",
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "rick"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/rick-and-morty-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "rick" }

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/rick-and-morty-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "rick"
}' |
apify call ninhothedev/rick-and-morty-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ninhothedev/rick-and-morty-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/3Dj3a3J38herk8qqk/builds/hblW5A0FdwZ2sftd8/openapi.json
