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/infoRequest
Request Format
{
"action": "getMids"
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Must be "getMids" |
Response
Response Structure
| Field | Type | Description |
|---|---|---|
status | string | Always "ok" for successful requests or "error" for failures |
response | object | Map of market symbols to mid prices (omitted when status is "error") |
error | object | Error details (only present when status is "error") |
request_id | string | Request tracking identifier |
timestamp | string | RFC3339 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
| Field | Type | Description |
|---|---|---|
{symbol} | string | Mid 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
marketPriceUpdatesWebSocket subscription - For comprehensive price data (mark, index, best bid/ask, etc.), use
getMarketPrices
Use Cases
| Use Case | Description |
|---|---|
| Price Overview | Quick snapshot of current prices across all markets |
| Initial Load | Bootstrap client-side price data before subscribing to updates |
| Reconciliation | Verify client price cache against server state |
| Simple Displays | Show reference prices without full market data |
Comparison with Other Price Endpoints
| Endpoint | Data Returned | Use Case |
|---|---|---|
| getMids | Simple mid prices only | Quick price snapshot |
getMarketPrices | Mark, index, last, bid/ask, funding, volume, OI | Comprehensive market data |
marketPriceUpdates | Real-time price updates | Live price tracking |
Error Handling
Common error scenarios:
| Error | Description |
|---|---|
| Could not pull market configuration | Failed to retrieve list of available markets |
| Could not get mid price | Failed to retrieve price data for one or more markets |
| Internal error | Server-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"}'