# Decidim Participation Extractor (`datamule/decidim-participation-extractor`) Actor

Point at ANY Decidim instance and extract participatory-democracy data over its public GraphQL API. Modes: participatory processes, assemblies, proposals, results, meetings. One flat row per object, translated-text fallback, Relay pagination.

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

## Pricing

from $0.35 / 1,000 records

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

## Decidim Participation Extractor

Point at **any [Decidim](https://decidim.org) instance** and extract its
participatory‑democracy data over the public, read‑only **GraphQL API**. Decidim
is the open‑source platform behind **~400 government deployments** — Barcelona,
Helsinki, the Catalan government, the European Commission, dozens of French
métropoles and more. Every instance speaks the **same GraphQL contract**, so this
one actor reads them all: give it an instance root, pick a **mode**, get back
clean structured rows.

### What you get

One flat JSON row per participatory object. Five modes:

| Mode | What it returns | Level |
|------|-----------------|-------|
| `participatoryProcesses` | Participatory processes (budgets, plans, consultations) | Space |
| `assemblies` | Assemblies / councils | Space |
| `proposals` | Citizen proposals (with state + vote count) | Component |
| `results` | Accountability results (with progress %) | Component |
| `meetings` | Meetings (with times + address) | Component |

Space modes emit one row per space. Component modes discover **every** matching
component across all participatory processes and paginate each one, emitting one
row per leaf object.

### Input

```json
{
  "decidimUrl": "https://www.decidim.barcelona",
  "mode": "participatoryProcesses",
  "locale": "en",
  "maxRecords": 2000
}
```

| Field | Type | Default | Notes |
|-------|------|---------|-------|
| `decidimUrl` | string (required) | – | Instance root or full `/api` URL. |
| `mode` | enum | `participatoryProcesses` | One of the five modes above. |
| `withComponents` | boolean | `false` | Space modes: expand each space's component list into the row. |
| `locale` | string | `en` | Preferred locale for translated text (see below). |
| `maxRecords` | integer | `2000` | Stop after this many rows. |
| `pageSize` | integer | `50` | Relay page size for component modes (Decidim caps ~100). |

### Key behaviours (things the Decidim API decides)

- **Translated text with fallback.** `title` / `subtitle` / `body` are *translated
  objects*, not strings. On a Catalan or Finnish instance `en` is often `null`, so
  the actor falls back to the first available translation and tells you which
  locale it used in `titleLocale`. Rows are keyed on the always‑present `id`.
- **Components are reached through inline fragments.** `proposals` / `results` /
  `meetings` are components of a participatory process, not root fields — the actor
  discovers them and walks each component's Relay cursor connection.
- **Not every host is Decidim.** The actor first probes `{ decidim { version } }`;
  a host that is unreachable, Cloudflare‑gated (403 / HTML), or a different platform
  (e.g. CONSUL) **fails fast** and never emits a fabricated empty result.

### Output (example — a proposal)

```json
{
  "decidimUrl": "https://www.decidim.barcelona",
  "mode": "proposals",
  "id": "3",
  "reference": "BCN-PROP-2016-01-3",
  "state": "acceptada",
  "voteCount": 30,
  "title": "Sensibilitzar sobre la diversitat funcional",
  "titleLocale": "ca",
  "createdAt": "2016-01-22T13:06:40+01:00",
  "processId": "1",
  "processSlug": "pam",
  "componentId": "1"
}
```

### Pricing

Pay‑per‑event: you are billed **per record** (one participatory process, proposal,
result, assembly, or meeting emitted).

### Use cases

Civic‑transparency dashboards · participatory‑budgeting analytics · policy
research · govtech monitoring · journalism on public participation · comparative
studies across the ~400‑instance Decidim ecosystem.

# Actor input Schema

## `decidimUrl` (type: `string`):

Root URL of ANY Decidim participatory-democracy instance (the open-source platform behind ~400 city / regional / EU government deployments). Its public GraphQL API is read at <root>/api. Examples: https://www.decidim.barcelona · https://meta.decidim.org · https://omastadi.hel.fi. You may pass the root or the full /api URL — both work.

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

Which participatory object to extract. 'participatoryProcesses' and 'assemblies' are top-level participatory spaces (one row per space). 'proposals', 'results' and 'meetings' are COMPONENTS that hang off each participatory process — the actor discovers every matching component and paginates all of them (one flat row per leaf object).

## `withComponents` (type: `boolean`):

Only for 'participatoryProcesses' / 'assemblies': expand each space's components list (id, type, name) into the row as a JSON string + a count. Ignored for component modes.

## `locale` (type: `string`):

Preferred locale for translatable text (title / subtitle / body). Decidim stores these as translated objects; if the requested locale is missing on an instance (many Catalan / Finnish instances have no 'en'), the actor falls back to the first available translation and reports which locale it used in 'titleLocale'.

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

Stop after emitting this many rows. For component modes, pagination across components halts once reached. Each emitted object is billed as one record.

## `pageSize` (type: `integer`):

Objects requested per Relay page when paginating a component collection (the GraphQL 'first' argument). Space lists are un-paginated and ignore this. Decidim caps this near 100.

## `userAgent` (type: `string`):

Override the default descriptive User-Agent header. Many Decidim instances are public-sector / civic deployments — please keep a descriptive agent.

## `timeoutSecs` (type: `integer`):

Per-request timeout in seconds for each GraphQL POST.

## Actor input object example

```json
{
  "decidimUrl": "https://www.decidim.barcelona",
  "mode": "participatoryProcesses",
  "withComponents": false,
  "locale": "en",
  "maxRecords": 2000,
  "pageSize": 50,
  "timeoutSecs": 60
}
```

# 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 = {
    "decidimUrl": "https://www.decidim.barcelona",
    "locale": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/decidim-participation-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 = {
    "decidimUrl": "https://www.decidim.barcelona",
    "locale": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/decidim-participation-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 '{
  "decidimUrl": "https://www.decidim.barcelona",
  "locale": "en"
}' |
apify call datamule/decidim-participation-extractor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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