# Link CLI

Let your agent pay online and give financial insights to your customers.

Link CLI is available to US consumers. Your agent and the sellers your customers buy from can be outside of the US.

Link CLI gives your agent access to a wallet that your customer controls. Your agent can retrieve one-time-use payment credentials to complete purchases, and retrieve permissioned financial data to answer questions about spending, balances, and trends. Learn how to set up a hosted agent, where you operate the agent on behalf of your customers. To use Link CLI with your own local agent, see the [link-cli repository](https://github.com/stripe/link-cli).

Most integrations use both capabilities. Set up OAuth once, then request the scopes for whichever capabilities you need.

## Capabilities

Link CLI has two capabilities: agent payments and financial insights.

| Capability | Description | Example use case |
| --- | --- | --- |
| [Agent payments](https://docs.stripe.com/agentic-commerce/link-cli/use-link-wallet-pay-online.md) | Your agent retrieves one-time-use payment credentials to complete purchases. Customers approve each request on the Link website or in the mobile app. Agent payments support one-time-use virtual cards and shared payment tokens. | “Buy me this book from Stripe Press” |
| [Financial insights](https://docs.stripe.com/financial-connections/agents/financial-insights.md) | Your agent reads transaction history, balances, and account details from connected bank accounts and credit cards. | “What did I spend on dining this month?” |

## How it works

Your agent gets an access token through OAuth, then uses that token to call Link on your customer’s behalf:

1. You register an OAuth client to authenticate your agent.
2. Your agent redirects customers to the Link authorization endpoint with the requested scopes.
3. Customers authenticate and approve the requested permissions. For financial insights, they also choose which accounts to share.
4. Your agent exchanges the authorization code for an access token.
5. Your agent calls Link to search products, retrieve one-time-use payment credentials, or retrieve financial data.

## Link API

Link CLI calls the Link API at `api.link.com`, and authorizes against `login.link.com`. These APIs are separate from the Stripe API at `api.stripe.com`, which changes how you authenticate and which tools you can use.

- You authenticate with an OAuth access token instead of a [Stripe secret key](https://docs.stripe.com/keys.md#obtain-api-keys). Link CLI reads the token from `LINK_ACCESS_TOKEN`.
- You call the endpoints through Link CLI, or send HTTP requests directly. Stripe’s server-side SDKs don’t cover these endpoints.
- These endpoints don’t appear in the [Stripe API reference](https://docs.stripe.com/api.md).

Your agent can inspect the full CLI documentation with `link-cli --llms-full`, and the current input contract for any command with `link-cli <command> --schema`.

To use financial insights, you need a Stripe account with [Financial Connections](https://docs.stripe.com/financial-connections.md) registration. Your Stripe publishable key initiates the OAuth flow that reads financial data. To use the agent wallet for payments, you don’t need a Stripe account, though registering an OAuth client improves the experience.

> #### Handling customer financial data
> 
> Because your agent is a hosted service, your company acts as a data recipient. You’re responsible for how customer financial data is handled within your application.

## Get started

Every integration starts with OAuth. [Set up OAuth](https://docs.stripe.com/agentic-commerce/link-cli/oauth.md), then follow the guide for what you want your agent to do:

- [Retrieve payment credentials with spend requests](https://docs.stripe.com/agentic-commerce/link-cli/use-link-wallet-pay-online.md): retrieve one-time-use virtual cards and shared payment tokens.
- [Search products and complete payments with UCP](https://docs.stripe.com/agentic-commerce/link-cli/commerce-agents-ucp.md): discover and buy products across sellers.
- [Pay machine-payment merchants](https://docs.stripe.com/agentic-commerce/link-cli/machine-payments.md): pay merchants that accept machine payments over HTTP 402.
- [Add financial insights to your agent](https://docs.stripe.com/financial-connections/agents/financial-insights.md): retrieve transactions, balances, and account data.

## See also

- [Agentic Commerce](https://docs.stripe.com/agentic-commerce.md)
- [link-cli repository](https://github.com/stripe/link-cli)
