> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fintoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use the Fintoc CLI

> Use the Fintoc CLI to make API requests, trigger test events, forward webhooks, and manage resources like charges, checkout sessions, and links from your shell.

Use the Fintoc CLI to make API requests, trigger test events, and forward webhooks to your local server.

## Available resources

Every command follows the pattern `fintoc <resource> <action> [flags]`. The CLI supports these resources and actions:

| Resource | Actions |
| - | - |
| `api_keys` | `list` |
| `charges` | `create`, `get`, `list` |
| `checkout_sessions` | `create`, `get`, `expire` |
| `links` | `get`, `list`, `delete` |
| `payment_intents` | `get`, `list` |
| `subscriptions` | `get`, `list` |
| `webhook_endpoints` | `create`, `get`, `list`, `delete` |
| `v2 account_numbers` | `create`, `get`, `list`, `delete` |
| `v2 account_verifications` | `create`, `get`, `list` |
| `v2 accounts` | `get`, `list` |
| `v2 movements` | `get`, `list` |
| `v2 transfers` | `create`, `get`, `list` |

## Make an API request

The general form is `fintoc <resource> <action> [flags]`. Run `fintoc --help` to list available resources. Run `fintoc <resource> --help` to list the resource's actions.

```bash theme={null}
fintoc payment_intents list
fintoc charges create --amount 5000 --currency CLP --subscription-id sub_test_abc123
fintoc charges create --from-json payload.json
```

Use `--json` for machine-readable output:

```bash theme={null}
fintoc payment_intents list --json
```

```json theme={null}
[
  {
    "id": "pi_test_a1b2c3d4e5f6g7h8",
    "object": "payment_intent",
    "amount": 100000,
    "currency": "CLP",
    "status": "succeeded"
  }
]
```

> [!NOTE]
>
> `v2 transfers create` requires a JSON Web Signature (JWS) private key for signing. Provide it via the `--jws-private-key` flag or set `jws_private_key` in `~/.fintoc/config.toml`. To generate a key pair, see [Generate JWS keys](https://docs.fintoc.com/guides/business-accounts/setup/setting-up-jws-keys.md).

```bash theme={null}
fintoc v2 transfers create --amount 10000 --currency CLP \
  --account-id acc_test_abc123 \
  --counterparty-account-number 00000000 \
  --counterparty-institution-id cl_banco_estado \
  --jws-private-key ~/path/to/private_key.pem
```

## Pass a JSON payload

For `create` commands, pass a payload file with `--from-json`, or pipe one in with `-`:

```bash theme={null}
fintoc charges create --from-json payload.json
cat payload.json | fintoc charges create --from-json -
```

You can mix flags with `--from-json`. Flag values take precedence over JSON keys. The CLI merges nested objects but replaces entire arrays.

## Delete a resource

Delete commands ask for confirmation before removing the resource. Pass `--yes` to skip the prompt in automated environments.

```bash theme={null}
fintoc webhook_endpoints delete we_test_abc123
fintoc webhook_endpoints delete we_test_abc123 --yes
```

## Trigger test events

`fintoc trigger` generates a test event for your account. The event exercises your webhook handlers without producing real activity.

```bash theme={null}
fintoc trigger payment_intent.succeeded
fintoc trigger payment_intent.succeeded --override amount=5000 --override currency=CLP
fintoc trigger payment_intent.succeeded --from-json overrides.json
```

`--override` accepts dot notation (`metadata.order_id=abc123`). You can repeat the flag. The same precedence rules as `--from-json` apply.

`fintoc trigger` works only with `test` API keys. It accepts the event types listed in [Types of events](https://docs.fintoc.com/api/main-resources/events-reference/types-of-events.md), including Business Accounts events:

```bash theme={null}
fintoc trigger transfer.inbound.succeeded --override amount=20000 --override currency=MXN
fintoc trigger transfer.outbound.failed
```

Fintoc ignores overrides for `id`, `object`, `mode`, `status`, `created_at`, and `updated_at`. To test a different status, trigger the matching event type instead.

## Listen to webhooks on localhost

`fintoc webhooks listen` opens a WebSocket connection to Fintoc and forwards events to your local server. The CLI signs each forwarded request. You can use your existing signature verification without a public tunnel.

```bash theme={null}
fintoc webhooks listen --forward-to http://localhost:3000/webhooks
```

Filter by event type:

```bash theme={null}
fintoc webhooks listen --forward-to http://localhost:3000/webhooks --events payment_intent.succeeded,payment_intent.failed
```
