Skip to main content
POST
/
api
/
conversion
/
%TOKEN1
/
%TOKEN2
Token Conversion
curl --request POST \
  --url https://api.example.com/api/conversion/%TOKEN1/%TOKEN2 \
  --header 'Content-Type: application/json' \
  --data '
{
  "amount": "<string>"
}
'
{
  "operationId": "<string>",
  "status": "<string>",
  "type": "<string>",
  "side": "<string>",
  "groupId": "<string>",
  "baseId": "<string>",
  "quoteId": "<string>",
  "size": "<string>",
  "filledSize": "<string>",
  "avgPrice": "<string>",
  "creditCurrencyID": "<string>",
  "debitCurrencyID": "<string>",
  "creditAmount": "<string>",
  "netCreditAmount": "<string>",
  "grossCreditAmount": "<string>",
  "debitAmount": "<string>",
  "feeAmount": "<string>",
  "makerFeePercent": "<string>",
  "takerFeePercent": "<string>",
  "execType": "<string>",
  "liquidityProviderType": "<string>",
  "lastFilledAt": "<string>",
  "operation": {
    "id": "<string>",
    "creatorId": "<string>",
    "ownerId": "<string>",
    "openedAt": "<string>",
    "updatedAt": "<string>",
    "closedAt": "<string>",
    "status": "<string>",
    "type": "<string>",
    "fullType": "<string>"
  }
}

Overview

The conversion endpoint allows you to swap one cryptocurrency token for another. The platform automatically handles routing, fee calculation, and order execution through the trading engine.

Endpoint

POST /api/conversion/{tokenFrom}/{tokenTo}

Path Parameters

tokenFrom
string
required
Source token symbol to convert from (e.g., BTC, ETH, USDC)
tokenTo
string
required
Destination token symbol to convert to (e.g., BTC, ETH, USDT)

Request Body

amount
string
required
Amount of the source token to convert. Must be provided as a string to preserve precision for decimal values.Example: "0.5" for 0.5 BTC

Response

The conversion endpoint returns detailed information about the executed order:
operationId
string
Unique identifier for this conversion operation
status
string
Current status of the conversion (e.g., “FILLED”, “PENDING”, “CANCELLED”)
type
string
Order type (typically “MARKET” for instant conversions)
side
string
Trading side: “BUY” or “SELL”
groupId
string
Trading group identifier
baseId
string
Base currency ID in the trading pair
quoteId
string
Quote currency ID in the trading pair
size
string
Total order size
filledSize
string
Amount of the order that has been filled
avgPrice
string
Average execution price for the conversion
creditCurrencyID
string
Currency ID being credited (destination token)
debitCurrencyID
string
Currency ID being debited (source token)
creditAmount
string
Gross amount credited before fees
netCreditAmount
string
Net amount credited after fees
grossCreditAmount
string
Total credit amount
debitAmount
string
Amount debited from source token
feeAmount
string
Total fee charged for the conversion
makerFeePercent
string
Maker fee percentage applied
takerFeePercent
string
Taker fee percentage applied
execType
string
Execution type identifier
liquidityProviderType
string
Type of liquidity provider used for this conversion
lastFilledAt
string
Timestamp when the order was last filled (ISO 8601 format)
operation
object
Nested operation details
id
string
Operation unique identifier
creatorId
string
User ID who created the operation
ownerId
string
User ID who owns the operation
openedAt
string
Timestamp when operation was opened
updatedAt
string
Timestamp when operation was last updated
closedAt
string
Timestamp when operation was closed (if applicable)
status
string
Operation status
type
string
Operation type
fullType
string
Full operation type descriptor

TypeScript Types

