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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Criar sessão de cliente

> Cria uma sessão de cliente para cadastrar e gerenciar meios de pagamento salvos para uso futuro

Cria uma sessão de cliente para cadastrar e gerenciar meios de pagamento. Use para salvar cartões, carteiras digitais e outros meios de pagamento para uso futuro. Requer um `customer_id` obtido em [Criar cliente](https://docs.y.uno/pt-br/reference/customers/create-customer.md).


## OpenAPI

````yaml openapi/pt-br/customer-sessions-enrollment/create-customer-session.json POST /customers/sessions
openapi: 3.1.0
info:
  title: customer-api
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /customers/sessions:
    post:
      summary: Criar sessão do cliente
      operationId: create-customer-session
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
                - country
                - customer_id
              properties:
                account_id:
                  type: string
                  description: >-
                    O identificador único da conta. Você encontra essa
                    informação no [Dashboard da Yuno](https://dashboard.y.uno/)
                    (UUID, 36 caracteres).
                country:
                  type: string
                  description: >-
                    O país do cliente  (MAX 2; MIN 2; [ISO
                    3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
                  enum:
                    - AR
                    - BO
                    - BR
                    - CL
                    - CO
                    - CR
                    - EC
                    - SV
                    - GT
                    - HN
                    - MX
                    - NI
                    - PA
                    - PY
                    - PE
                    - US
                    - UY
                customer_id:
                  type: string
                  description: >-
                    O identificador único do cliente, criado com o endpoint
                    [Criar
                    cliente](https://docs.y.uno/pt-br/reference/customers/create-customer)
                    (UUID, 36 caracteres).
                callback_url:
                  type: string
                  description: >-
                    A URL para redirecionar seu cliente após o cadastro ser
                    feito no ambiente do provedor (MAX 526; MIN 3).
                checkout_id:
                  type: string
                  description: >-
                    O identificador único (UUID) do Custom Checkout a ser usado
                    nesta sessão de cadastro. Opcional. Quando omitido, a sessão
                    usa o checkout padrão da conta.
                metadata:
                  type: array
                  description: >-
                    Tags personalizadas opcionais de chave–valor para o meio de
                    pagamento cadastrado com esta sessão. Elas se comportam como
                    os `metadata` de um cadastro direto: são armazenadas com o
                    meio de pagamento cadastrado, retornadas quando você o
                    consulta e no webhook `enrollment.enroll`, e enviadas à
                    integração do provedor com o cadastro, exceto a entrada
                    reservada `gateway_options`, que é armazenada e retornada,
                    mas não encaminhada. Até 120 itens e 75000 caracteres no
                    total, contando cada chave e cada valor.
                  items:
                    properties:
                      key:
                        type: string
                        description: >-
                          A chave de metadados (MAX 48. Valor: MIN:1, MAX:48).
                          **[Diferencia maiúsculas de minúsculas]**
                      value:
                        type: string
                        description: >-
                          O valor da chave de metadados (MAX 512. Valor: MIN:1,
                          MAX:512). **[Diferencia maiúsculas de minúsculas]**
                    required:
                      - key
                      - value
                    type: object
            examples:
              Customer session:
                value:
                  account_id: 8beac4de-5f6f-11ed-9b6a-0242ac120002
                  customer_id: ae106483-65ee-463b-8782-9794022b3112
                  country: US
                  callback_url: >-
                    https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df
                  created_at: '2025-05-07T20:00:18.721786Z'
                  checkout_id: 6822f80c-684e-41a3-8628-78963d3d60f7
                  metadata:
                    - key: on_behalf_of
                      value: acct_1A2b3C4d5E6f7G8h
                    - key: order_ref
                      value: ABC-123
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                Customer session:
                  value:
                    customer_session: 7dd71f21-9e4c-439a-9c6d-58f240bd28df
                    customer_id: ae106483-65ee-463b-8782-9794022b3112
                    country: US
                    callback_url: >-
                      https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df
                    created_at: '2025-05-07T20:00:18.721786Z'
                    checkout_id: 6822f80c-684e-41a3-8628-78963d3d60f7
              schema:
                type: object
                properties:
                  customer_session:
                    type: string
                    example: 7dd71f21-9e4c-439a-9c6d-58f240bd28df
                  customer_id:
                    type: string
                    example: ae106483-65ee-463b-8782-9794022b3112
                  country:
                    type: string
                    example: US
                  callback_url:
                    type: string
                    example: >-
                      https://www.google.com/?customerSession=7dd71f21-9e4c-439a-9c6d-58f240bd28df
                  created_at:
                    type: string
                    example: '2025-05-07T20:00:18.721786Z'
                  checkout_id:
                    type: string
                    example: 6822f80c-684e-41a3-8628-78963d3d60f7
                  metadata:
                    type: array
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Bad Request:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
                Customer Not Found:
                  value:
                    code: CUSTOMER_NOT_FOUND
                    messages:
                      - Customer not found
                  summary: Customer Not Found
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: INVALID_CREDENTIALS
                    messages:
                      - Invalid credentials
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid credentials
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    code: AUTHORIZATION_REQUIRED
                    messages:
                      - The merchant has no authorization to use this API.
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: AUTHORIZATION_REQUIRED
                  messages:
                    type: array
                    items:
                      type: string
                      example: The merchant has no authorization to use this API.
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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