> ## 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.

# Enroll in membership auto-renew

> mode "wallet": records a wallet-pull authorization backed by a USDC approve you already signed to the treasury operator (allowance must cover at least one period); the cron pulls transferFrom each period. Omitting mode: reserves MAG3NT/USDC into a custodial autopay card when balance covers a renewal, else records a soft (no-funds) intent paid from your signed-in wallet at period end.




## OpenAPI

````yaml /openapi.yaml post /api/membership/auto-renew
openapi: 3.1.0
info:
  title: mag3nt API
  version: '2026-07-16'
  description: >
    Payment infrastructure for AI agents. Issue virtual cards backed by
    credentials, pay for API access via x402/AP2/MPP protocols, and settle in
    USDC on Base. Also covers Native Token Rails membership and recurring
    billing agreements, ERC-20 project token registration (including B20) and
    prepaid MAG3NT fee metering for DIRECT (non-custodial) settlement, the
    credential marketplace and Credential Token (CT) markets, account-wide token
    holdings, and signed webhooks for payment and subscription lifecycle events.
  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
  - url: https://staging.mag3nt.com
    description: Staging, Base mainnet
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 and subscription lifecycle notifications for sellers
  - name: Status
    description: System health and configuration
  - name: Membership
    description: Native Token Rails membership tiers, checkout, and auto-renew
  - name: Billing
    description: Recurring billing agreements funded by AP2 open mandates
  - name: Tokens
    description: >-
      Register an ERC-20 contract (including B20 tokens) for DIRECT credential
      settlement
  - name: Fees
    description: Prepaid MAG3NT fee meter for DIRECT settlement overage
  - name: Marketplace
    description: >-
      List and transfer credential businesses (proof of record) on the mag3nt
      marketplace
  - name: Credential Tokens
    description: Credential Token (CT) launch and Uniswap V4 markets
  - name: Holdings
    description: Account-wide Credential Token balances
externalDocs:
  description: mag3nt documentation
  url: https://docs.mag3nt.com
paths:
  /api/membership/auto-renew:
    post:
      tags:
        - Membership
      summary: Enroll in membership auto-renew
      description: >
        mode "wallet": records a wallet-pull authorization backed by a USDC
        approve you already signed to the treasury operator (allowance must
        cover at least one period); the cron pulls transferFrom each period.
        Omitting mode: reserves MAG3NT/USDC into a custodial autopay card when
        balance covers a renewal, else records a soft (no-funds) intent paid
        from your signed-in wallet at period end.
      operationId: membershipEnableAutoRenew
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                mode:
                  type: string
                  enum:
                    - wallet
                  description: Omit for the custodial/soft path.
                tier:
                  type: string
                  enum:
                    - starter
                    - growth
                interval:
                  type: string
                  enum:
                    - month
                    - year
                periods:
                  type: integer
                  description: Custodial path only - number of periods to prefund.
                approve_tx:
                  type: string
                  description: >-
                    Wallet path - the on-chain approve tx you just signed (used
                    only to disambiguate a still-confirming allowance).
      responses:
        '200':
          description: Already enrolled
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  enrolled:
                    type: boolean
                  soft:
                    type: boolean
                  mode:
                    type: string
                    enum:
                      - wallet
                      - funded
                  already_enrolled:
                    type: boolean
                  agreement:
                    oneOf:
                      - $ref: '#/components/schemas/BillingAgreement'
                      - type: 'null'
                  card_id:
                    type: string
                  reserve:
                    type: number
                  periods_funded:
                    type: integer
                  price:
                    type: number
                  next_charge_at:
                    type:
                      - string
                      - 'null'
                    format: date-time
                  allowance:
                    type: number
        '201':
          description: Newly enrolled
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  enrolled:
                    type: boolean
                  soft:
                    type: boolean
        '400':
          description: No active plan to auto-renew, or plan has no self-serve auto-renew
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Wallet-pull allowance does not yet cover a period
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    example: approval_required
                  required:
                    type: number
                  allowance:
                    type: number
                  operator:
                    type: string
components:
  schemas:
    BillingAgreement:
      type: object
      description: >-
        An AP2 open-mandate-backed recurring billing agreement. The open_mandate
        SD-JWT is never returned over the API.
      properties:
        id:
          type: string
          example: ba_9f8e7d6c...
        merchant_wallet:
          type: string
          description: >-
            'mag3nt' for platform plans (membership, fee top-ups); otherwise the
            pay link owner's wallet.
        payer_wallet:
          type: string
        payer_card_id:
          type: string
        pay_link_code:
          type:
            - string
            - 'null'
        plan_ref:
          type:
            - string
            - 'null'
          description: >-
            Internal plan reference, e.g. "membership:starter:month". Mutually
            exclusive with pay_link_code.
        description:
          type: string
        amount:
          type: number
        asset:
          type: string
        network:
          type: string
        trigger_type:
          type: string
          enum:
            - interval
            - threshold
        period_days:
          type:
            - integer
            - 'null'
        threshold_metric:
          type:
            - string
            - 'null'
          example: mag3nt_fee_balance
        threshold_floor:
          type:
            - number
            - 'null'
        funding_source:
          type: string
          enum:
            - CARD
            - WALLET
          description: >-
            CARD debits a custodial reserve card. WALLET pulls from the member's
            own wallet via an on-chain allowance (transferFrom), used for
            membership wallet-pull auto-renew.
        funding_spender:
          type:
            - string
            - 'null'
          description: The approved on-chain operator (spender) address for WALLET funding.
        status:
          type: string
          enum:
            - ACTIVE
            - PAST_DUE
            - CANCELLED
            - COMPLETED
            - EXPIRED
        next_charge_at:
          type:
            - string
            - 'null'
          format: date-time
        last_charge_at:
          type:
            - string
            - 'null'
          format: date-time
        charges_made:
          type: integer
        total_charged:
          type: number
        failure_count:
          type: integer
        cancel_at_period_end:
          type: boolean
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    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_...'

````