Skip to main content

Control Mautic from the command line or any AI coding agent.

Project description

mautic-cli

Control Mautic from the command line or any AI coding agent.

License: MIT Python 3.11+ Mautic 4.x-7.x

Quick Start · Commands · Output Formats

mautic-cli screenshot

What it does

Category Capabilities
Contacts List, search, create, edit, delete, points, segments, campaigns, activity
Segments List, create, edit, delete, add/remove contacts
Emails List, create, edit, send to contact, send to segment
Campaigns List, create, edit, delete, clone (7+), add/remove contacts
Forms List, get, submissions, delete
Companies List, get, create, edit, delete, add/remove contacts
Notes List (per contact), get, create
Stages List, set contact stage
Assets List, get
Tags List, create
Categories List (with bundle filter), create
Pages List, get
Webhooks List, get, create, delete
Fields List, create
Reports List, get
Points List actions, list triggers
Auth Basic Auth, OAuth2 Client Credentials, multiple profiles
Output JSON, colored tables, CSV, NDJSON streaming

Quick Start

# 1. Install (or upgrade)
uv tool install mautic-cli             # or: pip install mautic-cli
uv tool install --upgrade mautic-cli   # upgrade to latest

# 2. Authenticate
mautic auth setup

# 3. Use it
mautic contacts list --limit 5
mautic --format table emails list

🤖 Using an AI agent? Add the skill and let your agent handle the rest:

npx skills add bloomidea/mautic-cli

"list my mautic contacts" / "send email 5 to contact 42" / "export all contacts to CSV"

Works with Claude Code, Cursor, Codex, Gemini, Windsurf, and 37+ agents.

Commands

Contacts

mautic contacts list --search "email:*@company.com" --limit 50
mautic contacts get 42
mautic contacts create --json '{"firstname":"Ana","email":"ana@example.com"}'
mautic contacts edit 42 --json '{"lastname":"Silva"}'
mautic contacts delete 42
mautic contacts add-points 42 10
mautic contacts add-to-segment 42 5
mautic contacts activity 42

Segments

mautic segments list
mautic segments get 1
mautic segments contacts 1
mautic segments create --json '{"name":"Newsletter Q1","isPublished":true}'

Emails

mautic emails list
mautic emails get 1
mautic emails send 1 --contact 42
mautic emails send-to-segment 1

Campaigns

mautic campaigns list
mautic campaigns get 1
mautic campaigns contacts 1
mautic campaigns clone 1    # Mautic 7+ only

Forms

mautic forms list
mautic forms get 1
mautic forms submissions 1
mautic forms delete 1

Companies

mautic companies list
mautic companies get 1
mautic companies create --json '{"companyname":"Acme Inc"}'
mautic companies edit 1 --json '{"companyname":"Updated"}'
mautic companies delete 1
mautic companies add-contact 1 42
mautic companies remove-contact 1 42

Notes

mautic notes list --contact 42
mautic notes get 1
mautic notes create --json '{"lead":42,"type":"general","text":"Called, no answer"}'

Stages & Points

mautic stages list
mautic stages set 42 1         # set contact 42 to stage 1
mautic points list
mautic points triggers list

Assets, Tags, Categories

mautic assets list
mautic assets get 1
mautic tags list
mautic tags create --json '{"tag":"vip"}'
mautic categories list --bundle email
mautic categories create --json '{"title":"Q1 2026","bundle":"email"}'

Pages, Webhooks, Fields, Reports

mautic pages list
mautic pages get 1
mautic webhooks list
mautic webhooks create --json '{"name":"New Lead","webhookUrl":"https://...","triggers":["mautic.lead_post_save_new"]}'
mautic webhooks delete 1
mautic fields list
mautic fields create --json '{"label":"Company Size","type":"number","group":"professional"}'
mautic reports list
mautic reports get 1
All write commands accept JSON from inline, file, or stdin
mautic contacts create --json '{"email":"test@example.com"}'
mautic contacts create --json @contact.json
cat contact.json | mautic contacts create --json @-

Output Formats

Table - colored, aligned columns with total count (powered by rich):

                     Showing 5 of 274,528
id      firstname  lastname  email               points  dateAdded
66515   Lidia      Duarte    lidia@example.com    0       2024-09-27
26698   Claudia    Preis     claudia@example.com  0       2024-08-25
mautic --format table contacts list --limit 5

JSON (default) - full API response, pretty-printed in terminal:

mautic contacts list --limit 5

CSV - same key fields, pipe to file:

mautic --format csv contacts list > contacts.csv

NDJSON - one JSON object per line, auto-paginating through all results:

mautic --page-all contacts list | jq '.fields.all.email'

Global Flags

Global flags go before the resource group:

mautic --format table --published-only emails list
Flag Description
--format json|table|csv Output format (default: json)
--pretty Pretty-print JSON
--page-all Auto-paginate, output NDJSON per record
--dry-run Show HTTP request without executing
--verbose Show HTTP request/response details
--published-only Filter to published items only
--no-verify-ssl Skip SSL certificate verification
--profile <name> Use a named config profile

Authentication

Interactive Setup

mautic auth setup    # Prompts for URL, method (basic/oauth2), credentials
mautic auth test     # Verify connection and detect Mautic version

Supports Basic Auth and OAuth2 Client Credentials grant.

Environment Variables

export MAUTIC_BASE_URL=https://mautic.example.com
export MAUTIC_USERNAME=admin
export MAUTIC_PASSWORD=secret        # zsh: use $'p@ss!' if password contains !

Profiles

Manage multiple Mautic instances with named profiles:

mautic auth setup           # Profile name: production
mautic auth setup           # Profile name: staging
mautic auth list            # Show all profiles
mautic auth delete staging  # Remove a profile

mautic --profile staging contacts list
SSL / self-signed certificates (DDEV, local dev)
# Per-command
mautic --no-verify-ssl contacts list

# Or save the preference during auth setup
mautic auth setup
# Skip SSL verification? (for self-signed certs) [y/N]: y

Search Syntax

The --search flag passes through to Mautic's native search:

mautic contacts list --search "email:*@company.com"
mautic emails list --search "name:Newsletter"
mautic --published-only segments list    # uses is:published internally

Shell Completion

Tab-completion for all commands, subcommands, and options:

mautic completion    # Shows install instructions for your shell

License

MIT

Project details


Download files

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

Source Distribution

mautic_cli-0.1.3.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

mautic_cli-0.1.3-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file mautic_cli-0.1.3.tar.gz.

File metadata

  • Download URL: mautic_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mautic_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8afda6fb3a65bfd4ff28c85a4f87f3bd0c92dbf43b44017066a6676187531f02
MD5 bd98057434b01b3a762430e8527d8ce5
BLAKE2b-256 5840b4831b76b45256b94441725866e1652caa345dbb0f0b21e09a3eb361b871

See more details on using hashes here.

Provenance

The following attestation bundles were made for mautic_cli-0.1.3.tar.gz:

Publisher: publish.yml on Bloomidea/mautic-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mautic_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mautic_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mautic_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f51545cbc605e6dbf557329584ce5dc0b80054d2073a531963e9a6ddcdcd287f
MD5 417ba934d1c730c787433913b24719bc
BLAKE2b-256 1d015704b25cb563f41de2e67b4ed42702501c8396fcb917ab0a56498b0ac7b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mautic_cli-0.1.3-py3-none-any.whl:

Publisher: publish.yml on Bloomidea/mautic-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page