Maton
Guide

CLI

The maton CLI drives the Maton API from your terminal — manage connections, call the gateway, and deploy functions.

Installation

curl -fsSL https://maton.ai/install.sh | bash
npm install -g @maton/cli
irm https://maton.ai/install.ps1 | iex

Authentication

maton login                 # open the browser, then paste your API key
maton login --interactive   # skip the browser; paste the key directly
maton whoami                # show the current auth state
maton logout                # clear the active profile's credentials

maton login validates the key against your account and stores it in the OS keyring (use --insecure-storage to save it in plain text). You can also set MATON_API_KEY in the environment to override the stored key. Multiple accounts are supported via profiles — maton login list, maton login switch <profile>, and the global -p, --profile flag (or MATON_PROFILE).

Connections

maton connection list                          # list all connections
maton connection list slack --status ACTIVE    # filter by app and status
maton connection create slack                  # opens the browser to authorize
maton connection get {connection_id}
maton connection delete {connection_id} --yes

connection create waits until the connection becomes ACTIVE; use --interactive to print the URL instead of launching a browser, and --method to pick a non-default auth method.

Calling gateway

Every connected app exposes typed subcommands. Add --connection {connection_id} to target a specific account, and --json / --jq / --template to shape the output.

maton slack channel list --types public_channel --limit 10
maton google-mail message list --hydrate

Passthrough

maton api reaches any gateway endpoint directly:

# GET is the default
maton api '/slack/api/conversations.list?types=public_channel&limit=10'

# typed fields; presence of a field switches the method to POST
maton api /connections -f app=slack

# choose the method and route through a specific connection
maton api -X GET /slack/api/conversations.list --connection {connection_id}

# read a JSON body from a file (or "-" for stdin)
maton api -X POST '/google-sheets/v4/spreadsheets/{id}/values/A1:append?valueInputOption=USER_ENTERED' --input body.json

Functions

maton function deploy                          # create on the first run, publish a new version after
maton function deploy --dir ./services/my-fn   # a directory somewhere else
maton function deploy --dry-run                # print the target and the bundle manifest without uploading
maton function list --visibility PUBLIC
maton function get {function_id}
maton function search '"def handler("' --context 2
maton function delete {function_id} --yes

Environment

maton function env list --function {function_id}
maton function env create TOKEN -f {function_id}                            # prompts for the value
maton function env create GREETING -f {function_id} --value hi --type PLAIN
maton function env update -f {function_id} --env-file .env
maton function env delete GREETING -f {function_id} --yes

Invocation

maton api takes the absolute URL and injects the active profile's credentials.

maton api https://my-fn-3k9xq2v.maton.app -f name=ada
maton api -i https://my-fn-3k9xq2v.maton.app

Runs

maton function run list --function {function_id} -L 5
maton function run get {run_id} --function {function_id} --json response
maton function run log list -f {function_id}                                # the newest run's logs
maton function run log list -f {function_id} --run {run_id} --since 10m
maton function run log list -f {function_id} --filter-pattern ERROR
maton function run log tail -f {function_id}                                # follow a live run

Triggers

maton trigger list --source github --status ENABLED -L 50
maton trigger create --source github --event-type pull_request.opened \
  --connection-id {connection_id} \
  --parameter repository_full_name=maton-ai/cli \
  --destination '{"url":"https://example.com/hook","method":"POST","name":"prod"}'
maton trigger get {trigger_id}
maton trigger update {trigger_id} --status DISABLED
maton trigger delete {trigger_id} --yes

Destinations

maton trigger destination list --trigger {trigger_id}
maton trigger destination create --trigger {trigger_id} \
  --url https://example.com/hook --method POST --name prod \
  --header X-Token=secret \
  --body-template '{"data": {{ payload.data }}}'
maton trigger destination get {destination_id} --trigger {trigger_id}
maton trigger destination update {destination_id} --trigger {trigger_id} --url https://new.example.com/hook
maton trigger destination delete {destination_id} --trigger {trigger_id} --yes
maton trigger destination rotate-secret {destination_id} --trigger {trigger_id}

Events

maton trigger event list --trigger {trigger_id} -L 20
maton trigger event get {event_id} --trigger {trigger_id}
maton trigger event replay {event_id} --trigger {trigger_id}

# stream new events and run a handler for each (event JSON on stdin)
maton trigger event watch --trigger {trigger_id} --exec ./handle.sh

Global Flags

  • -p, --profile <name> — use a specific logged-in profile (also MATON_PROFILE).
  • --connection <id> — route an app/gateway command through a specific connection.
  • --json, -q/--jq <expr>, -t/--template <tmpl> — format output (--jq and --template require --json).
  • -L, --limit <n> — cap results on list commands (0 = no limit).

For the full command reference, run maton help or see the CLI manual.

On this page