Skip to main content

frappectl — a command-line client for Frappe sites, built for humans and AI agents.

Project description

frappectl

CI MIT License

A command-line REST API v2 client for Frappe v16+ — built for humans and AI agents.

Using an agent? Start with frappectl guide. It fits site selection, core verbs, filtering and the raw-API escape hatch on one screen.

frappectl auth login https://erp.example.com         # key/secret → OS keyring
frappectl -s raven doc list "Raven Channel" --json    # -s/--site selects a profile

frappectl doc list "Sales Invoice" -f status=Overdue -f 'grand_total>1000' \
  --fields name,customer,grand_total --all --json
frappectl doc get "Sales Invoice" SINV-0001
frappectl doc create ToDo --set description="Follow up" --set priority=High
cat invoice.json | frappectl doc create "Sales Invoice"
frappectl doc submit "Sales Invoice" SINV-0001
frappectl doc delete ToDo abc123 --yes

frappectl doctype show "Sales Invoice" --json         # discover the schema first
frappectl report run "Accounts Receivable" -f company="Frappe" --json
frappectl file upload ./contract.pdf --doctype "Sales Invoice" --name SINV-0001 --private
frappectl api method/frappe.client.get_count -F doctype=User
frappectl api method/gameplan.api.get_unread_count    # raw API, when verbs aren't enough

Install

uv tool install frappectl
# or: pip install frappectl
# development version: uv tool install git+https://github.com/frappe/frappectl

This installs two commands: frappectl and its short alias fr.

Authentication

frappectl supports 3 authentication paths.

Environment variables

Environment variables always win and never touch the keyring.

export FRAPPE_SITE=https://erp.example.com
export FRAPPE_API_KEY=xxxxxxxx
export FRAPPE_API_SECRET=yyyyyyyy

Stored profiles

Generate an API key + secret from User → Settings → API Access, then log in:

frappectl auth login https://erp.example.com
frappectl auth login https://raven.example.com --name raven
frappectl auth login https://raven.example.com --name raven --default
frappectl auth list
frappectl auth default raven                          # change the default
frappectl -s raven doc list "Raven Channel"           # select per command
frappectl auth whoami

The site URL lives in ~/.config/frappe/config.json; the secret lives in the OS keyring. There is no plaintext fallback. If the machine has no keyring, use environment variables.

OAuth

Interactive login selects OAuth by default. It stores no secret; short-lived access tokens refresh automatically.

frappectl auth login https://erp.example.com
frappectl auth login https://erp.example.com --client-id <public-client-id>

Sites with dynamic client registration create the client automatically. Frappe v15+ supports this by default; other sites need a pre-registered public --client-id.

OAuth needs a terminal and local browser, so it isn't the headless path. Use --oauth to skip the authentication-method prompt.

Read-only profiles

A read-only profile refuses every unsafe HTTP method before the request leaves your machine. This removes the obvious production footgun: an exploratory command can't accidentally mutate the site.

frappectl auth login https://prod.example.com --name prod --read-only
frappectl auth configure prod --read-only             # lock an existing profile
frappectl auth configure prod --writable              # allow writes again

This blocks doc create/update/delete/submit, file upload, and method calls through api/method. Reads such as doc list/get, doctype show, and report run keep working.

For environment-variable auth, set FRAPPE_READ_ONLY=1. To invoke a whitelisted read method, make the safe verb explicit: frappectl api method/… -X GET.

Output and scripting

  • TTY → rich tables, colours and confirmation prompts.
  • Pipe or --json → clean JSON on stdout. Logs and errors stay on stderr, so piping to jq is safe.
  • Mutations → refuse to run non-interactively without --yes.
  • Exit codes → 0 success, 1 failure, 2 usage error.
  • --debug → traces method, URL and headers to stderr. Credentials are redacted. For endpoints that expose it, such as doc list, it also prints server-side SQL.

Server error detail is plain text; HTML is stripped. --debug never touches stdout, so it won't corrupt --json output.

Commands

Command What it does
frappectl doc list <DocType> List documents. Supports -f, --fields, --limit and --all.
frappectl doc get <DocType> <name> Fetch one document.
frappectl doc create <DocType> Create from --set scalars and/or piped/--input JSON.
frappectl doc update <DocType> <name> Update optimistically; use --force to override.
frappectl doc delete <DocType> <name> Delete after confirmation, or pass --yes.
frappectl doc submit|cancel|amend Run document lifecycle actions.
frappectl doctype list / frappectl doctype show <name> Discover doctypes and schema.
frappectl report run <name> Run a report with the same filter syntax as doc list.
frappectl file upload|download Transfer files; upload supports --doctype/--name and --private.
frappectl api <path> Call raw v2 APIs: frappectl api method/<path> -F key=value.
frappectl guide Print the agent primer; no site or authentication needed.
frappectl assistant [pi|claude|codex] Launch a coding agent configured as a Frappe assistant.
frappectl update Self-upgrade through the uv/pip backend used for installation.

Filtering

Simple filters use -f. Repeat the flag to combine them:

frappectl doc list ToDo -f status=Open -f priority=High
frappectl doc list "Sales Invoice" -f 'grand_total>1000' -f 'customer like %Inc%'

For in, between, child-table filters or anything else that doesn't fit cleanly in a shell argument, pass full Frappe filter JSON:

frappectl doc list "Sales Invoice" --filters-json '[["status","in",["Paid","Overdue"]]]'

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

frappectl-0.13.1.tar.gz (114.7 kB view details)

Uploaded Source

Built Distribution

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

frappectl-0.13.1-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

Details for the file frappectl-0.13.1.tar.gz.

File metadata

  • Download URL: frappectl-0.13.1.tar.gz
  • Upload date:
  • Size: 114.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for frappectl-0.13.1.tar.gz
Algorithm Hash digest
SHA256 3e075f9d8773799e97961d80e5b245bc34fc2edbc275eec3ad67df4a033ec9f8
MD5 f1a895129b2a2428b564657e4db4034a
BLAKE2b-256 8b3b551dfb0e78d8607e3fb0d254baacb02ce9278d233a3fe56ee49053e7e670

See more details on using hashes here.

File details

Details for the file frappectl-0.13.1-py3-none-any.whl.

File metadata

  • Download URL: frappectl-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for frappectl-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 877a6c5a0f063d23b23c7f213e674eac4b6513efdc84d204dd5d001d6e137d0b
MD5 c72b8f49e27717835cd96e01f3ac897c
BLAKE2b-256 20c50aea9b54c6432cd029ee1b3ea89780ea57f54a46cce4810e5f1deb03f233

See more details on using hashes here.

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