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

# private/execute_block_trade

> Settles a block trade: a multi-leg trade that two parties agree off the platform, directly or through a broker. Each party signs its own side. The maker side signs the same payload as an RFQ quote and the taker side signs the same payload as an RFQ execution, over the same priced legs. Anyone who holds both signed sides can submit them, and the submitter needs no access to either subaccount. A submitter can add a broker fee to each side with extra_fee and referral_code, up to that side's signed max_fee. The trade settles at the signed prices in one atomic step. The total cost must be inside the currency's RFQ price band for both sides, as within_price_band in private/simulate_block_trade and private/verify_block_trade reports. Each leg must be at least 100 times its instrument's minimum_amount. Returns the block_trade_id and the trades of each side. Fails with block_trade_outside_price_band (11123) if the total cost is outside the band, with block_trades_not_available_for_currency (11124) if the currency has no band, and with invalid_amount (11012) if a leg is too small. Requires the block_trade off-chain scope; RFQ scopes do not cover block trades. A session key that signs a side needs block_trade and an RFQ trade scope for every instrument in the legs, or fails with unauthorized_key_scope (14031).



## OpenAPI

````yaml /openapi.json post /private/execute_block_trade
openapi: 3.1.0
info:
  title: Derive v3 API
  version: 0.2.0
  description: JSON-RPC 2.0 methods, served over WebSocket and HTTP POST.
servers:
  - url: https://api.derive.xyz/v3
    description: Production (HTTP POST base)
  - url: https://testnet.api.derive.xyz/v3
    description: Testnet (HTTP POST base)
security: []
tags:
  - name: Subaccounts
    description: >-
      List, inspect, and label subaccounts, portfolios, positions, and
      collateral.
  - name: Session Keys
    description: Register, edit, and list delegated signing keys.
  - name: Account
    description: Wallet-level account information and settings.
  - name: Orderbook
    description: Place, replace, cancel, and query orders, trigger orders, and algos.
  - name: RFQ
    description: 'Request-for-quote: send RFQs, quote, and execute block trades.'
  - name: Liquidations
    description: >-
      Open a Dutch auction against a breaching subaccount, quote the auctions
      running right now, bid on them, and review past ones.
  - name: Vault Shareholders
    description: >-
      Deposit into and withdraw from vaults, and track shares, requests, and
      performance.
  - name: Vault Curators
    description: >-
      Create and operate curated vaults: settle deposit and withdrawal requests,
      and manage vault metadata.
  - name: History
    description: >-
      Per-account historical records: orders, trades, transfers, and
      settlements.
  - name: Market Maker Protection
    description: Configure, read, and reset market-maker protection.
  - name: Transfers & Withdrawals
    description: Move collateral between subaccounts, to other wallets, and on-chain.
  - name: Onchain Actions
    description: >-
      L1 onchain actions submitted via OnchainActionManager: register deposit
      addresses, list pending deposits, and inspect onchain action history.
  - name: System
    description: Rate limits, transaction lookups, and live incidents.
  - name: Market Data
    description: Instruments, currencies, tickers, and market-wide feeds.
  - name: Maker Scoring
    description: Maker programs, score breakdowns, and detailed scoring snapshots.
  - name: Referrals
    description: Referral codes and program performance.
  - name: Chat
    description: Anonymous chat rooms and conversations with the concierge.
  - name: Other
    description: Uncategorized.
paths:
  /private/execute_block_trade:
    post:
      tags:
        - RFQ
      summary: private/execute_block_trade
      description: >-
        Settles a block trade: a multi-leg trade that two parties agree off the
        platform, directly or through a broker. Each party signs its own side.
        The maker side signs the same payload as an RFQ quote and the taker side
        signs the same payload as an RFQ execution, over the same priced legs.
        Anyone who holds both signed sides can submit them, and the submitter
        needs no access to either subaccount. A submitter can add a broker fee
        to each side with extra_fee and referral_code, up to that side's signed
        max_fee. The trade settles at the signed prices in one atomic step. The
        total cost must be inside the currency's RFQ price band for both sides,
        as within_price_band in private/simulate_block_trade and
        private/verify_block_trade reports. Each leg must be at least 100 times
        its instrument's minimum_amount. Returns the block_trade_id and the
        trades of each side. Fails with block_trade_outside_price_band (11123)
        if the total cost is outside the band, with
        block_trades_not_available_for_currency (11124) if the currency has no
        band, and with invalid_amount (11012) if a leg is too small. Requires
        the block_trade off-chain scope; RFQ scopes do not cover block trades. A
        session key that signs a side needs block_trade and an RFQ trade scope
        for every instrument in the legs, or fails with unauthorized_key_scope
        (14031).
      operationId: private_execute_block_trade
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteBlockTradeRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockTradeExecuteResponse'
        default:
          description: JSON-RPC error (see Error Codes)
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    $ref: '#/components/schemas/RPCError'
      security:
        - DeriveWallet: []
          DeriveTimestamp: []
          DeriveSignature: []
