Skip to main content

decidim-cli

Command-line client for driving Decidim instances over the official GraphQL API.

The goal is the same role as polis-cli: an operator or AI agent can inspect an instance, authenticate as a machine user, run all supported API mutations, export raw participation data, and normalize it for deliberAIde synthesis.

decidim profile add barcelona https://www.decidim.barcelona --auth none
decidim version -p barcelona
decidim gql '{ decidim { version } }' -p barcelona --json

decidim profile add city https://participate.example.gov --auth api-credentials --api-key KEY
decidim login -p city
decidim proposal create 9 "Install Bike Lanes on Main Street" `
  "Dedicated bike lanes would improve cyclist safety and sustainable mobility." `
  -p city --locale en
decidim meeting create 670 "Mobility workshop" "Discuss the transport plan" `
  "2026-09-17T13:00:00Z" "2026-09-17T15:00:00Z" `
  -p city --type-of-meeting ONLINE --registration-type ON_THIS_PLATFORM

What "full CLI" means for Decidim

Decidim exposes:

  • Public read GraphQL at /api.
  • API-credential machine-user sign-in at /api/sign_in for mutations.
  • Official component mutations for proposals, meetings, and debates.
  • Per-instance GraphQL docs at /api/docs.
  • Open Data exports when the instance has generated them.

Stock Decidim still does not expose process/space/component creation through the public API. This repo now includes decidim-admin-api/, an installable Decidim engine that adds admin/operator GraphQL mutations over Decidim's own admin forms and command objects. Without that engine, the CLI still covers the official API surface and keeps decidim gql as an escape hatch for version-specific fields and modules.

Design rules

  1. Arm's length. This CLI contains no Decidim code. It only speaks HTTP/GraphQL to unmodified Decidim instances.
  2. Profile-based. Profiles live in ~/.decidim-cli/config.toml. Bearer tokens are cached in ~/.decidim-cli/credentials.toml.
  3. Machine-friendly. Every command supports global --json.
  4. Honest boundaries. High-level commands wrap the official mutations; raw GraphQL remains available for installed modules and instance-specific schema drift.

Main commands

decidim profile add NAME BASE_URL
decidim login
decidim logout
decidim session
decidim version
decidim gql QUERY_OR_@FILE
decidim schema

decidim open-data download --out open-data.zip
decidim open-data normalize open-data.zip --out contributions.jsonl

decidim proposal create|update|withdraw|vote|unvote|answer
decidim meeting create|update|withdraw|close
decidim debate create|update|close
decidim process create|update|publish|unpublish|phase-create|phase-update|phase-activate|component-create
decidim component create|update|publish|unpublish

Admin API module

To let the CLI create participatory processes, phases, and components, install the included Decidim engine in the target Decidim app:

# Gemfile in the Decidim app
gem "decidim-admin_api", path: "../decidim-cli/decidim-admin-api"

Then restart Decidim and authenticate the CLI as an admin API user. The module adds:

decidim process create my-process "Mobility Plan" -p city --locale en
decidim process phase-create PROCESS_ID "Ideation" 2026-09-01T00:00:00Z 2026-10-01T00:00:00Z -p city
decidim component create PROCESS_ID proposals "Ideas" -p city --space-type participatory_processes
decidim process publish PROCESS_ID -p city

Voca can still be useful one layer below this: its public material and voca-tasks show fast Decidim instance launch/configuration, DB setup, organization settings, and admin seeding. The missing part for our agent workflow is the admin content/provisioning API inside an instance, which is what decidim-admin-api supplies.

Auth

For public reads:

decidim profile add meta https://meta.decidim.org --auth none

For machine-user writes, create API credentials in Decidim's system panel, then:

decidim profile add city https://participate.example.gov --auth api-credentials --api-key KEY
$env:DECIDIM_API_SECRET = "SECRET"
decidim login -p city

For an already-issued bearer token:

$env:DECIDIM_BEARER = "eyJ..."
decidim login -p city

If the token came from an OAuth application, pass the audience/client id:

decidim profile add city https://participate.example.gov --auth bearer --jwt-aud CLIENT_ID

References

Install

pip install decidim-cli        # command: decidim

Part of the civic tech agent-bridges toolkit

decidim-cli is one bridge in the civic tech agent-bridges toolkit: open-source command-line clients that let any AI agent drive a civic-tech platform through its own API, so platforms interoperate without waiting for a standards process. Sibling bridges: polis-cli (Pol.is, Voxit), consul-cli (CONSUL DEMOCRACY), deliberaide-cli (deliberAIde).

Relationship to upstream

This is an independent client. It contains no Decidim source code and speaks only to the documented GraphQL API of a running instance. deliberAIde offers it to the Decidim community for adoption; the Apache-2.0 licence is chosen so the code can be vendored into the AGPL-3.0 Decidim repositories without friction, since permissive code can be combined into copyleft ones but not the other way round.

Licence

Two licences, because this repository holds two kinds of code:

Part Licence Why
src/decidim_cli/ (the CLI) Apache-2.0 Independent client; speaks GraphQL to a running installation and contains no Decidim source code
decidim-admin-api/ (the Rails engine) AGPL-3.0-or-later Loaded into and executed as part of the Decidim application, which is AGPL-3.0

See LICENSE, NOTICE and decidim-admin-api/LICENSE. Copyright 2026 deliberAIde.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decidim_cli-0.1.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decidim_cli-0.1.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file decidim_cli-0.1.0.tar.gz.

File metadata

  • Download URL: decidim_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for decidim_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a97c0664d6f6ffe8053d4fb321ce48dfe24d4c6464040baf2ac12cd86007e94f
MD5 c233b645f0c9392eb976457fcbaa210b
BLAKE2b-256 34db8010638bc180dfa2f5d7fba176b07b10c0b135780b6503427ff12cf029c9

See more details on using hashes here.

File details

Details for the file decidim_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: decidim_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for decidim_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edefd3e08055e18136c41000d56c9b47429eb411e0749845a5162688a5a923c1
MD5 db928d1573415d7d082aff7fd37d313e
BLAKE2b-256 9eb40863f1cd1f2c19b0788e4464c54413590df631001b186c54372acb151325

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page