Skip to main content
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.
Run afx with no arguments for the banner, or afx --help for the command list.

Auth

Every command reads the API key from ANYFORMAT_API_KEY, or from --api-key. A missing key exits with Error: API key is required. Set --api-key or ANYFORMAT_API_KEY.
Every command also takes --base-url (default https://api.anyformat.ai) for a non-production deployment.

Commands

Commands in the order afx --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.
The --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.
The table view prints scalar fields with their confidence and summarises object fields as row counts; use --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. A field keeps its identity only when the schema file carries its persistent_id. Nothing matches by name. A field without one is new, and loses the quality metrics, ground truth and analytics attached to the old field. Fetch the current ids with afx get <workflow-id> before updating.

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. 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 stay stable across those edits as long as the schema file keeps persistent_id.

Exit status

afx exits 1 and prints an Error: line on stderr in five cases: the key is missing, the input is invalid, the API rejects the request, the run ends in error or cancelled, or the wait times out. A rejected request also prints the status and the error_code.