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

# Move card funds back to treasury

> Sweeps unspent balance from a card into your treasury (wallet balance). From treasury you can withdraw off-platform via POST /api/withdraw. For EXPIRED cards this always performs a full sweep. For ACTIVE or FROZEN cards, omit `amount` to sweep all available funds, or pass `amount` for a partial claim — the card stays active with the remainder. Pending charges and mandate holds are excluded from the sweepable balance.




## OpenAPI

````yaml /openapi.yaml post /api/cards/{id}/claim
openapi: 3.1.0
info:
  title: mag3nt API
  version: '2026-06-04'
  description: >
    Payment infrastructure for AI agents. Issue virtual cards, pay for API
    access via x402/AP2/MPP protocols, and settle in USDC on Base.
  contact:
    name: mag3nt
    url: https://mag3nt.com
  license:
    name: Proprietary
    url: https://github.com/mag3nt-com/mag3nt-node/blob/main/LICENSE
servers:
  - url: https://mag3nt.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Payments
    description: Universal outbound protocol payments
  - name: Cards
    description: Virtual payment card lifecycle
  - name: Keys
    description: Developer API key management
  - name: Funding
    description: Treasury deposits and balances
  - name: x402
    description: HTTP 402 payment protocol
  - name: AP2
    description: Agent-to-Agent Payment Protocol
  - name: MPP
    description: Micropayment Protocol with streaming
  - name: Pay Links
    description: Shareable payment URLs
  - name: Withdrawals
    description: Withdraw unspent funds back to wallet
  - name: Settlement
    description: On-chain settlement status
  - name: Webhooks
    description: Signed payment.settled notifications for sellers
  - name: Status
    description: System health and configuration
externalDocs:
  description: mag3nt documentation
  url: https://docs.mag3nt.com
paths:
  /api/cards/{id}/claim:
    post:
      tags:
        - Cards
      summary: Move card funds back to treasury
      description: >
        Sweeps unspent balance from a card into your treasury (wallet balance).
        From treasury you can withdraw off-platform via POST /api/withdraw. For
        EXPIRED cards this always performs a full sweep. For ACTIVE or FROZEN
        cards, omit `amount` to sweep all available funds, or pass `amount` for
        a partial claim — the card stays active with the remainder. Pending
        charges and mandate holds are excluded from the sweepable balance.
      operationId: cardsClaim
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: number
                  description: Partial claim in USDC. Omit to sweep all available funds.
      responses:
        '200':
          description: Funds moved to treasury
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaimResponse'
        '400':
          description: Invalid amount
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Card not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Balance changed during claim — retry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ClaimResponse:
      type: object
      properties:
        success:
          type: boolean
        claimed:
          type:
            - number
            - string
        spent:
          type:
            - number
            - string
        remaining_on_card:
          type:
            - number
            - string
        card_status:
          type: string
          example: ACTIVE
        already_claimed:
          type: boolean
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Card not found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: API key prefixed with 'Bearer sx_live_...'

````