KosmoKrator

data

Square CLI for AI Agents

Use the Square CLI from KosmoKrator to call Square tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Square CLI Setup

Square can be configured headlessly with `kosmokrator integrations:configure square`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure square --set access_token="$SQUARE_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor square --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
access_token SQUARE_ACCESS_TOKEN Secret secret yes Access Token

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call square.square_get_current_user '{}' --json
Provider shortcut
kosmo integrations:square square_get_current_user '{}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs square --json
kosmo integrations:docs square.square_get_current_user --json
kosmo integrations:schema square.square_get_current_user --json
kosmo integrations:search "Square" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

square.square_get_current_user

Get the current authenticated Square merchant account. Returns merchant details including business name, country, currency, and status.

Read read
Parameters
none
Generic call
kosmo integrations:call square.square_get_current_user '{}' --json
Shortcut
kosmo integrations:square square_get_current_user '{}' --json

square.square_get_customer

Retrieve a Square customer by ID. Returns full customer details including email, phone, address, and cards on file.

Read read
Parameters
id
Generic call
kosmo integrations:call square.square_get_customer '{"id":"example_id"}' --json
Shortcut
kosmo integrations:square square_get_customer '{"id":"example_id"}' --json

square.square_get_order

Retrieve a Square order by ID. Returns full order details including line items, totals, taxes, and discounts.

Read read
Parameters
id
Generic call
kosmo integrations:call square.square_get_order '{"id":"example_id"}' --json
Shortcut
kosmo integrations:square square_get_order '{"id":"example_id"}' --json

square.square_get_payment

Retrieve a Square payment by ID. Returns full payment details including amount, status, card details, and processing fees.

Read read
Parameters
id
Generic call
kosmo integrations:call square.square_get_payment '{"id":"example_id"}' --json
Shortcut
kosmo integrations:square square_get_payment '{"id":"example_id"}' --json

square.square_create_payment

Create a new payment in Square. Requires a payment source ID (e.g., a card nonce or card-on-file ID), an idempotency key, and the amount with currency.

Write write
Parameters
source_id, idempotency_key, amount, currency, reference_id, note, customer_id, location_id
Generic call
kosmo integrations:call square.square_create_payment '{"source_id":"example_source_id","idempotency_key":"example_idempotency_key","amount":1,"currency":"example_currency","reference_id":"example_reference_id","note":"example_note","customer_id":"example_customer_id","location_id":"example_location_id"}' --json
Shortcut
kosmo integrations:square square_create_payment '{"source_id":"example_source_id","idempotency_key":"example_idempotency_key","amount":1,"currency":"example_currency","reference_id":"example_reference_id","note":"example_note","customer_id":"example_customer_id","location_id":"example_location_id"}' --json

square.square_list_customers

List Square customers with optional filtering. Supports pagination with cursor.

Read read
Parameters
limit, cursor, sort_field, sort_order
Generic call
kosmo integrations:call square.square_list_customers '{"limit":1,"cursor":"example_cursor","sort_field":"example_sort_field","sort_order":"example_sort_order"}' --json
Shortcut
kosmo integrations:square square_list_customers '{"limit":1,"cursor":"example_cursor","sort_field":"example_sort_field","sort_order":"example_sort_order"}' --json

square.square_create_customer

Create a new customer profile in Square with name, email, and phone details.

Write write
Parameters
given_name, family_name, email_address, phone_number
Generic call
kosmo integrations:call square.square_create_customer '{"given_name":"example_given_name","family_name":"example_family_name","email_address":"example_email_address","phone_number":"example_phone_number"}' --json
Shortcut
kosmo integrations:square square_create_customer '{"given_name":"example_given_name","family_name":"example_family_name","email_address":"example_email_address","phone_number":"example_phone_number"}' --json

square.square_list_orders

List Square orders for a specific location. Requires a location_id. Supports filtering by order states and pagination with cursor.

Read read
Parameters
location_id, limit, cursor, states
Generic call
kosmo integrations:call square.square_list_orders '{"location_id":"example_location_id","limit":1,"cursor":"example_cursor","states":"example_states"}' --json
Shortcut
kosmo integrations:square square_list_orders '{"location_id":"example_location_id","limit":1,"cursor":"example_cursor","states":"example_states"}' --json

