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

# Prepare a Withdrawal

> Quotes a withdrawal and returns a lane-specific payload for the holder to sign. No authentication required (rate-limited).

<Info>
  **Note:** When using the production environment at [moonpay.hel.io](http://app.hel.io), set your API endpoint to `api.hel.io/v1`. For the development environment, use `api.dev.hel.io/v1`.
</Info>

<Tip>
  Display `summary` as your confirmation screen. The quote and `token` expire at `summary.expiresAt`. `sourceCurrencyId` is always required. Optionally pass `customerId` (max 255 characters) to attach a merchant-defined end-user identifier to the quote. Inspect `prepared.kind` to determine what to sign: `raw` (Solana `unsignedTx`), `userop` (EVM ERC-4337 user operation), or `hypercore` (Hyperliquid EIP-712 `typedData`).
</Tip>


## OpenAPI

````yaml POST /v1/withdraw/{withdrawalConfigId}/prepare
openapi: 3.0.0
info:
  title: Helio Open API
  description: |-
    API schema and definitions for Helio API. <br/> 
          The API is using two types of Authentication, for dashboard endpoints we use <b>JSON Web Token (JWT)</b> that is generated by self custodial wallet signing a message from API.</br> 
          We also support authentication with <b>API Key and Secret</b> which can be generated on <a href='https://hel.io'>Helio dashboard</a>.
  version: 1.0.0
  contact: {}
servers:
  - description: Helio API (Mainnet)
    url: https://api.hel.io
  - description: Helio API (Devnet)
    url: https://api.dev.hel.io
security: []
tags:
  - name: Webhooks
  - name: Exports
  - name: Currencies
    description: >-
      Supported currencies endpoint, includes fiat and digital assets
      </br><i>Authentication: </i><b>None</b>
externalDocs:
  description: Helio product documentation
  url: https://docs.hel.io/
paths:
  /v1/withdraw/{withdrawalConfigId}/prepare:
    post:
      tags:
        - Withdrawals
      summary: Prepare a Withdrawal
      description: >-
        Quotes a withdrawal and returns a lane-specific payload for the holder
        to sign. No authentication required (rate-limited). `sourceCurrencyId`
        is required.
      operationId: WithdrawalPrepareController_prepare
      parameters:
        - name: withdrawalConfigId
          in: path
          required: true
          description: The withdrawal config ID.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreparedWithdrawalDto'
      responses:
        '200':
          description: Withdrawal prepared successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreparedWithdrawalEntity'
        '400':
          description: >-
            Validation error (invalid addresses, amount below minimum, no route
            available).
        '404':
          description: Withdrawal config not found.
      security: []
components:
  schemas:
    PreparedWithdrawalDto:
      type: object
      required:
        - ownerAddress
        - recipient
        - amount
        - toCurrencyId
        - sourceCurrencyId
      properties:
        ownerAddress:
          type: string
          description: >-
            Holder's source wallet address. Format is lane-specific (e.g. Solana
            base58 for Solana `raw`, EVM checksummed address for EVM
            `raw`/`hyperliquid`).
        recipient:
          type: string
          description: Destination address on any supported chain.
        amount:
          type: string
          pattern: ^\d+$
          description: >-
            Amount in atomic units as a decimal-free string (e.g. `1500000` for
            1.5 USDC).
        toCurrencyId:
          type: string
          description: Destination currency Mongo ID.
        sourceCurrencyId:
          type: string
          description: Source currency Mongo ID from the withdrawal config.
        customerId:
          type: string
          maxLength: 255
          description: >-
            Optional merchant identifier for the end user (max 255 characters).
            Persisted on prepare and echoed on the withdrawal detail and
            webhooks. Not applied on re-quote.
    PreparedWithdrawalEntity:
      type: object
      properties:
        withdrawalDetailId:
          type: string
          description: Per-request ID. Use for submit and status polling.
        token:
          type: string
          description: JWT quote token. Pass verbatim on submit.
        prepared:
          $ref: '#/components/schemas/PreparedTransaction'
        summary:
          $ref: '#/components/schemas/PreparedWithdrawalSummary'
    PreparedTransaction:
      oneOf:
        - $ref: '#/components/schemas/RawPreparedTransaction'
        - $ref: '#/components/schemas/UserOpPreparedTransaction'
        - $ref: '#/components/schemas/HypercorePreparedTransaction'
      discriminator:
        propertyName: kind
        mapping:
          raw:
            $ref: '#/components/schemas/RawPreparedTransaction'
          userop:
            $ref: '#/components/schemas/UserOpPreparedTransaction'
          hypercore:
            $ref: '#/components/schemas/HypercorePreparedTransaction'
    PreparedWithdrawalSummary:
      type: object
      properties:
        sourceToken:
          type: string
        sourceAmount:
          type: string
        destinationToken:
          type: string
        destinationAmount:
          type: string
          description: Firm expected output net of fees.
        destinationAmountMin:
          type: string
          description: Minimum output after slippage.
        maxSlippageBps:
          type: number
          description: Maximum slippage tolerance in basis points.
        estimatedPriceImpact:
          type: number
          description: Estimated price impact, when available.
        bridgeFee:
          $ref: '#/components/schemas/WithdrawalQuoteFee'
        applicationFee:
          $ref: '#/components/schemas/WithdrawalQuoteFee'
        protocolFee:
          $ref: '#/components/schemas/WithdrawalQuoteFee'
        totalFee:
          $ref: '#/components/schemas/WithdrawalQuoteFee'
        expiresAt:
          type: string
          format: date-time
          description: Quote expiry. Re-quote before this passes.
    RawPreparedTransaction:
      type: object
      required:
        - kind
        - chain
        - unsignedTx
      properties:
        kind:
          type: string
          enum:
            - raw
        chain:
          type: string
          description: Blockchain symbol (e.g. `SOL`).
        unsignedTx:
          type: string
          description: >-
            Base64-encoded unsigned VersionedTransaction, already sponsor-signed
            as fee payer.
    UserOpPreparedTransaction:
      type: object
      required:
        - kind
        - chain
        - userOp
        - entryPoint
      properties:
        kind:
          type: string
          enum:
            - userop
        chain:
          type: string
          description: EVM blockchain symbol (e.g. `BASE`).
        userOp:
          type: object
          additionalProperties: true
          description: Unsigned ERC-4337 UserOperation. Shape depends on the 4337 version.
        entryPoint:
          type: string
          description: EntryPoint contract address for the user operation.
        authorization:
          type: object
          properties:
            chainId:
              type: string
            address:
              type: string
            nonce:
              type: string
          description: Optional EIP-7702 authorization metadata.
    HypercorePreparedTransaction:
      type: object
      required:
        - kind
        - chain
        - typedData
      properties:
        kind:
          type: string
          enum:
            - hypercore
        chain:
          type: string
          description: Blockchain symbol for the HyperCore action.
        typedData:
          $ref: '#/components/schemas/PreparedWithdrawalTypedData'
          description: EIP-712 typed data for the holder to sign.
    WithdrawalQuoteFee:
      type: object
      properties:
        amount:
          type: string
          description: Fee amount in atomic units of `currency`.
        currency:
          allOf:
            - $ref: '#/components/schemas/Currency'
          nullable: true
          description: Matched fee currency, or null when unresolved.
    PreparedWithdrawalTypedData:
      type: object
      properties:
        domain:
          $ref: '#/components/schemas/PreparedWithdrawalTypedDataDomain'
        types:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/PreparedWithdrawalTypedDataField'
        primaryType:
          type: string
        message:
          type: object
          additionalProperties: true
    Currency:
      type: object
      properties:
        blockchain:
          $ref: '#/components/schemas/Blockchain'
        id:
          type: string
        symbol:
          type: string
        name:
          type: string
        mintAddress:
          type: string
        coinMarketCapId:
          type: number
        decimals:
          type: number
        minDecimals:
          type: number
        symbolPrefix:
          type: string
        order:
          type: number
        type:
          enum:
            - FIAT
            - DIGITAL
          type: string
        features:
          type: array
          items:
            type: string
            enum:
              - PAYMENT_PRICING
              - PAYMENT_RECIPIENT
              - SWAP
        iconUrl:
          type: string
      required:
        - blockchain
        - id
        - symbol
        - name
        - mintAddress
        - coinMarketCapId
        - decimals
        - order
    PreparedWithdrawalTypedDataDomain:
      type: object
      properties:
        name:
          type: string
        version:
          type: string
        chainId:
          type: number
        verifyingContract:
          type: string
    PreparedWithdrawalTypedDataField:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
    Blockchain:
      type: object
      properties:
        engine:
          $ref: '#/components/schemas/BlockchainEngine'
        id:
          type: string
        name:
          type: string
        symbol:
          type: string
          enum:
            - SOL
            - ETH
            - POLYGON
            - BASE
            - BITCOIN
      required:
        - engine
        - id
        - name
        - symbol
    BlockchainEngine:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - EVM
            - SOL
            - BTC
      required:
        - id
        - type

````