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

# Merge your custodial pairs

> Turns `amount` pairs of YES and NO you hold CUSTODIALLY in one market back into the same amount of the quote currency, credited to your balance at once. A pair always pays exactly 1 at resolution, so this releases that collateral early; there is no fee and nothing moves on-chain. Only the pairs not reserved by your resting sells can be merged. For pairs in your wallet, sign a merge and relay it with `POST /account/wallet/relay` instead. Available to accounts that trade custodially. Refusals: 404 `merge.unknown_market`; 422 `merge.bad_amount`, `merge.market_state` (resolved or settling), `merge.not_enough_pairs`; 409 `merge.inflight` (a trade of yours in this market is still settling on-chain; retry shortly), `merge.account_held` (your account is held for review); 403 `market.order.custodial_disabled`.



## OpenAPI

````yaml /api-reference/openapi/calibri.yaml post /api/v2/atlas/account/positions/merges
openapi: 3.1.0
info:
  title: Calibri API
  version: 1.0.0
  description: >-
    The Calibri API. Discover markets, read live books, place signed orders, and
    manage positions and account data.

    Routed by path prefix to the service that answers it — which is an
    implementation detail, not something a caller has to reason about.
servers:
  - description: Production
    url: https://calibri.io
security: []
tags:
  - name: Health
    description: Service liveness.
    x-displayName: Health
  - name: Events
    description: Discover events and their metadata.
    x-displayName: Events
  - name: Markets
    description: List markets and load market detail for trading.
    x-displayName: Markets
  - name: Series
    description: Recurring event series.
    x-displayName: Series
  - name: Tags
    description: Editorial shelves used to browse the catalogue.
    x-displayName: Tags
  - name: Market Data
    description: Order book, depth, trade tape, tickers, and candles.
    x-displayName: Market Data
  - name: Assets
    description: Underlying asset price history for price-feed markets.
    x-displayName: Assets
  - name: Community
    description: Leaderboard and platform activity.
    x-displayName: Community
  - name: Currencies
    description: Currency registry.
    x-displayName: Currencies
  - name: Trade
    description: Place, list, and cancel orders.
    x-displayName: Trade
  - name: Positions
    description: Your matched contracts.
    x-displayName: Positions
  - name: Wallet
    description: Self-custody Safe, passkey, session keys, and relay.
    x-displayName: Wallet
  - name: Rewards
    description: Maker rebates and referral earnings.
    x-displayName: Rewards
  - name: Account
    description: Balances, ledger, PnL, limits, preferences, and profile.
    x-displayName: Account
  - name: Categories
    description: Categories
    x-displayName: Categories
  - name: Other
    description: Other
    x-displayName: Other
paths:
  /api/v2/atlas/account/positions/merges:
    post:
      tags:
        - Positions
      summary: Merge your custodial pairs
      description: >-
        Turns `amount` pairs of YES and NO you hold CUSTODIALLY in one market
        back into the same amount of the quote currency, credited to your
        balance at once. A pair always pays exactly 1 at resolution, so this
        releases that collateral early; there is no fee and nothing moves
        on-chain. Only the pairs not reserved by your resting sells can be
        merged. For pairs in your wallet, sign a merge and relay it with `POST
        /account/wallet/relay` instead. Available to accounts that trade
        custodially. Refusals: 404 `merge.unknown_market`; 422
        `merge.bad_amount`, `merge.market_state` (resolved or settling),
        `merge.not_enough_pairs`; 409 `merge.inflight` (a trade of yours in this
        market is still settling on-chain; retry shortly), `merge.account_held`
        (your account is held for review); 403
        `market.order.custodial_disabled`.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustodialMergeRequest'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionMergeEntity'
          description: Booked
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEntity'
          description: Not a custodial trading account
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEntity'
          description: A trade in this market is still settling
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEntity'
          description: Refused; `code` says why
      security:
        - apiKey: []
