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

# Create Card On File Session

> Create a $0 card-on-file checkout session for the authenticated account. Stripe `setup` mode saves a payment method without charging anything or starting a subscription, so an account that later runs out of credits can be auto-recharged instead of dead-ending. Returns a hosted checkout URL that the client should redirect to.



## OpenAPI

````yaml api-reference/openapi/accounts.json POST /api/subscriptions/card-on-file
openapi: 3.1.0
info:
  title: Recoup API - Accounts
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/subscriptions/card-on-file:
    post:
      description: >-
        Create a $0 card-on-file checkout session for the authenticated account.
        Stripe `setup` mode saves a payment method without charging anything or
        starting a subscription, so an account that later runs out of credits
        can be auto-recharged instead of dead-ending. Returns a hosted checkout
        URL that the client should redirect to.
      requestBody:
        description: Card-on-file session parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCardOnFileSessionRequest'
      responses:
        '200':
          description: Card-on-file session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionSessionResponse'
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionSessionErrorResponse'
              example:
                error: successUrl must be a valid URL
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionSessionErrorResponse'
              example:
                error: Exactly one of x-api-key or Authorization must be provided
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionSessionErrorResponse'
              example:
                error: Internal server error
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    CreateCardOnFileSessionRequest:
      type: object
      required:
        - successUrl
      properties:
        successUrl:
          type: string
          format: uri
          description: The URL Stripe redirects to after the card is saved.
          example: https://chat.recoupable.dev?card=saved
    CreateSubscriptionSessionResponse:
      type: object
      required:
        - id
        - url
      properties:
        id:
          type: string
          description: The checkout session ID.
          example: cs_test_a1b2c3d4e5f6g7h8i9j0
        url:
          type: string
          format: uri
          description: The hosted checkout URL. Redirect to this URL to complete Checkout.
          example: https://checkout.stripe.com/pay/cs_test_a1b2c3d4e5f6g7h8i9j0
    SubscriptionSessionErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
          example: successUrl is required
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).
    bearerAuth:
      type: http
      scheme: bearer

````