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

# Withdraw an asset

> Withdraws an ERC-20 token or native ETH from the AutoBoy smart wallet associated with the API key to an arbitrary destination address on Base.

- The endpoint waits for the on-chain receipt and returns the final transaction hash.



## OpenAPI

````yaml https://thefirm.biz/api/public/v1/openapi.json post /api/public/v1/wallet/withdrawals
openapi: 3.1.0
info:
  title: AutoBoy Public API
  version: 0.1.0
  description: >-
    REST API for AutoBoy — browse projects, view detailed stats about your own
    launch, create buy orders and manage your AutoBoy smart wallet.


    ## Authentication


    Most endpoints require an API key, sent as a bearer token:


    ```

    Authorization: Bearer autoboy_…

    ```


    ## Quick start


    1. **Request a key** — `POST /api/public/v1/api-key-requests`

    2. **Register a project** — `POST /api/public/v1/projects`.


    New to AutoBoy? Read the product docs https://docs.thefirm.biz.
servers:
  - url: https://thefirm.biz
security: []
tags:
  - name: API Keys
    description: Request, create, and inspect API keys.
  - name: Projects
    description: Browse projects and their buyers.
  - name: Buy Orders
    description: Read and manage the API key owner's pre-launch buy orders.
  - name: AutoBoy Wallet
    description: Balances of, and withdrawals from, the AutoBoy smart wallet.
  - name: Feedback
    description: Send feedback to The Firm.
paths:
  /api/public/v1/wallet/withdrawals:
    post:
      tags:
        - AutoBoy Wallet
      summary: Withdraw an asset
      description: >-
        Withdraws an ERC-20 token or native ETH from the AutoBoy smart wallet
        associated with the API key to an arbitrary destination address on Base.


        - The endpoint waits for the on-chain receipt and returns the final
        transaction hash.
      operationId: createWithdrawal
      requestBody:
        required: true
        description: The asset, destination, and amount to withdraw.
        content:
          application/json:
            schema:
              type: object
              properties:
                withdrawAddress:
                  type: string
                  description: Destination address that receives the withdrawn asset.
                  example: '0x1234567890123456789012345678901234567890'
                tokenAddress:
                  type: string
                  description: >-
                    ERC-20 contract address, or the native-ETH sentinel
                    0xEeee…EEeE.
                  example: '0x1234567890123456789012345678901234567890'
                amount:
                  type: string
                  minLength: 1
                  description: >-
                    Decimal amount to withdraw, e.g. "12.5", or "max" to
                    withdraw the entire on-chain balance of the asset.
                  example: '12.5'
              required:
                - withdrawAddress
                - tokenAddress
                - amount
      responses:
        '200':
          description: The withdrawal was confirmed on-chain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawResponse'
              example:
                txHash: >-
                  0xa3f5c9e1b7d2048fa3f5c9e1b7d2048fa3f5c9e1b7d2048fa3f5c9e1b7d2048f
                tokenAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                withdrawAddress: '0x1234567890123456789012345678901234567890'
                amount: '12500000'
        '400':
          description: Invalid request body or amount.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidRequestBody:
                  value:
                    error: Bad request
                    message: Invalid request body
                invalidAmount:
                  value:
                    error: Bad request
                    message: amount must be a valid decimal string
                amountTooSmall:
                  value:
                    error: Bad request
                    message: Withdrawal amount must be greater than zero
                amountExceedsBalance:
                  value:
                    error: Bad request
                    message: Withdrawal amount exceeds the available balance
                invalidTokenContract:
                  value:
                    error: Bad request
                    message: tokenAddress is not a valid ERC-20 token contract
        '401':
          description: Missing, invalid, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingAuthorizationHeader:
                  value:
                    error: Unauthorized
                    message: Missing or invalid Authorization header
                invalidApiKey:
                  value:
                    error: Unauthorized
                    message: Invalid API key
        '404':
          description: The API key owner has no AutoBoy wallet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Not found
                message: API key owner has no autoboy wallet
        '500':
          description: The transaction reverted or an unexpected error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                reverted:
                  value:
                    error: Internal server error
                    message: Withdrawal reverted on-chain
                submissionFailed:
                  value:
                    error: Internal server error
                    message: Failed to submit the withdrawal transaction
                notConfigured:
                  value:
                    error: Internal server error
                    message: Withdrawal is not configured on this environment
        '502':
          description: The RPC is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                providerUnavailable:
                  value:
                    error: Bad gateway
                    message: Bundler, paymaster, or RPC is currently unavailable
                balanceReadFailed:
                  value:
                    error: Bad gateway
                    message: Unable to read the token balance from the RPC
      security:
        - apiKeyAuth: []
components:
  schemas:
    WithdrawResponse:
      type: object
      properties:
        txHash:
          type: string
          description: Hash of the confirmed on-chain transaction.
          example: '0xa3f5c9e1b7d2048fa3f5c9e1b7d2048fa3f5c9e1b7d2048fa3f5c9e1b7d2048f'
        tokenAddress:
          type: string
          example: '0x1234567890123456789012345678901234567890'
        withdrawAddress:
          type: string
          example: '0x1234567890123456789012345678901234567890'
        amount:
          type: string
          description: Atomic units actually transferred (decimal string).
          example: '12500000'
      required:
        - txHash
        - tokenAddress
        - withdrawAddress
        - amount
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      example:
        error: Bad request
        message: Invalid request body
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: API key issued via POST /api/public/v1/api-keys.

````