# OpenActive Opportunity Extractor (`datamule/openactive-opportunity-extractor`) Actor

Point at ANY OpenActive dataset site, data catalog, or RPDE feed and harvest UK sports & activity opportunity data — classes, sessions, facility slots and events from 100s of leisure operators (GLL, Everyone Active, Halo...). Follows the RPDE cursor, handles tombstones. Pay per item.

- **URL**: https://apify.com/datamule/openactive-opportunity-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 83.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 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 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

## OpenActive Opportunity Extractor

Point at **any** OpenActive dataset site, data catalog, or **RPDE feed** and harvest UK **sports & physical-activity opportunity data** — classes, sessions, bookable facility slots, courses and events published by leisure operators (GLL/Better, Everyone Active, Halo, Active Leeds, Places Leisure and 100s more) under the open [OpenActive](https://www.openactive.io/) standard.

One actor spans the whole ecosystem — no per-operator scraper. It walks the standard OpenActive data graph and follows the **RPDE (Realtime Paged Data Exchange)** cursor to the end.

### What it does

- **feed mode** (default) — harvest the RPDE **opportunity items** from one or more feed URLs, following the `next` cursor until the feed is exhausted (the RPDE "empty last page points to itself" convention). Heterogeneous `kind` per item (FacilityUse, Slot, SessionSeries, ScheduledSession, Event) is normalized into a common envelope while the full raw `data` object is preserved. `state:"deleted"` tombstones are emitted as deletion rows.
- **catalog mode** — traverse the OpenActive data-catalog graph (master collection → sub-catalogs → operator **dataset sites** → their feed `contentUrl`s) and emit the **operator feed inventory**: one row per discovered feed (operator, dataset name, feed kind, feed URL). Start from the master catalog, a single sub-catalog, or one dataset-site URL.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `startUrl` | string | An RPDE feed URL, a dataset-site URL (feeds auto-resolved), several feed URLs (comma-separated), or a catalog URL. In catalog mode, leave empty to default to the master OpenActive data catalog. |
| `mode` | enum | `feed` (harvest items) or `catalog` (discover feeds). Default `feed`. |
| `feedKind` | array | Optional filter: `FacilityUse`, `SessionSeries`, `ScheduledSession`, `Slot`, `Event`. Empty = all. |
| `includeDeleted` | boolean | Emit `deleted` tombstones as deletion rows (default `true`). |
| `maxRecords` | integer | Max total rows to emit (default 5000). |
| `maxPages` | integer | Safety cap on RPDE pages per feed (default 50). |
| `extraHeaders` | object | Optional extra HTTP headers (feeds need no auth). |

#### Example — harvest a facility-use feed

```json
{
  "startUrl": "https://halo-openactive.legendonlineservices.co.uk/api/facility-uses",
  "mode": "feed",
  "maxRecords": 500
}
```

#### Example — discover every operator feed from the master catalog

```json
{
  "mode": "catalog",
  "maxRecords": 500
}
```

### Output

Each item is one row. In feed mode:

```json
{
  "_mode": "item",
  "kind": "FacilityUse",
  "state": "updated",
  "deleted": false,
  "name": "Badminton",
  "activity": ["Badminton"],
  "provider": "Halo Leisure",
  "startDate": null,
  "type": "FacilityUse",
  "data": { "... full OpenActive opportunity object ..." }
}
```

In catalog mode each row is a discovered feed (`operator`, `datasetName`, `feedKind`, `feedUrl`).

### How it works

- **RPDE cursor paging** — follows `next` until an empty page that points to itself; never stops on a short page or a naive page count.
- **Tombstones** — `deleted` items carry no `data`; emitted as deletions without dereferencing missing fields.
- **Catalog graph** — recurses `hasPart` (sub-catalogs) → `dataset` (operator site URLs) → embedded `application/ld+json` `Dataset.distribution[].contentUrl`.
- **Content types** — accepts `application/vnd.openactive.rpde+json`, `application/json`, and `application/ld+json`.

### Pricing

**Pay per result** — one `item` event per emitted opportunity/feed row. No subscription.

### Notes

- All OpenActive feeds are **open data** (typically CC-BY 4.0) — no authentication required.
- RPDE feeds are change logs; most pages contain `deleted` tombstones. Disable `includeDeleted` to keep only live opportunities.

# Actor input Schema

## `startUrl` (type: `string`):

In FEED mode: an OpenActive RPDE feed URL (e.g. https://halo-openactive.legendonlineservices.co.uk/api/facility-uses), a dataset-site URL (whose feeds are auto-resolved), or several feed URLs separated by commas. In CATALOG mode: the master data catalog (leave empty to default to https://openactive.io/data-catalogs/data-catalog-collection.jsonld), a single sub-catalog URL, or one dataset-site URL — traversal recurses from wherever you start.

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

feed = harvest the RPDE opportunity items (classes, sessions, facility slots, events), following the cursor to the end. catalog = traverse the OpenActive data-catalog graph (collection → sub-catalogs → operator dataset sites → their feeds) and emit the operator feed inventory (one row per discovered feed).

## `feedKind` (type: `array`):

Optional filter on which opportunity feed kind(s) to read when a dataset site exposes several. FacilityUse = bookable facilities; SessionSeries + ScheduledSession = recurring classes and their dated instances; Slot = bookable facility time-slots; Event = one-off events. Leave empty for all. In feed mode this filters which distributions of a dataset-site URL are harvested; in catalog mode it filters the emitted inventory.

## `includeDeleted` (type: `boolean`):

RPDE feeds are change logs, so most pages carry deleted tombstones (state=deleted, no data) alongside updated items. When enabled (default), tombstones are emitted as deletion rows (deleted=true) so you can mirror the feed's change stream. Disable to keep only live (updated) opportunities.

## `maxRecords` (type: `integer`):

Maximum total rows to emit across all pages/feeds. Each emitted row is one billable item. The actor follows the RPDE cursor and stops at this cap, the end of the feed, or the page limit — whichever comes first. Default 5000.

## `maxPages` (type: `integer`):

Safety cap on how many RPDE pages to fetch per feed before stopping (each page is typically tens–hundreds of items). RPDE feeds terminate naturally on the 'empty page pointing to itself' convention; this cap bounds very large feeds. Default 50.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers sent with every request, as a JSON object. OpenActive feeds are open data and require no auth; this is only for the rare rate-gated operator or a custom User-Agent. Leave empty for public feeds.

## Actor input object example

```json
{
  "startUrl": "https://halo-openactive.legendonlineservices.co.uk/api/facility-uses",
  "mode": "feed",
  "feedKind": [],
  "includeDeleted": true,
  "maxRecords": 5000,
  "maxPages": 50
}
```

# 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 = {
    "startUrl": "https://halo-openactive.legendonlineservices.co.uk/api/facility-uses",
    "feedKind": [],
    "maxRecords": 5000,
    "maxPages": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/openactive-opportunity-extractor").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 = {
    "startUrl": "https://halo-openactive.legendonlineservices.co.uk/api/facility-uses",
    "feedKind": [],
    "maxRecords": 5000,
    "maxPages": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/openactive-opportunity-extractor").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 '{
  "startUrl": "https://halo-openactive.legendonlineservices.co.uk/api/facility-uses",
  "feedKind": [],
  "maxRecords": 5000,
  "maxPages": 50
}' |
apify call datamule/openactive-opportunity-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/openactive-opportunity-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/wgsMRwcyAvfUdjabe/builds/POXHaq3OpkGZWos1e/openapi.json
