Skip to content

Connect Quote

POST /connect/quote

Prices a Cantex Connect swap before you send it. The response tells you how much of the buy token to expect, the fees, the route through the pools, and — most importantly — the exact memo string to include in your Canton transfer.

The typical integration flow is:

  1. Look up the instrument_id / instrument_admin pairs for your sell and buy tokens via /tokens/info.
  2. POST /connect/quote with the amount you want to sell.
  3. Send a standard Canton transfer of the sell token to the Cantex swap address (see Connect), using the memo from the quote response.
  4. The swap executes atomically and the output lands back in your wallet, typically within 10–15 seconds.

Request

curl -sS -X POST "https://api.testnet.cantex.io/v1/public/connect/quote" \
  -H "Content-Type: application/json" \
  -d '{
    "sellAmount": "100",
    "sellInstrumentId": "Amulet",
    "sellInstrumentAdmin": "DSO::1220f22a8b8f2d813c25b9a684dc4dd52b532a0174d8e73a13cdf2baabfff7518337",
    "buyInstrumentId": "USDCx",
    "buyInstrumentAdmin": "decentralized-usdc-interchain-rep::122049e2af8a725bd19759320fc83c638e7718973eac189d8f201309c512d1ffec61"
  }'
Field Type Required Description
sellAmount string Yes Amount of the sell token, as a decimal string. Must be greater than 0.
sellInstrumentId string Yes Instrument ID of the token you are selling.
sellInstrumentAdmin string Yes Instrument admin party of the token you are selling.
buyInstrumentId string Yes Instrument ID of the token you want to receive.
buyInstrumentAdmin string Yes Instrument admin party of the token you want to receive.
affiliateCode string No Optional affiliate/referral code. When present it is appended to the returned memo (truncated to 20 characters).

Warning

The minimum Connect swap size is 50 CC, or the equivalent value in other instruments. Smaller quotes are rejected. The current minimum is published as policy.min_connect_swap_amount_size_cc in /exchange/info.

Danger

The MOD token is not supported for Connect swaps. Quote requests selling MOD are rejected — and do not send us MOD tokens.

Response

The response contains the full pricing breakdown. The fields you need for the integration are returned (the expected output) and memo (what to put in your transfer's memo field):

{
  "sent": {
    "sell_instrument_id": "Amulet",
    "sell_instrument_admin": "DSO::1220f22a8b8f2d813c25b9a684dc4dd52b532a0174d8e73a13cdf2baabfff7518337",
    "buy_instrument_id": "USDCx",
    "buy_instrument_admin": "decentralized-usdc-interchain-rep::122049e2af8a725bd19759320fc83c638e7718973eac189d8f201309c512d1ffec61",
    "sell_amount": "100",
    "affiliate_code": null
  },
  "prices": {
    "trade": "0.1230000000",
    "trade_no_fees": "0.1234000000",
    "pool_before": "0.1235000000",
    "pool_after": "0.1232000000",
    "slippage": "0.0008000000"
  },
  "fees": {
    "network_fee": {
      "instrument_admin": "DSO::1220f22a8b8f2d813c25b9a684dc4dd52b532a0174d8e73a13cdf2baabfff7518337",
      "instrument_id": "Amulet",
      "amount": "2"
    },
    "fee_percentage": "0.0030000000",
    "instrument_id": "Amulet",
    "instrument_admin": "DSO::1220f22a8b8f2d813c25b9a684dc4dd52b532a0174d8e73a13cdf2baabfff7518337",
    "amount_admin": "0.1000000000",
    "amount_liquidity": "0.2000000000"
  },
  "pools": [
    {
      "pool_id": "…",
      "contract_id": "…",
      "sell": {
        "instrument_id": "Amulet",
        "instrument_admin": "DSO::1220…",
        "amount": "100.0000000000"
      },
      "buy": {
        "instrument_id": "USDCx",
        "instrument_admin": "decentralized-usdc-interchain-rep::1220…",
        "amount": "12.3000000000"
      },
      "prices": { "…": "…" },
      "fees": { "…": "…" },
      "size": { "…": "…" }
    }
  ],
  "returned": {
    "instrument_id": "USDCx",
    "instrument_admin": "decentralized-usdc-interchain-rep::122049e2af8a725bd19759320fc83c638e7718973eac189d8f201309c512d1ffec61",
    "amount": "12.3000000000"
  },
  "trade_price": "0.1230000000",
  "slippage": "0.0008000000",
  "pool_price_before_trade": "0.1235000000",
  "pool_price_after_trade": "0.1232000000",
  "pool_size": { "…": "…" },
  "estimated_time_seconds": "10.00",
  "memo": "USDCx"
}

Key fields:

  • returned — the token and amount you can expect back in your wallet, net of all fees.
  • memo — the memo string to include in your Canton transfer. It is the buy instrument ID, plus ref:<affiliateCode> when an affiliate code was supplied (e.g. "USDCx ref:mycode").
  • prices — effective trade price with and without fees, the pool price before and after the trade, and the resulting slippage (as a fraction).
  • fees.network_fee — the fixed Connect network fee in CC.
  • fees.fee_percentage — the total percentage fee for the swap (as a fraction): the pool fee rates across the route plus the Connect fee.
  • pools — the route taken. A direct swap uses one pool; a cross (e.g. CETH → CC → USDCx) uses two, and each entry shows the sell/buy amounts through that hop.
  • estimated_time_seconds — estimated time for the swap to complete.

Info

Quotes are indicative. Connect quotes are computed from current pool liquidity but are not reserved or persisted — the swap executes at the pool prices in effect when your transfer arrives. Re-quote shortly before sending, especially for larger sizes.

Fees

Connect swaps currently pay a fixed network fee of 2 CC plus a 0.20% Connect fee, in addition to the per-pool swap fees. The response's fees.fee_percentage is the combined percentage (pool fees + Connect fee), and all fees are already reflected in the returned amount — the quote is net of everything. Fee values can change; treat the quote response as the source of truth.

Errors

Status Body Cause
400 { "error": "missing sellAmount" } A required field is missing (the message names the field).
400 { "error": "invalid sellAmount" } sellAmount is not a positive decimal string.
400 { "error": "MOD is not supported for connect swaps" } Selling MOD is not supported.
400 { "error": "minimum ticket size is 50 CC, or equivalent in other instruments" } The swap is below the Connect minimum.
404 { "error": "instrument not found in pool" } No route exists between the sell and buy tokens.
404 { "error": "no pools found" } No pools are currently available.

Other quote failures (for example insufficient liquidity for the requested size) return 4xx with a descriptive error message in the same shape.