Skip to content

Get Mid Prices

Retrieve the current mid prices for all available markets. Mid prices represent the midpoint between the best bid and best ask prices, providing a simple reference price for each market.

Endpoint

POST https://papi.synthetix.io/v1/info

Request

Request Format

{
  "action": "getMids"
}

Request Parameters

ParameterTypeRequiredDescription
actionstringYesMust be "getMids"

Response

Response Structure

FieldTypeDescription
statusstringAlways "ok" for successful requests or "error" for failures
responseobjectMap of market symbols to mid prices (omitted when status is "error")
errorobjectError details (only present when status is "error")
request_idstringRequest tracking identifier
timestampstringRFC3339 timestamp

Success Response

{
  "status": "ok",
  "response": {
    "BTC-USDT": "45025.37500000",
    "ETH-USDT": "2845.12500000",
    "SOL-USDT": "98.75000000",
    "AVAX-USDT": "35.50000000"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Response Fields

FieldTypeDescription
{symbol}stringMid price for the specified market symbol as a decimal string

Error Response

{
  "status": "error",
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "Could not pull market configuration"
  },
  "request_id": "5ccf215d37e3ae6d",
  "timestamp": "2025-01-01T00:00:00Z"
}

Implementation Notes

  • Returns mid prices for all available markets in a single request
  • Mid price is calculated from the latest price feed data
  • Prices are returned as decimal strings to preserve precision
  • No filtering or symbol selection - all markets are always returned
  • For real-time mid price updates, use the marketPriceUpdates WebSocket subscription
  • For comprehensive price data (mark, index, best bid/ask, etc.), use getMarketPrices

Use Cases

Use CaseDescription
Price OverviewQuick snapshot of current prices across all markets
Initial LoadBootstrap client-side price data before subscribing to updates
ReconciliationVerify client price cache against server state
Simple DisplaysShow reference prices without full market data

Comparison with Other Price Endpoints

EndpointData ReturnedUse Case
getMidsSimple mid prices onlyQuick price snapshot
getMarketPricesMark, index, last, bid/ask, funding, volume, OIComprehensive market data
marketPriceUpdatesReal-time price updatesLive price tracking

Error Handling

Common error scenarios:

ErrorDescription
Could not pull market configurationFailed to retrieve list of available markets
Could not get mid priceFailed to retrieve price data for one or more markets
Internal errorServer-side processing error

Example Usage

JavaScript/TypeScript

const response = await fetch('https://papi.synthetix.io/v1/info', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    action: 'getMids'
  })
});
 
const data = await response.json();
 
if (data.status === 'ok') {
  const midPrices = data.response;
  console.log('BTC mid price:', midPrices['BTC-USDT']);
  console.log('ETH mid price:', midPrices['ETH-USDT']);
} else {
  console.error('Error:', data.error);
}

Python

import requests
 
response = requests.post(
    'https://papi.synthetix.io/v1/info',
    json={'action': 'getMids'}
)
 
data = response.json()
 
if data['status'] == 'ok':
    mid_prices = data['response']
    print(f"BTC mid price: {mid_prices['BTC-USDT']}")
    print(f"ETH mid price: {mid_prices['ETH-USDT']}")
else:
    print(f"Error: {data['error']}")

cURL

curl -X POST https://papi.synthetix.io/v1/info \
  -H "Content-Type: application/json" \
  -d '{"action": "getMids"}'