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

# Withdraw crypto instantly with conversion

> Make an [instant withdrawal](/withdrawals#instant-withdrawals) from a cryptocurrency or fiat balance with conversion to cryptocurrency.

<Note>
  CryptoProcessing is required to collect sender data in compliance with the MiCA regulations. For more details, see [User data collection](/user-data-collection). The `sender_data` and the `end_user_reference` you provide must be associated with the same customer.
</Note>


## OpenAPI

````yaml POST /v2/crypto/withdrawal_instant_exchange
openapi: 3.0.0
info:
  title: Merchant Backend V2
  version: '1.0'
  description: Documentation for merchant backend processing endpoints
servers:
  - url: https://app.cryptoprocessing.com/api
security:
  - xProcessingKey: []
tags:
  - name: Status
  - name: Balance
  - name: Currencies
  - name: Deposit addresses
  - name: Withdrawal
  - name: Exchange
  - name: Invoices
  - name: Transactions
paths:
  /v2/crypto/withdrawal_instant_exchange:
    post:
      tags:
        - Withdrawal
      summary: Withdraw BTC with conversion from EUR
      description: >-
        Make an [instant withdrawal](/withdrawals#instant-withdrawals) from a
        cryptocurrency or fiat balance with conversion to cryptocurrency.
      operationId: post-crypto-withdrawal-instant-exchange
      parameters:
        - $ref: '#/components/parameters/XProcessingSignatureHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                sender_currency:
                  type: string
                  description: >-
                    Currency to withdraw. For a list of all available
                    currencies, see [API currency
                    codes](/api-reference/currency-codes).
                received_currency:
                  type: string
                  description: Target currency to convert funds into before sending.
                sender_amount:
                  type: number
                  description: Amount to withdraw in `sender_currency`.
                address:
                  type: string
                  description: Cryptocurrency address where you want to send funds.
                foreign_id:
                  type: string
                  description: Unique ID of the withdrawal request.
                end_user_reference:
                  $ref: '#/components/schemas/end_user_reference.withdrawals'
                sender_type:
                  $ref: '#/components/schemas/sender_type.withdrawals'
                sender_data:
                  $ref: '#/components/schemas/sender_data.withdrawals'
                receiver_type:
                  $ref: '#/components/schemas/receiver_type'
                receiver_data:
                  $ref: '#/components/schemas/receiver_data'
              required:
                - sender_currency
                - received_currency
                - sender_amount
                - address
                - foreign_id
                - sender_data
                - sender_type
                - receiver_type
                - end_user_reference
            examples:
              Withdraw BTC with conversion from EUR:
                value:
                  sender_currency: EUR
                  received_currency: BTC
                  sender_amount: '100'
                  address: tb1qfdxh6gkfr0qgyatnlkd8khcnxph9tw06n6qwjc
                  foreign_id: withdrawal_123
                  end_user_reference: user_12345
                  sender_type: legal
                  sender_data:
                    legal_name: Example Merchant
                    country_of_registration: DEU
                  receiver_type: natural
                  receiver_data:
                    first_name: Chris
                    last_name: Customer
                    date_of_birth: '1970-01-01'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: Transaction ID.
                      foreign_id:
                        type: string
                        description: Unique ID of the withdrawal request.
                      end_user_reference:
                        $ref: '#/components/schemas/end_user_reference.withdrawals'
                      type:
                        type: string
                        description: >-
                          Transaction type (always
                          `withdrawal_instant_exchange`).
                      status:
                        type: string
                        description: Transaction status.
                      sender_currency:
                        type: string
                        description: Source currency ISO code.
                      sender_amount:
                        type: string
                        description: Withdrawal amount in `sender_currency`.
                      received_currency:
                        type: string
                        description: Destination currency ISO code.
                      received_amount:
                        type: string
                        description: Amount sent in `received_currency`.
              examples:
                Withdraw BTC with conversion from EUR:
                  value:
                    data:
                      id: 134702815
                      foreign_id: withdrawal_123
                      end_user_reference: user_12345
                      type: withdrawal_instant_exchange
                      status: processing
                      sender_currency: EUR
                      sender_amount: '100.00000000'
                      received_currency: BTC
                      received_amount: '0.00124338'
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationOrMalformedJson'
              examples:
                Instant_withdrawals_disabled:
                  summary: Instant withdrawals are disabled
                  value:
                    errors:
                      amount: Instant withdrawals are disabled for this merchant.
                Instant_withdrawals_not_supported_for_sender_currency:
                  summary: Instant withdrawals are not supported for this currency
                  value:
                    errors:
                      sender_currency: >-
                        Instant withdrawals are not supported for the specified
                        sender_currency.
                Duplicate foreign_id:
                  summary: Foreign ID already used
                  value:
                    errors:
                      foreign_id: The foreign id has already been taken.
                Missing required field:
                  summary: Sender currency field is required
                  value:
                    errors:
                      currency: The sender_currency field is required.
                Invalid address format:
                  summary: Crypto address format invalid
                  value:
                    errors:
                      address: Invalid USDC address
                Amount below minimum:
                  summary: Amount too small
                  value:
                    errors:
                      amount: The amount must be 5.00000000 USDC.
                Amount exceeds balance:
                  summary: Insufficient balance
                  value:
                    errors:
                      amount: The requested amount exceeds the available balance.
                Exchange rate unavailable:
                  summary: Unable to get exchange rate
                  value:
                    errors:
                      amount: >-
                        Unable to exchange the requested amount at the moment.
                        Specify a smaller amount or try again later.
                Multiple validation errors:
                  summary: Multiple fields failed validation
                  value:
                    errors:
                      sender_currency: The sender_currency field is required.
                      address: The address field is required.
                      sender_amount: The sender_amount must be greater than 0.
                Malformed JSON:
                  summary: Invalid JSON body
                  value:
                    error: Bad content format
                    code: bad_content_format
        '403':
          $ref: '#/components/responses/WithdrawalHeaderAuthorization'
components:
  parameters:
    XProcessingSignatureHeader:
      name: X-Processing-Signature
      in: header
      required: true
      description: >-
        Hex-encoded HMAC-SHA512 signature of the request body, [generated using
        your secret key](/api-reference/authentication).
      schema:
        type: string
  schemas:
    end_user_reference.withdrawals:
      type: string
      description: >
        Persistent internal ID of the merchant's customer who initiates the
        withdrawal. Use the same value for the same customer across all
        requests. This value must refer to the same customer described in
        `sender_data`.


        Do not include personal data, such as the customer's name or email
        address. Put personal details in `sender_data`.
    sender_type.withdrawals:
      type: string
      enum:
        - natural
        - legal
      description: >
        Type of the merchant's customer who initiates the withdrawal. The sender
        must be the same customer identified by `end_user_reference`.


        Use `natural` if the sender is an individual person and `legal` if the
        sender is a legal entity. The selected type determines which fields must
        be included in `sender_data`.
    sender_data.withdrawals:
      description: >
        Must contain the details of the merchant's customer who initiates the
        withdrawal. Which fields are required depends on `sender_type`.
      oneOf:
        - title: Natural person
          type: object
          required:
            - first_name
            - last_name
            - date_of_birth
          properties:
            first_name:
              type: string
              maxLength: 255
              description: The sender's first name.
            last_name:
              type: string
              maxLength: 255
              description: The sender's last name.
            date_of_birth:
              type: string
              description: The sender's date of birth, YYYY-MM-DD.
        - title: Legal entity
          type: object
          required:
            - legal_name
            - country_of_registration
          properties:
            legal_name:
              type: string
              maxLength: 255
              description: The company's name.
            country_of_registration:
              type: string
              description: >-
                The company's country of registration (ISO alpha-3 format, three
                characters).
    receiver_type:
      type: string
      enum:
        - natural
        - legal
        - self
      description: >
        Type of the withdrawal recipient.


        Use `natural` if the recipient is an individual person, `legal` if the
        recipient is a legal entity, or `self` if the recipient is the same
        person or legal entity as the sender.


        The selected type determines whether `receiver_data` is required and
        which fields it must contain.
    receiver_data:
      description: >
        Details of the withdrawal recipient. Omit this field entirely if
        `receiver_type` is `self`. Otherwise, which fields are required depends
        on `receiver_type`.
      oneOf:
        - title: Natural person
          type: object
          required:
            - first_name
            - last_name
            - date_of_birth
          properties:
            first_name:
              type: string
              description: The recipient's first name.
            last_name:
              type: string
              description: The recipient's last name.
            date_of_birth:
              type: string
              description: The recipient's date of birth, YYYY-MM-DD.
        - title: Legal entity
          type: object
          required:
            - legal_name
            - country_of_registration
          properties:
            legal_name:
              type: string
              maxLength: 255
              description: The company's name.
            country_of_registration:
              type: string
              description: >-
                The company's country of registration (ISO alpha-3 format, three
                characters).
    ValidationOrMalformedJson:
      oneOf:
        - type: object
          title: ValidationError
          description: One or more request parameters failed validation.
          properties:
            errors:
              type: object
              description: >
                A map of request field names to a human-readable validation
                error message for that field. The exact set of possible keys and
                messages is endpoint-specific — see [API
                errors](/api-reference/errors#400-bad-request) for the full
                reference.
              additionalProperties:
                type: string
                description: Human-readable validation error message for this field.
        - type: object
          title: MalformedJson
          description: >-
            The request body is not valid JSON or the Content-Type header is not
            set to `application/json`.
          properties:
            error:
              type: string
            code:
              type: string
  responses:
    WithdrawalHeaderAuthorization:
      description: |
        Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                description: Human-readable error message.
              code:
                type: string
                description: Error code.
            description: >-
              Invalid or missing headers, the API key does not have access to
              the endpoint, or withdrawals are disabled for the merchant or the
              API key. Refer to [Errors](/api-reference/errors#403-forbidden)
              for troubleshooting steps.
          examples:
            Bad signature header:
              value:
                error: Bad signature header
                code: bad_header_signature
            API key does not have the required ability:
              value:
                error: The API key does not have access to this endpoint.
                code: api_key_ability_required
            No signature header:
              value:
                error: No signature header
                code: required_header_signature
            Bad key header:
              value:
                error: Bad key header
                code: bad_header_key
            No key header:
              value:
                error: No key header
                code: required_header_key
            Withdrawals disabled:
              summary: Withdrawals are disabled for this merchant
              value:
                error: Withdrawal functionality is currently unavailable
                code: withdrawal_functionality_unavailable
            Withdrawals disabled for the API key:
              summary: Withdrawals are disabled for this API key
              value:
                error: Withdrawals are disabled for this API key.
                code: api_key_withdrawals_disabled
  securitySchemes:
    xProcessingKey:
      type: apiKey
      description: Your [API key](/merchant-administration/generate-and-activate-api-keys).
      in: header
      name: X-Processing-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.