square.square_list_payments

List Square payments with optional filtering. Supports filtering by location ID, begin_time / end_time (ISO 8601), and pagination with cursor.

Read read
Parameters
location_id, begin_time, end_time, limit, cursor
Generic call
kosmo integrations:call square.square_list_payments '{"location_id":"example_location_id","begin_time":"example_begin_time","end_time":"example_end_time","limit":1,"cursor":"example_cursor"}' --json
Shortcut
kosmo integrations:square square_list_payments '{"location_id":"example_location_id","begin_time":"example_begin_time","end_time":"example_end_time","limit":1,"cursor":"example_cursor"}' --json

square.square_list_locations

List all business locations configured in Square, including name, address, and status.

Read read
Parameters
none
Generic call
kosmo integrations:call square.square_list_locations '{}' --json
Shortcut
kosmo integrations:square square_list_locations '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

square.square_get_current_user 0 parameters
Schema command
kosmo integrations:schema square.square_get_current_user --json
ParameterTypeRequiredDescription
No parameters.
square.square_get_customer 1 parameters
Schema command
kosmo integrations:schema square.square_get_customer --json
ParameterTypeRequiredDescription
id string yes Square customer ID.
square.square_get_order 1 parameters
Schema command
kosmo integrations:schema square.square_get_order --json
ParameterTypeRequiredDescription
id string yes Square order ID.
square.square_get_payment 1 parameters
Schema command
kosmo integrations:schema square.square_get_payment --json
ParameterTypeRequiredDescription
id string yes Square payment ID.
square.square_create_payment 8 parameters
Schema command
kosmo integrations:schema square.square_create_payment --json
ParameterTypeRequiredDescription
source_id string yes The ID of the payment source (card nonce, card-on-file ID, or payment token).
idempotency_key string yes A unique string to ensure idempotent processing (e.g., a UUID).
amount integer yes The payment amount in the smallest currency unit (e.g., cents). For $10.00, use 1000.
currency string yes The currency code (e.g., "USD", "EUR", "GBP").
reference_id string no An optional reference ID for the payment (e.g., an order or invoice number).
note string no An optional note attached to the payment.
customer_id string no The Square customer ID to associate with this payment.
location_id string no The Square location ID where the payment is processed.
square.square_list_customers 4 parameters
Schema command
kosmo integrations:schema square.square_list_customers --json
ParameterTypeRequiredDescription
limit integer no Number of customers to return (1–100, default 20).
cursor string no Cursor for pagination — returned from a previous request.
sort_field string no Sort field (DEFAULT, CREATED_AT, FAMILY_NAME, GIVEN_NAME).
sort_order string no Sort order (ASC, DESC).
square.square_create_customer 4 parameters
Schema command
kosmo integrations:schema square.square_create_customer --json
ParameterTypeRequiredDescription
given_name string no The customer's first name.
family_name string no The customer's last name.
email_address string no The customer's email address.
phone_number string no The customer's phone number (E.164 format, e.g., "+15551234567").
square.square_list_orders 4 parameters
Schema command
kosmo integrations:schema square.square_list_orders --json
ParameterTypeRequiredDescription
location_id string yes Square location ID.
limit integer no Number of orders to return (1–100, default 20).
cursor string no Cursor for pagination — returned from a previous request.
states array no Filter by order states (OPEN, COMPLETED, CANCELED). Pass as a comma-separated string.
square.square_list_payments 5 parameters
Schema command
kosmo integrations:schema square.square_list_payments --json
ParameterTypeRequiredDescription
location_id string no Filter by location ID.
begin_time string no Start of time range (ISO 8601, e.g., "2024-01-01T00:00:00Z").
end_time string no End of time range (ISO 8601).
limit integer no Number of payments to return (1–100, default 20).
cursor string no Cursor for pagination — returned from a previous request.
square.square_list_locations 0 parameters
Schema command
kosmo integrations:schema square.square_list_locations --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.