Square CLI

The Square CLI brings the public Square API to your terminal and your AI agents, with a consistent command structure and browser OAuth login.

Link to section

Overview

Note

The Square CLI is currently in Beta. To provide feedback or report bugs, open GitHub issues.

The Square CLI (square) gives you and your AI agents command-line access to the public Square API — catalog, orders, payments, customers, inventory, and more. Every command follows a predictable shape, square <domain> <resource> <verb>, and returns structured output you can pipe, filter, and hand to a model.

The CLI is designed to work well with AI assistants: it ships a machine-readable command manifest (--llms), JSON Schema for every command (--schema), and skill files you can sync into your agent.

Releases, the license, and third-party notices are published at GitHub - square/cli. The Square CLI is proprietary software, and your use is subject to the Square Developer Terms of Service. Run square about to print the license notice.

Link to section

Install

The Square CLI is published to npm. Install it globally, or run it on demand with npx. You need Node.js installed.

npm install -g @square/cli square --version
npx -y @square/cli --help
Link to section

Standalone binaries

Prebuilt binaries for macOS, Linux, and Windows are attached to each GitHub release, so you don't need Node.js. Download the binary for your platform and checksums.txt from the same release, verify the download, and put the binary on your PATH. For example, on an Apple silicon Mac:

shasum -a 256 --check --ignore-missing checksums.txt chmod +x square-darwin-arm64 xattr -d com.apple.quarantine square-darwin-arm64 # only if you downloaded it in a browser sudo mkdir -p /usr/local/bin sudo mv square-darwin-arm64 /usr/local/bin/square

The Linux binaries require glibc (for example, Debian or Ubuntu). Alpine and other musl-based distributions aren't supported.

If you redistribute a binary, include THIRD-PARTY-NOTICES.md from the same release.

Link to section

Authentication

The CLI signs in with your Square account through browser OAuth, so there's no access token to create or manage. Run square auth status at any time to see which endpoint and credential the next command would use.

Link to section

Sign in

square auth login

This opens your browser, prompts you to sign in and authorize the Square CLI, and captures the response on a localhost callback (OAuth with PKCE). The CLI exchanges the result for a delegated access token and refresh token, scopes them to a merchant, and stores them at ~/.config/square-cli/credentials.json with mode 0600. The short-lived access token is refreshed automatically; when the grant eventually lapses, run square auth login again.

OptionPurpose
--merchant-id <id>Scope the login to a specific merchant. Defaults to the first merchant on the account.
--no-openPrint the authorization URL instead of opening a browser (for headless environments).
--redirect-url <url>OAuth callback URL. Defaults to http://localhost:5000.
--credentials-file <path>Write credentials to an alternate file. Later commands read it only when SQUARE_CLI_CREDENTIALS_FILE points to the same path.

The OAuth callback listens on the machine running the CLI. To sign in on a remote machine over SSH, forward the callback port, run square auth login --no-open on the remote machine, and open the printed URL in your local browser:

ssh -L 5000:localhost:5000 REMOTE_HOST square auth login --no-open # run on the remote machine

Sign out by removing the stored credentials:

square auth logout
Link to section

Access tokens

The CLI doesn't accept access tokens. It ignores the SQUARE_ACCESS_TOKEN environment variable, and square auth login has no token option. To call Square from CI or a server with an access token, use the Square API directly.

Link to section

The command model

Every business command follows the same shape:

square <domain> <resource> <verb> [args] [options]

For example:

square catalog item list --limit 10 square payments payment get PAYMENT_ID square orders order search --location-ids LOCATION_ID square customers customer list --limit 10

Run --help at any level to explore what's available:

square --help # list every domain square catalog --help # list catalog resources square catalog item --help # list verbs and options for catalog items

For the complete list of commands, see the Command reference.

Link to section

Output formats and filtering

Data goes to stdout; diagnostics go to stderr. Commands print JSON by default. Choose another format with --format:

square catalog item list --limit 1 # JSON (the default) square catalog item list --limit 1 --format toon # compact and token-efficient
FormatUse for
jsonParsing and scripting (the default). Pair with --schema to see the shape.
toonCompact, token-efficient output for passing to a model.
yaml, md, jsonlAlternate renderings for humans and pipelines.

For example, square catalog item list --limit 1 --format json returns the matching catalog objects. When more results are available, the response includes a cursor and the command to fetch the next page. Without --format, an interactive terminal prints that command as a hint below the JSON instead. This sample is trimmed: real responses include every field the command selects, with null for fields that have no value.

Prune large responses to just the fields you need with --filter-output (dot notation, comma-separated paths, [] for every array element, [start,end] array slices). Paths start at the top of the response, so list results sit under objects[]:

square catalog item list --filter-output 'objects[].id,objects[].itemData.name'

The same filter with --format toon:

objects[3]: - id: W62UWFY35CWMYGVWK6TWJDNI itemData: name: Cold Brew - id: LBTYIHNHU52WOIHWT7SNRIYB itemData: name: Croissant - id: 2ICQ7LKTH6RHWJ4EPBQZYQ44 itemData: name: Latte

For a single object, paths start at the object itself:

square catalog item get OBJECT_ID --filter-output id,itemData.name,itemData.productType square catalog item get OBJECT_ID \ --filter-output 'itemData.variations[0,5].itemVariationData.priceMoney,itemData.taxIds[0,3]'
Link to section

Use the CLI with AI agents

The Square CLI is built to be driven by AI assistants. It doesn't run as an MCP server; to connect an MCP client to Square, use the Square MCP server.

Link to section

Machine-readable manifests

square --llms --format json # every command and its description square catalog item list --schema # JSON Schema for one command's args, options, and output
Link to section

Agent skills

The CLI ships task-oriented skill files you can sync into your agent:

square skills list square skills add

Skills install globally by default. Pass --no-global to install them into the current project instead.

To build and deploy a seller web app, use the apps skill and the square apps commands. Sign in with a production seller account first, because the apps platform runs in production only:

square skills add --no-global square apps site --help
Link to section

Command reference

The CLI covers the public Square API. Run square --help to list every domain, or see the Command reference for the complete list of commands. Common domains include:

DomainDescription
catalogManage catalog objects, typed catalog resources, and catalog utility endpoints.
ordersCreate, retrieve, search, calculate, clone, update, and pay Square orders.
paymentsWork with payment records and their lifecycle.
customersCustomer directory: profiles, search, bulk operations, group membership, and cards on file.
inventoryInventory counts, adjustments, adjustment reasons, and transfer orders.
locationsSeller locations: addresses, hours, capabilities, and settings.
invoicesInvoices: creation, delivery, payment tracking, and managed invoicing.
bookingsAppointments: bookings, availability, and team member booking profiles.
loyaltyLoyalty programs, accounts, points, promotions, and rewards.
reportingSales, customer-visit, discount, and other business analytics reports.
appsDeploy and manage seller web apps on the Square apps platform.