---
title: "Visa sample repository"
description: "The published TAP sample code: a route table of Visa's public sample repository. Samples only, never our API."
url: https://app.visacli.sh/docs/reference/samples
updated: 2026-11-18
---

# Visa sample repository

> The published TAP sample code: a route table of Visa's public sample repository. Samples only, never our API.

Canonical: https://app.visacli.sh/docs/reference/samples. Updated: 2026-11-18. Full index: /llms.txt.

> [!WARNING] These are samples, not our API
> This page covers the published TAP sample code, not Visa CLI's API: everything here is Visa's sample repository at a pinned revision. None of it is an API that Visa CLI runs, and it listens on localhost by default.

See the [Visa sample repository](https://github.com/visa/trusted-agent-protocol).

The full sample registry and merchant route inventory, plus schemas and proxy behavior at a pinned revision.

> [!NOTE] Read the mounted paths
> The sample merchant backend mounts its routers with `prefix="/api"`. Thus the real route is `/api/products/`, while several READMEs show `/products` or `/cart/add`. The sample Agent Registry uses snake_case fields and localhost storage; its `/agents/register` route is a separate sample contract.

## Sample merchant APIs · 23 route definitions

Default direct origin: `http://localhost:8000`. Proxy origin is configurable; README examples use localhost:3001. Tables below come from route source at the pinned sample revision.

| Method / actual mounted path | Purpose / source | Inputs | Success / explicit refusal statuses |
| --- | --- | --- | --- |
| `GET` `/api/products/` | Search and filter products<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/products.py#L25) | `query` (query, string, optional): Search query for product name or description<br>`category` (query, string, optional): Filter by category<br>`min_price` (query, number, optional): Minimum price filter<br>`max_price` (query, number, optional): Maximum price filter<br>`limit` (query, integer, default 20, 1 to 100): Number of products to return<br>`offset` (query, integer, default 0, at least 0): Number of products to skip | `200 · ProductList`<br>Explicit refusals: none in this handler |
| `GET` `/api/products/premium/search` | Premium search endpoint that requires x402 payment via delegation token<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/products.py#L75) | `query` (query, string, optional): Search query for product name or description<br>`category` (query, string, optional): Filter by category<br>`min_price` (query, number, optional): Minimum price filter<br>`max_price` (query, number, optional): Maximum price filter<br>`limit` (query, integer, default 20, 1 to 100): Number of products to return<br>`offset` (query, integer, default 0, at least 0): Number of products to skip<br>`delegate_token` (query, string, optional): x402 delegation token for payment | `200 · Inline JSON`<br>Explicit refusals: 402, 502 |
| `GET` `/api/products/{product_id}` | Get a specific product by ID<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/products.py#L210) | `product_id` (path, int) | `200 · Product`<br>Explicit refusals: 404 |
| `POST` `/api/products/` | Create a new product (admin functionality)<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/products.py#L218) | `product` (JSON body, ProductCreate) | `200 · Product`<br>Explicit refusals: none in this handler |
| `POST` `/api/cart/` | Create a new cart with a unique session ID<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L36) | None | `200 · Cart`<br>Explicit refusals: none in this handler |
| `GET` `/api/cart/{session_id}` | Get cart by session ID<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L46) | `session_id` (path, str) | `200 · Cart`<br>Explicit refusals: 404 |
| `POST` `/api/cart/{session_id}/items` | Add an item to the cart<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L54) | `session_id` (path, str)<br>`item` (JSON body, CartItemCreate) | `200 · Cart`<br>Explicit refusals: 404 |
| `PUT` `/api/cart/{session_id}/items/{product_id}` | Update the quantity of an item in the cart<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L96) | `session_id` (path, str)<br>`product_id` (path, int)<br>`item_update` (JSON body, CartItemUpdate) | `200 · Cart`<br>Explicit refusals: 404 |
| `DELETE` `/api/cart/{session_id}/items/{product_id}` | Remove an item from the cart<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L126) | `session_id` (path, str)<br>`product_id` (path, int) | `200 · Message`<br>Explicit refusals: 404 |
| `DELETE` `/api/cart/{session_id}` | Clear all items from the cart<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L150) | `session_id` (path, str) | `200 · Message`<br>Explicit refusals: 404 |
| `POST` `/api/cart/{session_id}/checkout` | Checkout cart and create an order with payment processing<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L163) | `session_id` (path, str)<br>`checkout_data` (JSON body, dict) | `200 · Inline JSON`<br>Explicit refusals: 400, 404 |
| `POST` `/api/cart/{session_id}/finalize` | Finalize cart with shipping, tax, coupons etc and return 402 Payment Required<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L485) | `session_id` (path, str)<br>`finalize_data` (JSON body, CartFinalizeRequest) | `402 · CartFinalizeResponse`<br>Explicit refusals: 400, 404 |
| `POST` `/api/cart/{session_id}/fulfill` | Fulfill cart after payment confirmation<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L626) | `session_id` (path, str)<br>`payment_data` (JSON body, CartFulfillRequest) | `200 · CartFulfillResponse`<br>Explicit refusals: 400, 404 |
| `POST` `/api/cart/{session_id}/x402/checkout` | Machine-to-machine x402 checkout endpoint<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/cart.py#L762) | `session_id` (path, str)<br>`checkout_data` (JSON body, dict) | `200 · Inline JSON`<br>Explicit refusals: 400, 402, 404, 500, 503 |
| `GET` `/api/orders/` | Get orders with optional filtering<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/orders.py#L31) | `customer_email` (query, str = None)<br>`status` (query, str = None)<br>`limit` (query, int = 20)<br>`offset` (query, int = 0) | `200 · OrderList`<br>Explicit refusals: none in this handler |
| `GET` `/api/orders/{order_id}` | Get a specific order by ID<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/orders.py#L53) | `order_id` (path, int) | `200 · Order`<br>Explicit refusals: 404 |
| `GET` `/api/orders/number/{order_number}` | Get a specific order by order number<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/orders.py#L61) | `order_number` (path, str) | `200 · Order`<br>Explicit refusals: 404 |
| `PUT` `/api/orders/{order_id}/status` | Update order status<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/orders.py#L69) | `order_id` (path, int)<br>`status` (query, str)<br>Status values: pending, confirmed, shipped, delivered, cancelled (see source). | `200 · Order`<br>Explicit refusals: 400, 404 |
| `DELETE` `/api/orders/{order_id}` | Cancel an order (only if status is pending or confirmed)<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/orders.py#L95) | `order_id` (path, int) | `200 · Message`<br>Explicit refusals: 400, 404 |
| `POST` `/api/auth/verify-signature` | Verify the signature from a trusted agent.<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/auth.py#L33) | `verification_request` (JSON body, SignatureVerificationRequest) | `200 · SignatureVerificationResponse`<br>Explicit refusals: 400 |
| `GET` `/api/auth/check-verification` | Check if request was verified by CDN/Proxy<br>[Route source](https://github.com/visa/trusted-agent-protocol/blob/16d59bdf3f8a542bc538d0962edbb80ea30a02af/merchant-backend/app/routes/auth.py#L73) | None | `200 · Inline JSON`<br>Explicit refusals: none in this handler |
| `GET` `/` | Merchant root message | None | `200 · {"message":…}` |
| `GET` `/health` | Merchant health | None | `200 · {"status":"healthy"}` |

FastAPI automatically exposes `/docs`, `/redoc` and `/openapi.json`. Schema validation can return 422 on typed inputs. Premium / x402 handlers in this sample belong to its demo payment flow; Visa CLI’s current wallet rail is [Tempo/MPP](/docs/pay-with-mpp.md).

## Sample Agent Registry · 11 route definitions

README advertises port 8080; the sample’s main.py runs uvicorn directly on port 9002. Use the configured origin. Most IDs here are integers and key IDs are caller-defined strings.

| Method / path | Purpose | Inputs | Success response |
| --- | --- | --- | --- |
| `ON_EVENT` `startup` | Initialize database on startup | None | `200 · Inline JSON` |
| `GET` `/` | Health check endpoint | None | `200 · Message` |
| `POST` `/agents/register` | Register a new agent or update existing agent for the domain | `agent` (JSON body, AgentCreate) | `200 · AgentResponse` |
| `GET` `/agents/{agent_id}` | Get agent information by agent ID | `agent_id` (path, int) | `200 · AgentPublicInfo` |
| `GET` `/agents/{agent_id}/keys/{key_id}` | Get specific key for an agent by agent ID and key ID | `agent_id` (path, int)<br>`key_id` (path, str) | `200 · Inline JSON` |
| `POST` `/agents/{agent_id}/keys` | Add a new key to an existing agent | `agent_id` (path, int)<br>`key` (JSON body, AgentKeyCreate) | `200 · AgentKeyResponse` |
| `GET` `/keys/{key_id}` | Get key information by key ID only (without requiring agent ID) | `key_id` (path, str) | `200 · Inline JSON` |
| `GET` `/agents` | List all registered agents (optionally active only) | `active_only` (query, bool) | `200 · list[AgentPublicInfo]` |
| `PUT` `/agents/{agent_id}` | Update specific fields of an existing agent | `agent_id` (path, int)<br>`agent_update` (JSON body, AgentUpdate) | `200 · AgentResponse` |
| `DELETE` `/agents/{agent_id}` | Deactivate an agent (soft delete) | `agent_id` (path, int) | `200 · Message` |
| `GET` `/agents/domain/{domain}` | Get agent information by domain (legacy endpoint) | `domain` (path, str) | `200 · AgentPublicInfo` |

Read routes enforce active flags stored as strings `"true"` / `"false"`. Register updates an existing domain instead of making VARS’s duplicate-domain promise. The sample provides a direct key-only `GET /keys/{key_id}` route used by the CDN proxy.

## Sample merchant request / response schemas

Checkout routes taking a plain dict define their actual fields in the route function, not a closed Pydantic model. See the linked checkout source for its customer/payment or delegation fields. Lists defaulting to [] are reproduced from the sample.

## Sample agent-registration schemas

Ed25519 sample keys are base64 raw 32-byte public keys; RSA keys are literal PEM. The sample’s key formats, activation strings and route prefixes must be evaluated against its own schema.

## Sample CDN / frontend routes and code caveats

| Route / component | Behavior |
| --- | --- |
| `GET /test-proxy` | Proxy diagnostic route. |
| `/api/*` | Proxied to the merchant backend; verify against server.js configuration. |
| `/*` | Frontend proxy / signature verification middleware. |
| Merchant frontend | Product / cart / checkout / orders pages; UI routes are distinct from backend APIs. |
| TAP Agent | Streamlit signing/browser sample; it is not a VDP VARS registration client. |

The sample signature examples omit some required production TAP parameters. The TAP Agent README also calls Ed25519 “post-quantum resistant”; that statement is incorrect. Use RFC 9421 and the required signature fields, plus Visa CLI’s explicit profile, when writing integration code.