interface PostConversionData {
  operationId: string;
  groupId: string;
  baseId: string;
  quoteId: string;
  limitPrice: string | null;
  type: string;
  side: string;
  status: string;
  size: string;
  lastFilledAt: string | null;
  filledSize: string;
  avgPrice: string | null;
  canceling: boolean;
  makerFeePercent: string;
  takerFeePercent: string;
  execType: string;
  triggeredAt: string | null;
  triggerPrice: string | null;
  triggerPriceHigh: string | null;
  triggerPriceLow: string | null;
  operation: {
    id: string;
    creatorId: string;
    ownerId: string;
    openedAt: string;
    updatedAt: string;
    closedAt: string | null;
    status: string;
    type: string;
    fullType: string;
  };
  baseSize: string | null;
  quoteSize: string | null;
  filledQuoteSize: string;
  creditCurrencyID: string;
  debitCurrencyID: string;
  estCreditAmount: string | null;
  estGrossCreditAmount: string | null;
  estNetCreditAmount: string | null;
  estDebitAmount: string;
  estFeeAmount: string | null;
  creditAmount: string;
  netCreditAmount: string;
  grossCreditAmount: string;
  debitAmount: string;
  feeAmount: string;
  tickSize: number;
  stepSize: number;
  liquidityProviderType: string;
  triggerPriceHighBaseSize: string | null;
  triggerPriceLowBaseSize: string | null;
  triggerPriceHighQuoteSize: string | null;
  triggerPriceLowQuoteSize: string | null;
}

Example Request

curl -X POST https://api.crocante.io/api/conversion/BTC/ETH \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "0.1"
  }'

Example Response

{
  "data": {
    "operationId": "op_abc123xyz",
    "groupId": "main",
    "baseId": "BTC",
    "quoteId": "ETH",
    "limitPrice": null,
    "type": "MARKET",
    "side": "SELL",
    "status": "FILLED",
    "size": "0.1",
    "lastFilledAt": "2026-03-12T10:30:45.123Z",
    "filledSize": "0.1",
    "avgPrice": "16.234",
    "canceling": false,
    "makerFeePercent": "0.1",
    "takerFeePercent": "0.2",
    "execType": "TAKER",
    "triggeredAt": null,
    "triggerPrice": null,
    "triggerPriceHigh": null,
    "triggerPriceLow": null,
    "operation": {
      "id": "op_abc123xyz",
      "creatorId": "user_123",
      "ownerId": "user_123",
      "openedAt": "2026-03-12T10:30:45.000Z",
      "updatedAt": "2026-03-12T10:30:45.123Z",
      "closedAt": "2026-03-12T10:30:45.123Z",
      "status": "CLOSED",
      "type": "CONVERSION",
      "fullType": "MARKET_CONVERSION"
    },
    "baseSize": "0.1",
    "quoteSize": null,
    "filledQuoteSize": "1.623",
    "creditCurrencyID": "ETH",
    "debitCurrencyID": "BTC",
    "estCreditAmount": "1.623",
    "estGrossCreditAmount": "1.623",
    "estNetCreditAmount": "1.6197",
    "estDebitAmount": "0.1",
    "estFeeAmount": "0.0033",
    "creditAmount": "1.623",
    "netCreditAmount": "1.6197",
    "grossCreditAmount": "1.623",
    "debitAmount": "0.1",
    "feeAmount": "0.0033",
    "tickSize": 0.001,
    "stepSize": 0.0001,
    "liquidityProviderType": "INTERNAL",
    "triggerPriceHighBaseSize": null,
    "triggerPriceLowBaseSize": null,
    "triggerPriceHighQuoteSize": null,
    "triggerPriceLowQuoteSize": null
  },
  "status": 200
}

Conversion Flow

  1. Get Quote: First call the Quote endpoint to get current pricing
  2. Verify Pair: Ensure the token pair is supported via Trading Pairs
  3. Execute Conversion: Submit the conversion with your desired amount
  4. Receive Confirmation: The response includes final amounts, fees, and execution details
  5. Portfolio Update: User’s portfolio balances are automatically updated

Important Notes

  • All numeric values are returned as strings to preserve precision
  • Conversions execute as market orders for immediate settlement
  • Fees are automatically calculated based on maker/taker fee percentages
  • The netCreditAmount reflects the actual amount received after fees
  • Quote prices refresh every 5 minutes (300,000ms) by default
  • Successful conversions automatically invalidate portfolio cache to reflect updated balances

Supported Tokens

See the Trading Pairs endpoint for a complete list of supported token conversions.

Build docs developers (and LLMs) love