Skip to main content

frappectl

CI PyPI Version 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 --oauth # browser login → 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

frappectl doctype show "Sales Invoice" --json         # discover the schema first
frappectl report run "Accounts Receivable" -f company="Frappe" --json
frappectl -s raven query 'select count(*) as users from tabUser'
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 a browser, so it isn't the headless path. Use --oauth to skip the authentication-method prompt.

Over SSH, open the printed link in the browser on your own machine. After you approve, the browser is sent to http://127.0.0.1:9876/callback, which fails to load because frappectl is listening on the remote machine. Copy that URL from the address bar and paste it into the terminal. Forwarding the port (ssh -L 9876:127.0.0.1:9876 host) also works and skips the paste.

Read-only profiles

A new profile is read-only by default and 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. Choose --writable during login to opt out.

frappectl auth login https://prod.example.com --name prod
frappectl auth login https://dev.example.com --name dev --writable
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.

Agent attribution

When an LLM agent runs frappectl, each request sends the agent name in the X-Frappe-Agent header. Frappe records the name in Version, and the form timeline shows "using Claude Code via API" next to each change the agent made.

frappectl finds the agent from the variables that agent harnesses set, such as CLAUDECODE, CODEX_SANDBOX, GEMINI_CLI or AI_AGENT. frappectl assistant sets the name for the tool that it starts. frappectl auth whoami shows the name that frappectl sends.

export FRAPPE_AGENT="Nightly sync"   # send this name instead
export FRAPPE_AGENT=                 # send no name

The site must run a Frappe version that records agents. Other sites ignore the header.

Output and scripting

  • TTY → rich tables and colours.
  • Pipe or --json → clean JSON on stdout. Logs and errors stay on stderr, so piping to jq is safe.
  • Mutations → the CLI itself never prompts. Confirmation is the job of the caller, whether that is you or an agent harness. Use a read-only profile to make mistakes impossible on sites that matter.
  • 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 a document.
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 query <sql> Run read-only SQL through System Console and print a table. Requires System Manager or Administrator.
frappectl method search|list|show Discover whitelisted methods (RPC paths and doctype methods).
frappectl method call <path> Invoke an RPC method; add --doctype/--name to call a doctype method.
frappectl file upload|download Transfer files; upload supports --doctype/--name and --private.
frappectl ui tabs|acts|state|dialogs|run|wait Drive a person's open desk v2 tab through its acts. Exit 0 done, 2 waiting for the person, 1 error. See Drive an open desk tab.
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|flow] Launch a coding agent configured as a Frappe assistant.
frappectl update Self-upgrade via uv tool upgrade.

Drive an open desk tab

frappectl ui works the desk v2 tab a person has open, through the same acts the UI uses. The person turns on Let agents drive my open tabs in My Settings > Profile > Agents, then reloads the tab. Without it every command fails with a 403 and a tip.

frappectl ui tabs                                  # open tabs, last focused first
frappectl ui acts --surface list                   # acts the current page offers
frappectl ui state --fields                        # route, page, and record fields
frappectl ui run record.set_values '{"values":{"customer":"Acme"}}'
frappectl ui run header.submit                     # exit 2: the person must confirm
frappectl ui dialogs                               # what is open in the tab
frappectl ui wait <call>                           # after the person answered

Every command takes --tab <id>; without it the last focused tab answers. Output is a short text summary by default, even when piped. --json prints the full result. run is refused on a read-only profile; the other commands still work.

Exit codes: 0 done, 2 waiting_for_user (a dialog needs the person; never answer it yourself, then ui wait <call>), 1 any other error. A usage error (a missing argument, or a value like -1 that looks like a flag; put it after --) exits 2, as everywhere in frappectl.

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

Metadata

Release files for frappectl 0.26.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frappectl 0.26.0
File Size Uploaded Provenance Actions
frappectl-0.26.0.tar.gz 127.5 kB Without provenance Details for frappectl-0.26.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frappectl 0.26.0
File Interpreter ABI Platform Actions
frappectl-0.26.0-py3-none-any.whl Python 3 none any Details for frappectl-0.26.0-py3-none-any.whl

Total release size: 203.8 kB

Release files / frappectl-0.26.0.tar.gz

Download URL frappectl-0.26.0.tar.gz
Size 127.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9fb4036bc08e90be8d5ba28ff5c952f3c7a3f35c33f6997ce90444ec37587b12
BLAKE2b-256 checksum
How to use checksums
1360181638a4e670b9d5470fdef1520f1858c86a1458744480df877a48b074c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / frappectl-0.26.0-py3-none-any.whl

Download URL frappectl-0.26.0-py3-none-any.whl
Size 76.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ae040ae628d6f1e2f274dc0c9f479b38276e83fb02ccaaadda56fb54c47e925
BLAKE2b-256 checksum
How to use checksums
1775e777bd6d29a1d0f975bfa284d387af1099bd415693632c6209ea0a1e66dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for frappectl 0.26.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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