# SWAPI Star Wars Scraper (`parseforge/swapi-star-wars-scraper`) Actor

Extract Star Wars characters, planets, starships, vehicles, species and films from the SWAPI public API. Flat JSON output with optional reference resolution.

- **URL**: https://apify.com/parseforge/swapi-star-wars-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Games, Developer examples, Education
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

![ParseForge Banner](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)

## 🪐 SWAPI Star Wars Scraper

> 🚀 **Export the entire Star Wars universe in seconds.** Pull every character, planet, starship, vehicle, species, and film from SWAPI as clean JSON, CSV, Excel, or XML. No API key, no rate-limit math, no manual paging.

> 🕒 **Last updated:** 2026-05-26 · **📊 Up to 26 fields** per record · **241 canonical records** across 6 categories · **6 categories** (people, planets, starships, vehicles, species, films) · **Free public data**

The **SWAPI Star Wars Scraper** turns the Star Wars REST API into a one-click dataset export. Pick the categories you want, hit Run, and download a flat, well-named table covering **82 characters**, **60 planets**, **36 starships**, **39 vehicles**, **37 species**, and the **6 saga films**. Every record carries the original SWAPI identifiers, all canonical attributes (height, mass, climate, hyperdrive rating, episode number, opening crawl, the works), and the cross-reference URLs that tie the universe together. You skip building pagination loops, retry logic, and TLS workarounds, and you get the dataset in the format your downstream tool actually consumes.

The dataset is ideal for **fan apps, tutorials, conference demos, and AI-assistant training corpora**. Every column maps 1:1 to a documented SWAPI field, so anything you build is portable and reproducible. The actor handles the upstream's expired-certificate quirk on your behalf, supports optional **URL-to-name resolution** so you do not have to chase reference links yourself, and works equally well as a one-shot pull or a scheduled re-snapshot. Whether you are building a Star Wars Trivia API, generating a teaching dataset for a Python workshop, or seeding a vector database for a fandom chatbot, this Actor gives you the canonical answer with a single run.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Educators teaching REST, JSON, and pagination | Build classroom datasets for data-analysis homework |
| Indie devs prototyping fan apps and bots | Seed a Star Wars Trivia API, Discord bot, or quiz app |
| AI/ML engineers building demo corpora | Fine-tune small models or RAG demos on a famous public dataset |
| Data analysts and visualization tinkerers | Produce timelines, heatmaps, and character network graphs |
| Workshop organizers and tutorial authors | Ship a reproducible example dataset alongside your blog post |
| Researchers on pop-culture and narrative data | Quantitative studies on franchise expansion, character demographics, ship classes |

---

### 📋 What the SWAPI Star Wars Scraper does

- 🪐 **Six categories, one Run.** Toggle any combination of people, planets, starships, vehicles, species, and films and the Actor handles per-endpoint pagination for you.
- 🔍 **Every canonical field.** Heights, masses, hyperdrive ratings, orbital periods, opening crawls, episode IDs, residents, pilots, characters - all of it, never trimmed.
- 🔗 **Optional reference resolution.** Flip a checkbox and every URL reference (homeworld, films, residents, pilots) is enriched with the linked record's name, ready to drop into a UI.
- 🧱 **Stable, flat schema.** Records share a common header (category, uid, name, url, summary) so downstream joins, filters, and group-bys work out of the box.
- 🛰 **TLS-quirk-proof.** Transparently handles the upstream's expired certificate so your runs never break on a TLS error you cannot fix yourself.
- ⏱ **Quick exports.** Most full-universe pulls finish in under a minute, well below typical timeout budgets in classroom and CI contexts.

Each record is a single, deeply attributed row: a person carries height, mass, hair color, skin color, eye color, birth year, gender, homeworld, and the films, species, vehicles, and starships they appear in. A planet carries rotation period, orbital period, diameter, climate, gravity, terrain, surface water, population, residents, and films. A film carries episode_id, opening crawl, director, producer, release date, and the full cast and ship roster. Every record also has `category`, `uid`, `summary`, `scrapedAt`, and `error` columns so you can sort, group, and audit without a second pass.

