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

# Sell an RWA yield token

> Sell an RWA yield token, or redeem from an IXS managed vault, back to a
stablecoin.

Set `token_in` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`) or to an IXS
**vault address**. A Midas redemption is instant and settles in the same
transaction; an IXS redemption is **asynchronous** — it files a
`requestRedeem` (`settlement: async`) the vault operator settles off-chain
later, so poll `GET /v2/tokenized_assets/redemptions` for status. The
transaction executes inside the product account (owner signs, or EIP-712 with
`gas_sponsorship`).



## OpenAPI

````yaml /v2/combined_spec.json post /v2/tokenized_assets/transact/sell
openapi: 3.1.0
info:
  title: Compass API
  description: Compass Labs DeFi API
  version: 0.0.1
servers:
  - url: https://api.compasslabs.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v2/tokenized_assets/transact/sell:
    post:
      tags:
        - Tokenized Assets
      summary: Sell an RWA yield token
      description: >-
        Sell an RWA yield token, or redeem from an IXS managed vault, back to a

        stablecoin.


        Set `token_in` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`) or to an
        IXS

        **vault address**. A Midas redemption is instant and settles in the same

        transaction; an IXS redemption is **asynchronous** — it files a

        `requestRedeem` (`settlement: async`) the vault operator settles
        off-chain

        later, so poll `GET /v2/tokenized_assets/redemptions` for status. The

        transaction executes inside the product account (owner signs, or EIP-712
        with

        `gas_sponsorship`).
      operationId: v2_tokenized_assets_transact_sell
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenizedAssetsTradeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenizedAssetsTradeResponse'
        '422':
          description: >-
            The tokenized-asset side of the trade is not a Midas RWA asset on
            the requested network, or the stablecoin is not accepted by the
            Midas vault. Equities trade via the order endpoints.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenizedAssetsErrorResponse'
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from compass_api_sdk import CompassAPI, models


            with CompassAPI(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as compass_api:

                res = compass_api.tokenized_assets.tokenized_assets_transact_sell(token_in="<value>", token_out="<value>", amount_in=8512.47, owner="<value>", chain=models.Chain.ARBITRUM, slippage="0.5", gas_sponsorship=False, fee={
                    "recipient": "<value>",
                    "amount": 3839.45,
                    "denomination": models.TokenizedAssetsFeeDenomination.PERCENTAGE,
                })

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { CompassApiSDK } from "@compass-labs/api-sdk";

            const compassApiSDK = new CompassApiSDK({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await compassApiSDK.tokenizedAssets.tokenizedAssetsTransactSell({
                tokenIn: "<value>",
                tokenOut: "<value>",
                amountIn: 8512.47,
                slippage: "0.5",
                owner: "<value>",
                chain: "arbitrum",
                gasSponsorship: false,
                fee: {
                  recipient: "<value>",
                  amount: 3839.45,
                  denomination: "PERCENTAGE",
                },
              });

              console.log(result);
            }

            run();
components:
  schemas:
    TokenizedAssetsTradeRequest:
      properties:
        token_in:
          type: string
          title: Token
          description: >-
            Token to spend. For a buy this must be a stablecoin the Midas
            issuance vault accepts (USDC on every supported network; mBASIS also
            accepts USDT/DAI on Ethereum). For a sell it is the Midas RWA asset
            to redeem (e.g. 'mTBILL').
          examples:
            - USDC
            - mTBILL
        token_out:
          type: string
          title: Token
          description: >-
            Token to receive. For a buy this is the Midas RWA asset to mint
            (e.g. 'mTBILL'); for a sell it is the payout stablecoin (USDC).
          examples:
            - mTBILL
            - USDC
        amount_in:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Amount In
          description: Human-readable amount of `token_in` to trade (token units, not wei).
          examples:
            - 500
        slippage:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Slippage
          description: Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
          default: '0.5'
          examples:
            - 0.5
        owner:
          type: string
          title: Owner
          description: The owner's wallet address.
        chain:
          $ref: '#/components/schemas/Chain'
          description: Network to trade on. Midas RWA assets exist on Ethereum and Base.
        gas_sponsorship:
          type: boolean
          title: Gas Sponsorship
          description: >-
            When true, returns an EIP-712 payload for gas-sponsored execution
            instead of an unsigned transaction.
          default: false
        fee:
          anyOf:
            - $ref: '#/components/schemas/TokenizedAssetsFee'
            - type: 'null'
          description: >-
            Optional partner fee charged when selling (exiting). It is taken
            from the payout-token (USDC) proceeds and sent to your fee recipient
            inside the same execution.
      type: object
      required:
        - token_in
        - token_out
        - amount_in
        - owner
        - chain
      title: TokenizedAssetsTradeRequest
      description: |-
        Buy or sell a swap-traded tokenized asset inside the product account.

        Applies to RWA yield assets (Midas mTokens). Equities trade via the
        order endpoints instead.
      example:
        amount_in: '500'
        chain: ethereum
        gas_sponsorship: false
        owner: '0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B'
        slippage: '0.5'
        token_in: USDC
        token_out: mTBILL
    TokenizedAssetsTradeResponse:
      properties:
        transaction:
          anyOf:
            - $ref: '#/components/schemas/UnsignedTransaction'
            - type: 'null'
          description: Unsigned transaction executing the trade in the product account.
        eip_712:
          anyOf:
            - $ref: '#/components/schemas/BatchedSafeOperationsResponse-Output'
            - type: 'null'
          description: EIP-712 payload for gas-sponsored execution.
        estimated_amount_out:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Estimated Amount Out
          description: Estimated amount of `token_out` received (human-readable units).
        fee_amount:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Fee Amount
          description: >-
            Fee charged on the sell, in payout-token (USDC) units. Null when no
            fee was applied.
        settlement:
          type: string
          enum:
            - instant
            - async
          title: Settlement
          description: >-
            How the trade settles. `instant`: the signed transaction completes
            the trade (Midas/Ondo swaps and IXS deposits). `async`: the
            transaction only *requests* an IXS redemption, which the vault
            operator settles off-chain later — poll `poll_endpoint` for status.
          default: instant
        poll_endpoint:
          anyOf:
            - type: string
            - type: 'null'
          title: Poll Endpoint
          description: >-
            For `async` settlements, the endpoint to poll for redemption status
            (`GET /v2/tokenized_assets/redemptions`). Null for instant trades.
      type: object
      required:
        - estimated_amount_out
      title: TokenizedAssetsTradeResponse
      description: |-
        Unsigned trade execution for the owner to sign.

        Exactly one of `transaction` (gas_sponsorship=false) or `eip_712`
        (gas_sponsorship=true) is set.
    TokenizedAssetsErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: >-
            Short human-readable error label (e.g. `Market not found.`,
            `Insufficient liquidity`, `Order not found.`).
        message:
          type: string
          title: Message
          description: Human-readable explanation.
      type: object
      required:
        - error
        - message
      title: TokenizedAssetsErrorResponse
      description: >-
        Standard error envelope returned by every non-2xx response.


        Surfaced in OpenAPI ``responses`` declarations so SDK consumers can
        decode

        failures uniformly without inspecting per-status-code shapes.
    Chain:
      type: string
      enum:
        - base
        - ethereum
        - arbitrum
        - hyperevm
        - tempo
        - bsc
      title: Chain
      description: The chain to use.
    TokenizedAssetsFee:
      properties:
        recipient:
          type: string
          title: Recipient
          description: The wallet address that will receive the fee.
          examples:
            - '0xb8340945eBc917D2Aa0368a5e4E79C849c461511'
        amount:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Amount
          description: >-
            The fee amount. If `denomination` is 'PERCENTAGE', this is a
            percentage of the transaction amount (e.g., 1.5 for 1.5%). If
            `denomination` is 'FIXED', this is a fixed amount in token units
            (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this
            is a percentage of realized profit calculated using FIFO cost basis
            (e.g., 10 for 10% of profit).
          examples:
            - 1.5
            - 0.1
            - 10
        denomination:
          type: string
          enum:
            - PERCENTAGE
            - FIXED
          title: Denomination
          description: >-
            The unit type for the fee amount. Use 'PERCENTAGE' for a
            percentage-based fee (e.g., 1.5 means 1.5% of the trade proceeds),
            or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens).
          default: PERCENTAGE
          examples:
            - PERCENTAGE
            - FIXED
      additionalProperties: false
      type: object
      required:
        - recipient
        - amount
      title: TokenizedAssetsFee
      description: >-
        Fee configuration for tokenized-asset trades.


        Same shape as `Fee`, but narrows `denomination` to the values supported
        by

        tokenized-asset trades. PERFORMANCE is not supported because
        realized-profit

        fees are not computed for spot buy/sell trades.
    UnsignedTransaction:
      properties:
        chainId:
          type: string
          title: Chainid
          description: The chain id of the transaction
        data:
          type: string
          title: Data
          description: The data of the transaction
        from:
          type: string
          title: From
          description: The sender of the transaction
        gas:
          anyOf:
            - type: string
            - type: 'null'
          title: Gas
          description: The gas of the transaction
        to:
          type: string
          title: To
          description: The recipient of the transaction
        value:
          type: string
          title: Value
          description: The value of the transaction
        nonce:
          type: string
          title: Nonce
          description: The nonce of the address
        maxFeePerGas:
          type: string
          title: Maxfeepergas
          description: The max fee per gas of the transaction
        maxPriorityFeePerGas:
          type: string
          title: Maxpriorityfeepergas
          description: The max priority fee per gas of the transaction
      type: object
      required:
        - chainId
        - data
        - from
        - gas
        - to
        - value
        - nonce
        - maxFeePerGas
        - maxPriorityFeePerGas
      title: UnsignedTransaction
      example:
        chainId: '0x2105'
        data: >-
          0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d
        from: '0x4A83b4413CF41C3244027e1590E35a0F48403F0c'
        gas: '0x7a120'
        maxFeePerGas: '0x59682f00'
        maxPriorityFeePerGas: '0x3b9aca00'
        nonce: '0x5'
        to: '0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67'
        value: '0x0'
    BatchedSafeOperationsResponse-Output:
      properties:
        domain:
          $ref: >-
            #/components/schemas/compass__api_backend__v2__models__safe__transact__response__batched_safe_operations__EIP712Domain
          description: EIP-712 domain separator
        types:
          $ref: >-
            #/components/schemas/compass__api_backend__v2__models__safe__transact__response__batched_safe_operations__EIP712Types
          description: EIP-712 type definitions
        primaryType:
          type: string
          const: SafeTx
          title: Primarytype
          description: Primary type for the structured data
        message:
          $ref: '#/components/schemas/SafeTxMessage'
          description: Safe transaction message data
      type: object
      required:
        - domain
        - types
        - primaryType
        - message
      title: BatchedSafeOperationsResponse
      description: Response containing EIP-712 typed data for Safe transaction signing.
      example:
        domain:
          chainId: 8453
          verifyingContract: '0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1'
        message:
          baseGas: '0'
          data: >-
            0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020
          gasPrice: '0'
          gasToken: '0x0000000000000000000000000000000000000000'
          nonce: '7'
          operation: 1
          refundReceiver: '0x0000000000000000000000000000000000000000'
          safeTxGas: '0'
          to: '0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA'
          value: '0'
        primaryType: SafeTx
        types:
          EIP712Domain:
            - name: chainId
              type: uint256
            - name: verifyingContract
              type: address
          SafeTx:
            - name: to
              type: address
            - name: value
              type: uint256
            - name: data
              type: bytes
            - name: operation
              type: uint8
            - name: safeTxGas
              type: uint256
            - name: baseGas
              type: uint256
            - name: gasPrice
              type: uint256
            - name: gasToken
              type: address
            - name: refundReceiver
              type: address
            - name: nonce
              type: uint256
    compass__api_backend__v2__models__safe__transact__response__batched_safe_operations__EIP712Domain:
      properties:
        chainId:
          type: integer
          title: Chainid
          description: Chain ID
        verifyingContract:
          type: string
          title: Verifyingcontract
          description: Address of the Product Account
      type: object
      required:
        - chainId
        - verifyingContract
      title: EIP712Domain
      description: The EIP-712 domain separator.
    compass__api_backend__v2__models__safe__transact__response__batched_safe_operations__EIP712Types:
      properties:
        EIP712Domain:
          items:
            $ref: '#/components/schemas/EIP712DomainField'
          type: array
          title: Eip712Domain
          description: EIP712Domain type definition
        SafeTx:
          items:
            $ref: '#/components/schemas/SafeTxField'
          type: array
          title: Safetx
          description: SafeTx type definition
      type: object
      required:
        - EIP712Domain
        - SafeTx
      title: EIP712Types
      description: The type definitions for EIP-712 structured data.
    SafeTxMessage:
      properties:
        to:
          type: string
          title: To
          description: Destination address
        value:
          type: string
          title: Value
          description: Value in wei as a string
        data:
          type: string
          title: Data
          description: Transaction data as hex string
        operation:
          $ref: '#/components/schemas/OperationType'
          description: Operation type (0=Call, 1=DelegateCall)
        safeTxGas:
          type: string
          title: Safetxgas
          description: Gas for the transaction
        baseGas:
          type: string
          title: Basegas
          description: Base gas costs
        gasPrice:
          type: string
          title: Gasprice
          description: Gas price
        gasToken:
          type: string
          title: Gastoken
          description: Token address for gas payment
        refundReceiver:
          type: string
          title: Refundreceiver
          description: Address to receive gas refund
        nonce:
          type: string
          title: Nonce
          description: Transaction nonce
      type: object
      required:
        - to
        - value
        - data
        - operation
        - safeTxGas
        - baseGas
        - gasPrice
        - gasToken
        - refundReceiver
        - nonce
      title: SafeTxMessage
      description: The message data for the transaction.
    EIP712DomainField:
      properties:
        name:
          type: string
          title: Name
        type:
          type: string
          title: Type
      type: object
      required:
        - name
        - type
      title: EIP712DomainField
      description: A field in the EIP712Domain type definition.
    SafeTxField:
      properties:
        name:
          type: string
          title: Name
        type:
          type: string
          title: Type
      type: object
      required:
        - name
        - type
      title: SafeTxField
      description: A field in the SafeTx type definition.
    OperationType:
      type: integer
      enum:
        - 0
        - 1
      title: OperationType
      description: Safe operation types.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````