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

# Add funds to wallet

> Add funds to the authenticated wallet by charging a saved payment method. If the payment completes immediately, the new balance is returned. If 3D Secure verification is required, a redirect URL is returned for the user to complete in a browser. Requires a merchant secret key (aks_live_* / aks_test_*).



## OpenAPI

````yaml /openapi.json post /wallet/fund
openapi: 3.0.0
info:
  title: Lava API
  description: >-
    Lava API enables businesses to implement usage-based billing for AI
    services. This API allows tracking, managing, and billing for third-party AI
    API usage through a forwarding system.
  version: 1.0.0
  contact:
    name: Lava support
    url: https://www.lava.so/contact
servers:
  - url: https://api.lava.so/v1/
    description: Lava API v1
security: []
tags:
  - name: Authentication
  - name: Core Endpoints
  - name: Models
  - name: Services
  - name: Requests
  - name: Wallet
  - name: Payment Methods
  - name: Spend Keys
  - name: Usage
  - name: Checkout Sessions
  - name: Customers
  - name: Plans
  - name: Subscriptions
  - name: Meters
  - name: Webhooks
  - name: Secret Keys
  - name: Credit Bundles
  - name: Gateway Settings
  - name: Skills
  - name: News Data
  - name: Search
  - name: Enrich
paths:
  /wallet/fund:
    post:
      tags:
        - Wallet
      summary: Add funds to wallet
      description: >-
        Add funds to the authenticated wallet by charging a saved payment
        method. If the payment completes immediately, the new balance is
        returned. If 3D Secure verification is required, a redirect URL is
        returned for the user to complete in a browser. Requires a merchant
        secret key (aks_live_* / aks_test_*).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - payment_method_id
                - amount
              properties:
                payment_method_id:
                  type: string
                  description: >-
                    ID of the payment method to charge. Use the List payment
                    methods endpoint to get available IDs.
                amount:
                  type: string
                  description: >-
                    Amount in USD to add, as a decimal string. Minimum $10,
                    maximum $10,000.
                  example: '25.00'
      responses:
        '200':
          description: Payment processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - completed
                      - requires_action
                    description: >-
                      Payment status. "completed" means funds were added
                      immediately. "requires_action" means 3D Secure
                      verification is needed.
                  payment_id:
                    type: string
                    description: Unique identifier for this payment
                  balance:
                    type: string
                    description: >-
                      New wallet balance after funding (only present when status
                      is "completed")
                    example: '75.00'
                  redirect_url:
                    type: string
                    description: >-
                      URL for 3D Secure verification (only present when status
                      is "requires_action"). Open in a browser to complete.
              examples:
                completed:
                  summary: Payment completed immediately
                  value:
                    status: completed
                    payment_id: pay_abc123
                    balance: '75.00'
                requires_action:
                  summary: 3D Secure verification required
                  value:
                    status: requires_action
                    payment_id: pay_def456
                    redirect_url: https://hooks.stripe.com/3d_secure_2/authenticate?...
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                validation_failed:
                  summary: Invalid request body
                  value:
                    error:
                      message: Validation failed.
                      code: body_schema_validation_failed
                      status: 400
                email_required:
                  summary: Account has no primary email
                  value:
                    error:
                      message: >-
                        A primary email is required on the account to process
                        payments. Please update your account info.
                      code: funding_email_required
                      status: 400
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                payment_method_not_found:
                  summary: Payment method not found
                  value:
                    error:
                      message: >-
                        Payment method not found or does not belong to this
                        wallet.
                      code: payment_method_not_found
                      status: 404
      security:
        - Auth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message describing what went wrong
              example: Invalid authentication credentials
            code:
              type: string
              description: Machine-readable error code describing what went wrong
              example: forward_token_json_invalid
            status:
              type: integer
              description: HTTP status code of the error
              example: 400
            issues:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type: string
                    description: Path to the field that caused the validation error
                  message:
                    type: string
                    description: Error message describing the validation issue
                required:
                  - path
                  - message
              description: >-
                Optional array of specific validation issues with their paths
                and messages
              example:
                - path:
                    - model
                  message: 'Missing required field: model'
                - path:
                    - messages
                    - '0'
                    - content
                  message: Invalid message content format
          required:
            - message
            - code
            - status
      required:
        - error
  securitySchemes:
    Auth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication used for standard API calls. Format: 'Bearer
        YOUR_API_KEY'

````