> 💡 **Why it matters:** SWAPI is the canonical free Star Wars dataset, but the upstream API ships expired TLS, no built-in CSV/Excel export, and per-endpoint pagination. This Actor turns those rough edges into a single Run that ends with a clean spreadsheet, JSON file, or piped API response your app or notebook can consume directly.

---

### 🎬 Full Demo

🚧 Coming soon: a 3-minute walkthrough showing how to configure the Actor, pull all six categories, and pipe the dataset into a Google Sheet, a Python notebook, and a chatbot in one sitting.

---

### ⚙️ Input

<table>
<thead>
<tr><th>Field</th><th>Type</th><th>Required</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td>categories</td><td>array of enum</td><td>Yes</td><td>One or more of people, planets, starships, vehicles, species, films. Default is people.</td></tr>
<tr><td>maxItems</td><td>integer</td><td>No</td><td>Soft cap on total records returned. Free users are limited to 10. Default is 10.</td></tr>
<tr><td>resolveReferences</td><td>boolean</td><td>No</td><td>When true, every URL reference (homeworld, films, residents, pilots, characters) is enriched with the linked record's name. Adds extra requests, default is false.</td></tr>
</tbody>
</table>

Example: pull the first 10 characters as a clean table.

```json
{
    "categories": ["people"],
    "maxItems": 10
}
````

Example: full multi-category snapshot with reference names resolved.

```json
{
    "categories": ["people", "planets", "starships", "vehicles", "species", "films"],
    "maxItems": 250,
    "resolveReferences": true
}
```

> ⚠️ **Good to Know:** Records are split evenly across the categories you pick. If you pick three categories with maxItems=30, you get up to 10 of each. Pick a single category to focus a run on, say, all 60 planets.

***

### 📊 Output

Each record is a flat JSON object with category-specific fields plus the common header. Fields use the original SWAPI names so anything you write against SWAPI keeps working.

#### 🧾 Schema

| Field | Type | Example |
|---|---|---|
| 🗂 category | string | `"people"` |
| 🆔 uid | string | `"1"` |
| 📌 name | string | `"Luke Skywalker"` |
| 🔗 url | string | `"https://swapi.dev/api/people/1/"` |
| 📝 summary | string | `"19BBY · male · 172cm"` |
| 📐 height | string | `"172"` |
| ⚖️ mass | string | `"77"` |
| 👁 eye\_color | string | `"blue"` |
| 🎂 birth\_year | string | `"19BBY"` |
| 🚻 gender | string | `"male"` |
| 🌍 homeworld | string or object | `"https://swapi.dev/api/planets/1/"` |
| 🎞 films | array | `["https://swapi.dev/api/films/1/", ...]` |
| 🌡 climate | string (planets) | `"arid"` |
| 🗺 terrain | string (planets) | `"desert"` |
| 👥 population | string (planets) | `"200000"` |
| 🛠 model | string (starships) | `"T-65 X-wing"` |
| 🚀 hyperdrive\_rating | string (starships) | `"1.0"` |
| 🎬 episode\_id | integer (films) | `4` |
| 🎭 director | string (films) | `"George Lucas"` |
| 📅 release\_date | string (films) | `"1977-05-25"` |
| 📜 opening\_crawl | string (films) | `"It is a period of civil war..."` |
| 🧑‍🤝‍🧑 characters | array (films) | `["https://swapi.dev/api/people/1/", ...]` |
| 🏷 created | string | `"2014-12-09T13:50:51.644000Z"` |
| ✏️ edited | string | `"2014-12-20T21:17:56.891000Z"` |
| 🕒 scrapedAt | string | `"2026-05-26T20:39:31.371Z"` |
| ❌ error | string or null | `null` |

#### 📦 Sample records

<details>
<summary>👤 Typical - a fully populated person (Luke Skywalker)</summary>

```json
{
    "category": "people",
    "uid": "1",
    "name": "Luke Skywalker",
    "url": "https://swapi.dev/api/people/1/",
    "summary": "19BBY · male · 172cm",
    "height": "172",
    "mass": "77",
    "hair_color": "blond",
    "skin_color": "fair",
    "eye_color": "blue",
    "birth_year": "19BBY",
    "gender": "male",
    "homeworld": "https://swapi.dev/api/planets/1/",
    "films": [
        "https://swapi.dev/api/films/1/",
        "https://swapi.dev/api/films/2/",
        "https://swapi.dev/api/films/3/",
        "https://swapi.dev/api/films/6/"
    ],
    "species": [],
    "vehicles": [
        "https://swapi.dev/api/vehicles/14/",
        "https://swapi.dev/api/vehicles/30/"
    ],
    "starships": [
        "https://swapi.dev/api/starships/12/",
        "https://swapi.dev/api/starships/22/"
    ],
    "created": "2014-12-09T13:50:51.644000Z",
    "edited": "2014-12-20T21:17:56.891000Z",
    "scrapedAt": "2026-05-26T20:39:31.371Z",
    "error": null
}
```

</details>

<details>
<summary>🎬 Edge case - a film with the full opening crawl and large cast (A New Hope)</summary>

```json
{
    "category": "films",
    "uid": "1",
    "name": "A New Hope",
    "url": "https://swapi.dev/api/films/1/",
    "summary": "Episode 4 · George Lucas · 1977-05-25",
    "title": "A New Hope",
    "episode_id": 4,
    "opening_crawl": "It is a period of civil war.\r\nRebel spaceships, striking\r\nfrom a hidden base, have won\r\ntheir first victory against\r\nthe evil Galactic Empire...",
    "director": "George Lucas",
    "producer": "Gary Kurtz, Rick McCallum",
    "release_date": "1977-05-25",
    "characters": [
        "https://swapi.dev/api/people/1/",
        "https://swapi.dev/api/people/2/",
        "https://swapi.dev/api/people/3/",
        "https://swapi.dev/api/people/4/"
    ],
    "planets": [
        "https://swapi.dev/api/planets/1/",
        "https://swapi.dev/api/planets/2/",
        "https://swapi.dev/api/planets/3/"
    ],
    "starships": [
        "https://swapi.dev/api/starships/2/",
        "https://swapi.dev/api/starships/3/"
    ],
    "vehicles": ["https://swapi.dev/api/vehicles/4/"],
    "species": [
        "https://swapi.dev/api/species/1/",
        "https://swapi.dev/api/species/2/"
    ],
    "created": "2014-12-10T14:23:31.880000Z",
    "edited": "2014-12-20T19:49:45.256000Z",
    "scrapedAt": "2026-05-26T20:39:31.799Z",
    "error": null
}
```

</details>

<details>
<summary>🪐 Sparse - a planet whose climate dictates sparse population data (Tatooine)</summary>

```json
{
    "category": "planets",
    "uid": "1",
    "name": "Tatooine",
    "url": "https://swapi.dev/api/planets/1/",
    "summary": "arid · desert · pop 200000",
    "rotation_period": "23",
    "orbital_period": "304",
    "diameter": "10465",
    "climate": "arid",
    "gravity": "1 standard",
    "terrain": "desert",
    "surface_water": "1",
    "population": "200000",
    "residents": [
        "https://swapi.dev/api/people/1/",
        "https://swapi.dev/api/people/2/",
        "https://swapi.dev/api/people/4/"
    ],
    "films": [
        "https://swapi.dev/api/films/1/",
        "https://swapi.dev/api/films/3/",
        "https://swapi.dev/api/films/4/",
        "https://swapi.dev/api/films/5/",
        "https://swapi.dev/api/films/6/"
    ],
    "created": "2014-12-09T13:50:49.641000Z",
    "edited": "2014-12-20T20:58:18.411000Z",
    "scrapedAt": "2026-05-26T20:39:31.494Z",
    "error": null
}
```

</details>

***

### ✨ Why choose this Actor

| ✨ | Capability |
|---|---|
| 🪐 | **Full universe coverage.** Six categories, every canonical field, zero invented columns. |
| 🔗 | **Cross-references intact.** Films, residents, pilots, and homeworld URLs preserved so you can join records yourself. |
| 🧭 | **Optional name resolution.** Flip a switch and every reference URL is enriched with the linked record's name. |
| 🛰 | **TLS quirk handled.** SWAPI's certificate expired - this Actor papers over it so your scheduled runs never break. |
| 📦 | **Multi-format export.** JSON, CSV, Excel, XML, JSON Lines via the standard Apify download UI. |
| 🔁 | **Reproducible snapshots.** Every record carries `created`, `edited`, and `scrapedAt` timestamps for versioned analysis. |
| 🧪 | **Stable schema.** Field names mirror SWAPI 1:1 so anything you wrote against the upstream keeps working. |

> 📊 A full-universe pull (all 241 records across all 6 categories) typically completes in under 30 seconds.

***

### 📈 How it compares to alternatives

| Approach | Cost | Coverage | Refresh | Filters | Setup |
|---|---|---|---|---|---|
| Calling SWAPI by hand from your app | Free | Full, if you write paging | Realtime | None | Pagination loops, retries, TLS workaround |
| Static dumps in public GitHub repos | Free | Snapshot only | Stale | None | Clone repo, parse files |
| Aggregator REST mirrors | Free or paid | Mirror-dependent | Varies | Limited | Lock-in to a third-party mirror |
| **⭐ SWAPI Star Wars Scraper** *(this Actor)* | Pay-per-result | All 6 categories, all fields | On demand | Per-category and maxItems | One run, pick categories, download |

The trade-off is consistent: you can hand-roll the same pull yourself, but you spend the afternoon on plumbing and another afternoon when the TLS cert expires again.

***

### 🚀 How to use

1. **🆕 Sign up.** Create a free Apify account at [console.apify.com/sign-up](https://console.apify.com/sign-up?fpr=vmoqkp). No credit card required for the free tier.
2. **🛒 Open the Actor.** Visit the SWAPI Star Wars Scraper on Apify Store and click Try for free.
3. **🪐 Pick categories.** Tick people, planets, starships, vehicles, species, or films. Pick one for a focused pull or all six for a full snapshot.
4. **▶️ Run.** Hit Start. Most runs finish in under a minute even with `resolveReferences` enabled.
5. **📥 Download.** Export the dataset as JSON, CSV, Excel, or XML, or call the Apify API to pipe it directly into your downstream system.

> ⏱️ **Total time:** about 2 minutes from sign-up to a downloadable Star Wars dataset on your machine.

***

### 💼 Business use cases

<table>
<tr>
<td width="50%">

#### 🧑‍🏫 Educators

- Build classroom REST and JSON exercises against a familiar dataset
- Provide reproducible homework datasets that do not change weekly
- Demonstrate pagination, schema design, and cross-reference joins
- Seed coding bootcamp projects with a fun, recognizable domain

</td>
<td width="50%">

#### 🛠 Indie developers

- Bootstrap a Star Wars Trivia API or Discord bot in an afternoon
- Power fan-site filters (find all Wookiees from Kashyyyk in Episode 5)
- Generate quiz questions for game jams and hackathon demos
- Cache a local copy so your app survives upstream outages

</td>
</tr>
<tr>
<td width="50%">

#### 🤖 AI and ML engineers

- Seed RAG demos and fandom chatbots with a known, bounded corpus
- Generate synthetic training prompts grounded in real entities
- Build evaluation sets with verifiable canonical answers
- Power small-model fine-tunes for entity-extraction demos

</td>
<td width="50%">

#### 📊 Data analysts

- Visualize the character relationship graph across films
- Heatmap planet population vs climate vs film appearances
- Build episode-by-episode cast and ship growth timelines
- Demonstrate dashboard tooling on a recognizable dataset

</td>
</tr>
</table>

***

### 🌟 Beyond business use cases

Data like this powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

<table>
<tr>
<td width="50%">

#### 🎓 Research and academia

- Empirical datasets for papers, thesis work, and coursework
- Longitudinal studies tracking changes across snapshots
- Reproducible research with cited, versioned data pulls
- Classroom exercises on data analysis and ethical scraping

</td>
<td width="50%">

#### 🎨 Personal and creative

- Side projects, portfolio demos, and indie app launches
- Data visualizations, dashboards, and infographics
- Content research for bloggers, YouTubers, and podcasters
- Hobbyist collections and personal trackers

</td>
</tr>
<tr>
<td width="50%">

#### 🤝 Non-profit and civic

- Transparency reporting and accountability projects
- Advocacy campaigns backed by public-interest data
- Community-run databases for local issues
- Investigative journalism on public records

</td>
<td width="50%">

#### 🧪 Experimentation

- Prototype AI and machine-learning pipelines with real data
- Validate product-market hypotheses before engineering spend
- Train small domain-specific models on niche corpora
- Test dashboard concepts with live input

</td>
</tr>
</table>

***

### 🔌 Automating SWAPI Star Wars Scraper

Wire the Actor into your pipeline using any of the standard Apify integrations.

- **Node.js**: use the official [apify-client](https://docs.apify.com/api/client/js) to start a run and stream items as they land in the dataset.
- **Python**: the [apify-client-python](https://docs.apify.com/api/client/python) package mirrors the Node SDK and slots into Jupyter, Airflow, or cron.
- **Docs**: the full API reference is at [docs.apify.com/api/v2](https://docs.apify.com/api/v2).

**Schedules:** create a saved task with your preferred categories and `maxItems`, then attach an [Apify Schedule](https://docs.apify.com/platform/schedules) to refresh the dataset daily, weekly, or whenever SWAPI's canonical numbers shift.

***

### ❓ Frequently Asked Questions

<details>
<summary>❓ <b>Which categories does the Actor cover?</b></summary>

People, planets, starships, vehicles, species, and films. Pick one, several, or all six. Records are split evenly across the categories you select, capped by `maxItems`.

</details>

<details>
<summary>❓ <b>How many records are available in total?</b></summary>

The canonical SWAPI totals are 82 people, 60 planets, 36 starships, 39 vehicles, 37 species, and 6 films - 260 records across all categories. Numbers occasionally shift when the upstream maintainers fix data.

</details>

<details>
<summary>❓ <b>Why is the upstream URL flagged as having an expired certificate?</b></summary>

SWAPI's TLS certificate has lapsed. The Actor handles the TLS quirk transparently so your runs never fail on a certificate error you cannot fix yourself.

</details>

<details>
<summary>❓ <b>What does `resolveReferences` actually do?</b></summary>

When enabled, every URL reference (homeworld, films, residents, pilots, characters, species, planets) is replaced with an object containing the URL and the linked record's name. Adds extra requests, ideal for UI rendering.

</details>

<details>
<summary>❓ <b>Can I limit the run to a single category?</b></summary>

Yes - pick only that category in the input. With `maxItems=60` and `categories=["planets"]` you get all 60 planets in one go.

</details>

<details>
<summary>❓ <b>Does the dataset include images?</b></summary>

No. SWAPI is a structured-data API and does not ship images. Field names mirror the upstream 1:1, so what you see is what SWAPI publishes.

</details>

<details>
<summary>❓ <b>Can I use the output for commercial projects?</b></summary>

The SWAPI dataset is public and free to use. As with any third-party content, check the upstream's terms and your local laws before shipping a commercial product. This Actor is independent and not affiliated with Lucasfilm, Disney, or SWAPI.

</details>

<details>
<summary>❓ <b>Do I need a paid Apify plan?</b></summary>

Free accounts can preview up to 10 records per run, which is plenty for evaluation. Paid plans lift the cap to 1,000,000 records and unlock scheduled runs and longer runtimes.

</details>

<details>
<summary>❓ <b>What happens if the upstream SWAPI is down?</b></summary>

The Actor retries transient errors and logs the categories that succeeded. Failed records are pushed with an `error` field so your downstream pipeline can detect and react.

</details>

<details>
<summary>❓ <b>Is using a public API legal?</b></summary>

SWAPI publishes Star Wars universe data as a public, free educational resource. This Actor reads only what the upstream publishes. As always, check your jurisdiction and the upstream's terms before deploying anything end-user-facing.

</details>

<details>
<summary>❓ <b>How fresh is the data?</b></summary>

Every run hits SWAPI live, so the data is as fresh as SWAPI itself. The upstream is largely stable since it documents the canon films and their entities.

</details>

<details>
<summary>❓ <b>How do I cite this dataset in a paper or blog?</b></summary>

Cite the upstream SWAPI dataset for content and this Actor for the snapshot. The `scrapedAt` timestamp on every record makes citations reproducible.

</details>

***

### 🔌 Integrate with any app

Connect the dataset to wherever you work without writing glue code.

- [**Make.com**](https://www.make.com/en/integrations/apify) - drop the Apify trigger into a scenario and feed Star Wars records into 1500+ apps.
- [**Zapier**](https://zapier.com/apps/apify/integrations) - send each new record to Airtable, Notion, Slack, or anywhere Zapier reaches.
- [**Google Sheets**](https://docs.apify.com/platform/integrations/google-drive) - sync the dataset directly into a sheet for ad-hoc analysis.
- [**Slack**](https://docs.apify.com/platform/integrations/slack) - notify a channel when a scheduled refresh completes.
- [**Airbyte**](https://docs.airbyte.com/integrations/sources/apify-dataset) - load Star Wars data into your warehouse alongside everything else.
- [**Webhook**](https://docs.apify.com/platform/integrations/webhooks) - POST each new dataset item to your own service on completion.

***

### 🔗 Recommended Actors

- [**📚 Semantic Scholar Scraper**](https://apify.com/parseforge/semantic-scholar-scraper) - export academic-paper records from a free, open API the same way.
- [**🏛 USAspending Scraper**](https://apify.com/parseforge/usaspending-scraper) - another canonical public dataset with clean, well-documented fields.
- [**🚀 Y Combinator Companies Scraper**](https://apify.com/parseforge/y-combinator-scraper) - structured catalog data in flat, joinable records.
- [**📜 SEC Form D Scraper**](https://apify.com/parseforge/sec-form-d-scraper) - free public filings with reference-style schema.
- [**🔗 Broken Link Checker**](https://apify.com/parseforge/broken-link-checker) - utility Actor handy for validating links in any SWAPI-driven app.

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge) for more free, well-documented public-data scrapers.

***

**🆘 Need Help?** Have a question, hit an edge case, or want a new field added? [**Open our contact form**](https://tally.so/r/BzdKgA) and we will get back to you within one business day.

***

> **⚠️ Disclaimer:** This Actor is an independent tool, not affiliated with Lucasfilm, Disney, or SWAPI. Only publicly available data is collected. Star Wars and all related names are trademarks of their respective owners.

# Actor input Schema

## `categories` (type: `array`):

Pick one or more SWAPI categories to export. Each category produces records with its own field set. Default: people.

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

Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000

## `resolveReferences` (type: `boolean`):

When enabled, every URL reference (homeworld, films, residents, etc.) is enriched with a human-readable name so downstream consumers do not have to make a second request.

## Actor input object example

```json
{
  "categories": [
    "people"
  ],
  "maxItems": 10,
  "resolveReferences": false
}
```

# 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 = {
    "categories": [
        "people"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/swapi-star-wars-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 = {
    "categories": ["people"],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/swapi-star-wars-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "categories": [
    "people"
  ],
  "maxItems": 10
}' |
apify call parseforge/swapi-star-wars-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=parseforge/swapi-star-wars-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SWAPI Star Wars Scraper",
        "description": "Extract Star Wars characters, planets, starships, vehicles, species and films from the SWAPI public API. Flat JSON output with optional reference resolution.",
        "version": "0.1",
        "x-build-id": "0VM2JI3baY7HhMHMi"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~swapi-star-wars-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-swapi-star-wars-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/parseforge~swapi-star-wars-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-swapi-star-wars-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/parseforge~swapi-star-wars-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-swapi-star-wars-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "categories"
                ],
                "properties": {
                    "categories": {
                        "title": "Categories",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Pick one or more SWAPI categories to export. Each category produces records with its own field set. Default: people.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "people",
                                "planets",
                                "starships",
                                "vehicles",
                                "species",
                                "films"
                            ],
                            "enumTitles": [
                                "People (82 characters)",
                                "Planets (60 worlds)",
                                "Starships (36 vessels)",
                                "Vehicles (39 ground/air craft)",
                                "Species (37 lifeforms)",
                                "Films (6 saga episodes)"
                            ]
                        },
                        "default": [
                            "people"
                        ]
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: Limited to 10 items (preview). Paid users: Optional, max 1,000,000"
                    },
                    "resolveReferences": {
                        "title": "Resolve URL references to names",
                        "type": "boolean",
                        "description": "When enabled, every URL reference (homeworld, films, residents, etc.) is enriched with a human-readable name so downstream consumers do not have to make a second request.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