components:
  schemas:
    CreateCustodialMergeRequest:
      properties:
        amount:
          description: >-
            Pairs to merge: YES and NO you hold custodially in this market, not
            reserved by resting sells. At most the market’s size decimals.
          example: '100'
          type: string
        market_id:
          description: The market.
          example: 14738
          type: number
      required:
        - market_id
        - amount
      type: object
    PositionMergeEntity:
      properties:
        booked_at:
          description: When it was booked. RFC 3339, UTC.
          example: '2026-11-29T10:01:12Z'
          type:
            - string
            - 'null'
        created_at:
          description: RFC 3339, UTC.
          example: '2026-11-29T10:00:00Z'
          type: string
        custody:
          description: >-
            `self`: from your wallet, on-chain. `custodial`: a merge of the
            pairs Calibri holds for you (`POST /account/positions/merges`);
            nothing moves on-chain.
          enum:
            - self
            - custodial
          example: self
          type: string
        failure_reason:
          description: >-
            Why a `failed` merge did nothing: the transaction reverted, was
            dropped, was never sent, or was replaced by another one; `refused`:
            a custodial merge Calibri refused (the request said why).
          enum:
            - reverted
            - dropped
            - not_broadcast
            - superseded
            - refused
          example: null
          type:
            - string
            - 'null'
        id:
          example: 311
          type: number
        kind:
          description: >-
            `merge`: pairs of YES and NO turned back into USDC; `split`: USDC
            turned into pairs (sent from your wallet directly; the relay does
            not split).
          enum:
            - merge
            - split
          example: merge
          type: string
        market:
          $ref: '#/components/schemas/PositionMergeMarketEntity'
        market_id:
          example: 14738
          type:
            - number
            - 'null'
        pairs:
          description: Pairs merged or split.
          example: '6'
          type: string
        proceeds:
          description: >-
            USDC a merge credited to your wallet balance. Null until booked, and
            on a split.
          example: '6'
          type:
            - string
            - 'null'
        realized_pnl:
          description: >-
            What a merge booked before settlement made on the pairs: `proceeds`
            less what they cost. Null until booked, on a merge after settlement
            and on a split.
          example: '0.6'
          type:
            - string
            - 'null'
        state:
          description: >-
            `submitted`: relayed, waiting for the chain; `confirmed`: done on
            chain, being booked; `booked`: credited (a merge) or debited (a
            split); `failed`: nothing happened on chain (see `failure_reason`).
          enum:
            - submitted
            - confirmed
            - booked
            - failed
          example: booked
          type: string
        tx_id:
          example: 0x9f2c…
          type:
            - string
            - 'null'
        waiting_on:
          description: >-
            While `confirmed`: what booking waits for (the market finishing
            settlement, a sale of these tokens still confirming, or an earlier
            wallet movement being booked). It clears by itself.
          enum:
            - settling
            - inflight
            - settlement_rows
            - funding
          example: null
          type:
            - string
            - 'null'
      required:
        - id
        - kind
        - custody
        - state
        - market_id
        - market
        - pairs
        - proceeds
        - realized_pnl
        - tx_id
        - failure_reason
        - waiting_on
        - created_at
        - booked_at
      type: object
    ErrorEntity:
      properties:
        errors:
          description: Match on the code, not the HTTP status or the human text.
          example:
            - market.order.insufficient_balance
          items:
            type: string
          type: array
      required:
        - errors
      type: object
    PositionMergeMarketEntity:
      properties:
        event_slug:
          example: btc-updown-5m-1730
          type:
            - string
            - 'null'
        event_title:
          example: Bitcoin Up or Down 5m
          type:
            - string
            - 'null'
        id:
          example: 14738
          type:
            - number
            - 'null'
        outcome_labels:
          description: The market's labels for its two outcomes, `[yes, no]`.
          example:
            - 'Yes'
            - 'No'
          items:
            type: string
          type: array
        title:
          example: Will BTC close above its open?
          type:
            - string
            - 'null'
      required:
        - id
        - title
        - event_slug
        - event_title
        - outcome_labels
      type: object
  securitySchemes:
    apiKey:
      description: >-
        HMAC-signed API key. Send X-Auth-Apikey, X-Auth-Nonce and
        X-Auth-Signature.
      in: header
      name: X-Auth-Apikey
      type: apiKey

````

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