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

> ## Agent Instructions
> Sapiom Pay is for platforms whose agent shops for many end users. Each end user is a buyer with their own Sapiom key and saved cards.
> Use the buyer's key for every call made on that buyer's behalf. Never use one buyer's key for another user, and never give the agent the platform key.
> Agents call the hosted MCP tools at https://api.sapiom.ai/v1/mcp. Backends call the REST API at https://api.sapiom.ai/v1. Both take the key in an x-api-key header.
> Never ask a buyer for a card number, expiry date or CVV in chat. Buyers enter card details only on Sapiom's hosted pages.
> Follow the nextAction in each transaction result. Action links are secrets for the intended buyer only.
> Use one idempotencyKey per transaction. After a timeout, retry with the same key. Never start a new transaction to escape an uncertain outcome.
> Report an order as placed only when order.outcome is confirmed. If it is unknown, stop and hand off to a person.

# Create a setup link

> Create a link to the hosted page where a cardholder adds a card for this tenant. Requires a [buyer key](/api-reference/overview#authentication).



## OpenAPI

````yaml /api-reference/openapi.json post /v1/payment-cards/setup-links
openapi: 3.0.0
info:
  title: Sapiom Pay API
  version: '1.0'
  description: >-
    Create buyers, save their cards and authorize transactions. Send your
    platform key or a buyer key in the `x-api-key` header.
servers:
  - url: https://api.sapiom.ai
    description: Production
security:
  - api-key: []
tags:
  - name: Buyers
    description: One buyer per end user. Called tenants in the API.
  - name: Cards
    description: Hosted card setup links and the buyer's saved cards.
  - name: Spending limits
    description: Limits on what each card can spend.
  - name: Merchants
    description: Check whether Sapiom can buy from a merchant.
  - name: Transactions
    description: Create a transaction and drive its UCP checkout.
  - name: Browser checkout
    description: Placeholder cards and the relay Browser Pay uses.
paths:
  /v1/payment-cards/setup-links:
    post:
      tags:
        - Cards
      summary: Create a setup link
      description: >-
        Create a link to the hosted page where a cardholder adds a card for this
        tenant. Requires a [buyer key](/api-reference/overview#authentication).
      operationId: CardSetupLinksController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCardSetupLinkDto'
      responses:
        '201':
          description: The link. `url` holds a one-time code and is only returned here
      security:
        - api-key: []
components:
  schemas:
    CreateCardSetupLinkDto:
      type: object
      properties:
        returnUrl:
          type: string
          maxLength: 2048
          description: >-
            Where the page sends the cardholder when they finish or back out,
            with `setup_link` and `status` (`completed` or `canceled`) added to
            the query. HTTPS only.
        cardholderEmail:
          type: string
          maxLength: 254
          format: email
          description: Pre-fills the page's email field; the cardholder can change it
        expiresInMinutes:
          type: number
          minimum: 5
          maximum: 1440
          description: How long the link stays usable
          default: 30
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your platform key for buyer management, or a buyer key for everything
        else.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.