components:
  schemas:
    ExecuteBlockTradeRequest:
      type: object
      required:
        - maker_params
        - taker_params
      properties:
        maker_params:
          $ref: '#/components/schemas/SignedBlockTradeSideRequest'
        taker_params:
          $ref: '#/components/schemas/SignedBlockTradeSideRequest'
    BlockTradeExecuteResponse:
      description: 'Result for `private/execute_block_trade`: the trades each side took.'
      type: object
      required:
        - block_trade_id
        - maker_trades
        - taker_trades
      properties:
        block_trade_id:
          description: UUID v4 string
          type: string
          format: uuid
        maker_trades:
          type: array
          items:
            $ref: '#/components/schemas/Trade'
        taker_trades:
          type: array
          items:
            $ref: '#/components/schemas/Trade'
    RPCError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int64
        data:
          type:
            - string
            - 'null'
        message:
          type: string
    SignedBlockTradeSideRequest:
      description: One party's side of a block trade, signed by that party.
      type: object
      required:
        - direction
        - legs
        - max_fee
        - nonce
        - signature
        - signature_expiry_sec
        - signer
        - subaccount_id
      properties:
        client:
          default: ''
          type: string
        direction:
          $ref: '#/components/schemas/Direction'
        extra_fee:
          description: >-
            Broker fee for this side, in USD, paid to the owner of
            `referral_code`. It is not signed. The side's `max_fee` caps the
            total fee.
          default: '0'
          type: string
          format: decimal
        label:
          default: ''
          type: string
        legs:
          type: array
          items:
            $ref: '#/components/schemas/PricedLegParamsAndResponse'
        max_fee:
          description: Highest total fee this side pays, in USD, including `extra_fee`.
          type: string
          format: decimal
        nonce:
          type: string
        referral_code:
          default: ''
          type: string
        signature:
          type: string
        signature_expiry_sec:
          type: integer
          format: int64
        signer:
          $ref: '#/components/schemas/Address'
        subaccount_id:
          type: integer
          format: int64
    Trade:
      description: Info that the user expects to get delivered when requesting trade info.
      type: object
      required:
        - block_trade_id
        - direction
        - expected_rebate
        - extra_fee
        - index_price
        - instrument_name
        - is_transfer
        - liquidity_role
        - mark_price
        - op_uuid
        - order_id
        - quote_id
        - realized_pnl
        - realized_pnl_excl_fees
        - rfq_id
        - subaccount_id
        - timestamp
        - trade_amount
        - trade_fee
        - trade_id
        - trade_price
      properties:
        batch_status:
          description: Settlement batch status; `null` if processed by sequencer.
          anyOf:
            - $ref: '#/components/schemas/BatchStatus'
            - type: 'null'
        block_trade_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        direction:
          $ref: '#/components/schemas/Direction'
        expected_rebate:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        extra_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        index_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        instrument_name:
          type: string
        is_transfer:
          type: boolean
        label:
          default: ''
          type: string
        liquidity_role:
          $ref: '#/components/schemas/LiquidityRole'
        mark_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        op_uuid:
          type: string
        order_id:
          type: string
        quote_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        realized_pnl:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        realized_pnl_excl_fees:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        rfq_id:
          description: Optional UUID v4 string
          type:
            - string
            - 'null'
          format: uuid
        subaccount_id:
          type: integer
          format: int64
        timestamp:
          type: integer
          format: int64
        trade_amount:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_fee:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        trade_id:
          type: string
        trade_price:
          description: >-
            Decimal string of the human value (e.g. `"1.5"`), up to 12
            fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        tx_hash:
          type:
            - string
            - 'null'
    Direction:
      type: string
      enum:
        - buy
        - sell
    PricedLegParamsAndResponse:
      type: object
      required:
        - amount
        - direction
        - instrument_name
        - price
      properties:
        amount:
          description: >-
            Non-negative decimal string of the human value (e.g. `"1.5"`), up to
            12 fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
        direction:
          $ref: '#/components/schemas/Direction'
        instrument_name:
          type: string
        price:
          description: >-
            Non-negative decimal string of the human value (e.g. `"1.5"`), up to
            12 fractional digits; a string or JSON number is accepted
          type: string
          format: decimal
    Address:
      description: 20-byte Ethereum address as a 0x-prefixed lowercase hex string.
      type: string
      maxLength: 42
      minLength: 42
      pattern: ^0x[0-9a-fA-F]{40}$
    BatchStatus:
      description: >-
        Batch lifecycle status — the single source of lifecycle truth for every
        operation in the batch (individual ops carry no status of their own).
        Each stage has a healthy variant and a corresponding `...Error` variant
        meaning that stage failed. Serialized as the variant name (string) in
        API responses.
      type: string
      enum:
        - Batching
        - Executing
        - Da
        - Proving
        - Settling
        - Settled
        - BatchingError
        - ExecutingError
        - DaError
        - ProvingError
        - SettlingError
        - SettledError
    LiquidityRole:
      type: string
      enum:
        - maker
        - taker
  securitySchemes:
    DeriveWallet:
      type: apiKey
      in: header
      name: X-DeriveWallet
      description: The wallet the request acts for.
    DeriveTimestamp:
      type: apiKey
      in: header
      name: X-DeriveTimestamp
      description: The current time in milliseconds, as a decimal string.
    DeriveSignature:
      type: apiKey
      in: header
      name: X-DeriveSignature
      description: >-
        EIP-191 signature of the timestamp, by the wallet or one of its session
        keys.

````

## Related topics

- [private/verify_block_trade](https://docs.derive.xyz/api-reference/rfq/privateverify_block_trade.md)
- [private/invalidate_block_trade_signature](https://docs.derive.xyz/api-reference/rfq/privateinvalidate_block_trade_signature.md)
- [RFQ Trading](https://docs.derive.xyz/trading/rfq.md)


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