afx is the command line that ships with the Python SDK. It covers the one-off jobs you do not want to write code for: parse a file to markdown, extract a few fields, run an existing workflow, and list or delete workflows.
Install
afx is the anyformat package’s console script. The 1.0 line is a release candidate, so pip needs --pre.
afx with no arguments for the banner, or afx --help for the command list.
Auth
Every command reads the API key fromANYFORMAT_API_KEY, or from --api-key. A missing key exits with Error: API key is required. Set --api-key or ANYFORMAT_API_KEY.
--base-url (default https://api.anyformat.ai) for a non-production deployment.
Commands
Commands in the orderafx --help lists them. Progress lines go to stderr; results go to stdout, so you can pipe them.
extract
Creates a workflow with one Parse node and one Extract node, uploads the file, runs it, and prints the fields. Give the fields inline with--field, or as a JSON file with --schema. At least one is required.
--schema file is a JSON array. Each entry has name, type and description; an object entry adds fields. Supported types: string, integer, float, boolean, date, datetime, object. enum and multi_select are not supported on the command line.
--json to see the rows.
run
Runs an existing workflow, built in Studio or with an SDK, against a file and prints the fields.parse
Parses a file with the atomic parse operation (a fast, lite parse) and prints the markdown. No workflow is created.update-workflow
Replaces an existing workflow’s graph with a new Parse + Extract pair built from--field and --schema, the same way extract builds one. Fields are matched to the previous version by name, or by persistent_id when the schema file carries one.
list
Lists your organization’s workflows, newest first, as a table of id, name and creation time.get
Prints a workflow’s typed definition as JSON: the same{ name, description, nodes, edges } shape the create endpoint accepts.
delete
Deletes a workflow, with its document packets and runs. Asks for confirmation unless--yes is given.
runs
Lists a workflow’s runs, newest first: run id, document packet id, status and creation time.What a CLI workflow is
afx extract and afx update-workflow build the same typed graph the SDKs and Studio use: a parse node with the chosen mode, one extract node with your fields, and one edge between them. afx get shows it. You can open a CLI-created workflow in Studio, run it with afx run or either SDK, and edit it with afx update-workflow or PATCH /v3/workflows/{id}/. The field ids are stable across those edits when you keep persistent_id in the schema file.
Exit status
afx exits 1 with an Error: line on stderr when the key is missing, the input is invalid, the API rejects a request (with the status and error_code), the run ends in error or cancelled, or the wait times out.
