Docs · Reference
HTTP API
Every route of the Mesa API with its parameters, request body and response fields, the error envelope, and the batch event stream.
The Mesa API serves what the chain shows of Mesa in a form a page or a script can read directly: markets, pools, perp markets, vaults and batches. It also serves the encrypted notes a client decrypts, relays transactions as fee payer, and takes watcher enrolments. It holds no key that opens an account.
Everything it serves can also be read from Solana and a Privacy Rings indexer. See Reading Mesa without Mesa.
Conventions
Paths are relative to https://api.mesa.markets. GET /openapi.json returns this contract as an OpenAPI 3.1 document, and GET /health returns the contract version the server speaks.
| Kind of value | How it is sent |
|---|---|
| Amount | An unsigned integer string in the asset's smallest unit. A change in a total is a signed integer string. |
| Price, rate, ratio | A decimal string. Funding rates and percentage changes are signed. |
| Basis points | An integer from 0 to 10000. A rate that is not set yet is null. |
| Time | An ISO 8601 timestamp in UTC. |
| Address, signature | Base58. |
| Bytes | Base64. |
| Identifier | A market, pool, perp market or vault id: letters, digits, _ and -. |
Requests are strict: an unknown field or enum value is refused with VALIDATION_ERROR. Responses are open: a client ignores fields and enum values it does not know.
Paging. Lists of batches and opened orders take cursor and limit and return page.nextCursor and page.hasMore. Pass nextCursor back as cursor for the next page. Note routes page by slot, with paginationToken.
Idempotency. Every route that sends a transaction takes an idempotencyKey of 8 to 128 characters. Sending the same request again with the same key returns the first result and sends nothing twice.
Errors
Every failed response has one shape.
{
"error": {
"code": "BATCH_CLOSED",
"message": "This batch is already closed and no longer accepts sealed actions.",
"retryable": true,
"stage": "validation"
}
}| Field | Type | Meaning |
|---|---|---|
code | string | One of the codes below |
message | string | A sentence that can be shown to a person |
retryable | boolean | Whether sending the request again can succeed |
stage | string | Where it failed: validation, auth, read, build, wallet, simulation, send, confirmation |
fieldErrors | object, optional | For VALIDATION_ERROR: the messages per field |
programError | object, optional | The program that refused the transaction: programId, name and number. For the mesa program the name is one of the program's errors. |
retryAfterSeconds | integer, optional | For RATE_LIMITED |
requestId | string, optional | An id to quote when reporting a failure |
| Code | Status | Raised when |
|---|---|---|
VALIDATION_ERROR | 400 | A parameter or body field is missing, unknown or malformed |
UNAUTHORIZED | 401 | The key sent with a watcher request does not match the position's enrolment |
ORIGIN_NOT_ALLOWED | 403 | A browser calls from an origin the API does not serve |
NOT_FOUND | 404 | No such market, pool, vault, batch or transaction |
PROGRAM_UNAVAILABLE | 409 | The API is not connected to the program yet. Retryable. |
CONFIGURATION_REQUIRED | 409 | The route needs a setting the deployment does not have |
IDEMPOTENCY_CONFLICT | 409 | The same transaction was already submitted under another idempotency key |
TRANSACTION_EXPIRED | 409 | The transaction's blockhash expired before it landed. Build it again. |
STALE_BATCH | 409 | The action names a batch that has already passed. The message gives the current batch. |
BATCH_CLOSED | 409 | The action names a batch that is closed. Place it into the current one. |
WALLET_CHANGED | 409 | The signed transaction differs from the one built in a way the API cannot accept, or needs relay mode |
PAYLOAD_TOO_LARGE | 413 | The body exceeds the size limit |
UNSUPPORTED_MEDIA_TYPE | 415 | The body is not JSON |
SIMULATION_FAILED | 422 | The transaction failed in simulation. programError names the refusal. |
CHAIN_REFUSED | 422 | The transaction was sent and the chain refused it. programError names the refusal. |
INVALID_PROOF | 422 | The proof does not verify |
RATE_LIMITED | 429 | Too many requests. Wait retryAfterSeconds. |
INTERNAL_ERROR | 500 | The API failed |
UPSTREAM_UNAVAILABLE | 502 | The RPC or the indexer behind the API did not answer |
PROVER_FAILED | 502 | The prover service did not answer. Retryable. |
The batch event stream
GET /v1/events is a server-sent event stream. It sends an event each time a batch changes state, so a page or a script can follow the clock without polling.
| Parameter | Type | Meaning |
|---|---|---|
market | identifier, query, optional | Only events for this market |
batch | integer, query, optional | Only events for this batch |
| Event | Sent when |
|---|---|
ready | The stream is connected |
batch.opened | A new batch starts taking actions |
batch.sealed | A batch closes |
batch.opening | The batch's actions are being opened |
batch.cleared | Every target of the batch has its result |
batch.settled | Every action of the batch is paid out |
resync | Events may have been missed. Read GET /v1/clock again. |
Each event's data is a JSON object with type, id, timestamp and data. For a batch event data holds at least batchNumber and state.
const apiUrl = 'https://api.mesa.markets'
const events = new EventSource(`${apiUrl}/v1/events`)
events.addEventListener('batch.settled', (e) => {
const { data } = JSON.parse(e.data)
console.log(data.batchNumber)
})Sending a transaction
Two paths lead to the chain.
Relayed. POST /v1/relay takes a Mesa action that needs no wallet signature: everything except a deposit. The client proves the action, assembles the mesa instructions and sends them serialized in instructions. The API refuses instructions for any other program, signs as fee payer, sends the transaction and returns a receipt whose id is followed with GET /v1/transactions/{id}.
Wallet-signed. A deposit, and registering or moving funds in a Rings private wallet, are signed by the person's wallet. POST /v1/transactions/build returns the unsigned transaction, the wallet signs it, and POST /v1/transactions/submit sends it, in relay mode with the signed bytes or in wallet-sent mode with the signature of a transaction the wallet sent itself.
A transaction's status moves through pending, submitted, confirmed and finalized, or ends in failed or expired. A failed status carries error with the stage that failed and, where a program refused it, that program's address and error.
The SDK does all of this behind one call per action.
Service
GET /health
Service health and readiness state.
Response 200:
| Field | Type |
|---|---|
status | live | waiting | fixture |
contractVersion | string |
asOf | timestamp |
GET /v1/config
Protocol, Privacy Rings, drand and fee configuration.
Response 200:
| Field | Type |
|---|---|
cluster | localnet | devnet | mainnet |
mode | fixture | live |
sample | boolean |
programId | string or null |
ringsProgramId | string |
ringsRegistryId | string |
ringsStateTree | string |
mesaAuthority | string or null |
relayer | string or null (optional) |
rpcUrl | string |
indexerUrl | string or null (optional) |
proverUrl | string or null |
drand | object |
drand.chainHash | string |
drand.endpoint | string |
drand.periodSeconds | integer |
drand.genesisTime | integer |
batchLengthSeconds | integer |
heartbeatSeconds | integer |
fees | object |
fees.tradeFeeBps | integer or null |
fees.borrowReserveShareBps | integer or null |
fees.perpOpenFeeBps | integer or null |
fees.perpCloseFeeBps | integer or null |
fees.protocolShareBps | integer or null |
fees.treeFeeLamports | string |
feeRecipient | string or null |
tokenMint | string or null |
paused | boolean |
assets | array of object |
assets[].mint | string |
assets[].symbol | string |
assets[].name | string |
assets[].decimals | integer |
assets[].assetId | integer (optional) |
oracles | object (optional) |
asOf | timestamp |
GET /v1/clock
Current batch number, countdown and drand round.
Response 200:
| Field | Type |
|---|---|
batchNumber | integer |
state | open | sealed | opening | cleared | settled |
openedAt | timestamp |
closesAt | timestamp |
batchLengthSeconds | integer |
drandRound | integer |
sealedActionCount | integer |
serverTime | timestamp |
Spot markets
GET /v1/markets
List spot markets.
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].pair | string |
items[].address | string |
items[].base | object |
items[].base.mint | string |
items[].base.symbol | string |
items[].base.name | string |
items[].base.decimals | integer |
items[].base.assetId | integer (optional) |
items[].quote | object |
items[].quote.mint | string |
items[].quote.symbol | string |
items[].quote.name | string |
items[].quote.decimals | integer |
items[].quote.assetId | integer (optional) |
items[].pricePrecision | integer |
items[].lastClearingPrice | decimal string |
items[].priceChange24hPct | signed decimal string |
items[].volume24hBase | integer string |
items[].volume24hQuote | integer string |
items[].vaultId | string |
items[].vaultDepth | object |
items[].vaultDepth.baseReserve | integer string |
items[].vaultDepth.quoteReserve | integer string |
items[].vaultDepth.totalValueQuote | integer string |
items[].feeBps | integer or null |
items[].nextBatchClosesAt | timestamp |
items[].lastBatchNumber | integer |
items[].status | active | paused |
clock | object |
clock.batchNumber | integer |
clock.state | open | sealed | opening | cleared | settled |
clock.openedAt | timestamp |
clock.closesAt | timestamp |
clock.batchLengthSeconds | integer |
clock.drandRound | integer |
clock.sealedActionCount | integer |
clock.serverTime | timestamp |
asOf | timestamp |
GET /v1/markets/{market}
Spot market details and recent opened orders.
| Parameter | Type |
|---|---|
market | string, path |
Response 200:
| Field | Type |
|---|---|
market | object |
market.id | string |
market.pair | string |
market.address | string |
market.base | object |
market.base.mint | string |
market.base.symbol | string |
market.base.name | string |
market.base.decimals | integer |
market.base.assetId | integer (optional) |
market.quote | object |
market.quote.mint | string |
market.quote.symbol | string |
market.quote.name | string |
market.quote.decimals | integer |
market.quote.assetId | integer (optional) |
market.pricePrecision | integer |
market.lastClearingPrice | decimal string |
market.priceChange24hPct | signed decimal string |
market.volume24hBase | integer string |
market.volume24hQuote | integer string |
market.vaultId | string |
market.vaultDepth | object |
market.vaultDepth.baseReserve | integer string |
market.vaultDepth.quoteReserve | integer string |
market.vaultDepth.totalValueQuote | integer string |
market.feeBps | integer or null |
market.nextBatchClosesAt | timestamp |
market.lastBatchNumber | integer |
market.status | active | paused |
clock | object |
clock.batchNumber | integer |
clock.state | open | sealed | opening | cleared | settled |
clock.openedAt | timestamp |
clock.closesAt | timestamp |
clock.batchLengthSeconds | integer |
clock.drandRound | integer |
clock.sealedActionCount | integer |
clock.serverTime | timestamp |
recentOrders | array of object |
recentOrders[].id | string |
recentOrders[].batchNumber | integer |
recentOrders[].marketId | string |
recentOrders[].side | buy | sell |
recentOrders[].orderType | limit | market |
recentOrders[].amountBase | integer string |
recentOrders[].limitPrice | decimal string or null |
recentOrders[].filledBase | integer string |
recentOrders[].filledQuote | integer string |
recentOrders[].clearingPrice | decimal string |
recentOrders[].status | filled | partially_filled | unfilled |
recentOrders[].settledAt | timestamp |
asOf | timestamp |
GET /v1/markets/{market}/prices
Per-batch clearing price history.
| Parameter | Type |
|---|---|
market | string, path |
beforeBatch | integer, query, optional |
limit | integer, query, optional, default 60 |
Response 200:
| Field | Type |
|---|---|
marketId | string |
pricePrecision | integer |
points | array of object |
points[].batchNumber | integer |
points[].timestamp | timestamp |
points[].clearingPrice | decimal string |
points[].matchedVolumeBase | integer string |
points[].matchedVolumeQuote | integer string |
points[].orderCount | integer |
asOf | timestamp |
GET /v1/markets/{market}/candles
OHLC candles from clearing prices.
| Parameter | Type |
|---|---|
market | string, path |
interval | M1 | M5 | M15 | H1 | H4 | D1, query, optional, default M5 |
from | timestamp, query, optional |
to | timestamp, query, optional |
limit | integer, query, optional, default 120 |
Response 200:
| Field | Type |
|---|---|
marketId | string |
interval | M1 | M5 | M15 | H1 | H4 | D1 |
pricePrecision | integer |
candles | array of object |
candles[].startAt | timestamp |
candles[].open | decimal string |
candles[].high | decimal string |
candles[].low | decimal string |
candles[].close | decimal string |
candles[].volumeBase | integer string |
candles[].volumeQuote | integer string |
candles[].batchCount | integer |
asOf | timestamp |
GET /v1/markets/{market}/orders
Opened orders from recent batches (without owners).
| Parameter | Type |
|---|---|
market | string, path |
cursor | string, query, optional |
limit | integer, query, optional, default 24 |
batchNumber | integer, query, optional |
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].batchNumber | integer |
items[].marketId | string |
items[].side | buy | sell |
items[].orderType | limit | market |
items[].amountBase | integer string |
items[].limitPrice | decimal string or null |
items[].filledBase | integer string |
items[].filledQuote | integer string |
items[].clearingPrice | decimal string |
items[].status | filled | partially_filled | unfilled |
items[].settledAt | timestamp |
page | object |
page.nextCursor | string or null |
page.hasMore | boolean |
asOf | timestamp |
Lending pools
GET /v1/pools
List lending pools.
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].address | string |
items[].vaultId | string |
items[].asset | object |
items[].asset.mint | string |
items[].asset.symbol | string |
items[].asset.name | string |
items[].asset.decimals | integer |
items[].asset.assetId | integer (optional) |
items[].oraclePriceUsd | decimal string |
items[].pricePrecision | integer |
items[].supplyAprPct | decimal string |
items[].borrowAprPct | decimal string |
items[].totalSupplied | integer string |
items[].totalBorrowed | integer string |
items[].availableLiquidity | integer string |
items[].utilizationPct | decimal string |
items[].collateralFactorBps | integer |
items[].liquidationThresholdBps | integer |
items[].liquidationBonusBps | integer |
items[].reserveFactorBps | integer or null |
items[].sharePrice | decimal string |
items[].heartbeatSeconds | integer |
items[].status | active | paused |
asOf | timestamp |
GET /v1/pools/{asset}
Lending pool details and rate history.
| Parameter | Type |
|---|---|
asset | string, path |
Response 200:
| Field | Type |
|---|---|
pool | object |
pool.id | string |
pool.address | string |
pool.vaultId | string |
pool.asset | object |
pool.asset.mint | string |
pool.asset.symbol | string |
pool.asset.name | string |
pool.asset.decimals | integer |
pool.asset.assetId | integer (optional) |
pool.oraclePriceUsd | decimal string |
pool.pricePrecision | integer |
pool.supplyAprPct | decimal string |
pool.borrowAprPct | decimal string |
pool.totalSupplied | integer string |
pool.totalBorrowed | integer string |
pool.availableLiquidity | integer string |
pool.utilizationPct | decimal string |
pool.collateralFactorBps | integer |
pool.liquidationThresholdBps | integer |
pool.liquidationBonusBps | integer |
pool.reserveFactorBps | integer or null |
pool.sharePrice | decimal string |
pool.heartbeatSeconds | integer |
pool.status | active | paused |
history | array of object |
history[].batchNumber | integer |
history[].timestamp | timestamp |
history[].supplyAprPct | decimal string |
history[].borrowAprPct | decimal string |
history[].totalSupplied | integer string |
history[].totalBorrowed | integer string |
history[].utilizationPct | decimal string |
history[].sharePrice | decimal string |
asOf | timestamp |
GET /v1/pools/{asset}/history
Lending pool rate and total history.
| Parameter | Type |
|---|---|
asset | string, path |
limit | integer, query, optional, default 48 |
Response 200:
| Field | Type |
|---|---|
poolId | string |
asset | object |
asset.mint | string |
asset.symbol | string |
asset.name | string |
asset.decimals | integer |
asset.assetId | integer (optional) |
points | array of object |
points[].batchNumber | integer |
points[].timestamp | timestamp |
points[].supplyAprPct | decimal string |
points[].borrowAprPct | decimal string |
points[].totalSupplied | integer string |
points[].totalBorrowed | integer string |
points[].utilizationPct | decimal string |
points[].sharePrice | decimal string |
asOf | timestamp |
Perp markets
GET /v1/perps
List perp markets.
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].name | string |
items[].address | string |
items[].base | object |
items[].base.mint | string |
items[].base.symbol | string |
items[].base.name | string |
items[].base.decimals | integer |
items[].base.assetId | integer (optional) |
items[].quote | object |
items[].quote.mint | string |
items[].quote.symbol | string |
items[].quote.name | string |
items[].quote.decimals | integer |
items[].quote.assetId | integer (optional) |
items[].collateral | object |
items[].collateral.mint | string |
items[].collateral.symbol | string |
items[].collateral.name | string |
items[].collateral.decimals | integer |
items[].collateral.assetId | integer (optional) |
items[].vaultId | string |
items[].oracleAddress | string |
items[].pricePrecision | integer |
items[].oraclePrice | decimal string |
items[].priceChange24hPct | signed decimal string |
items[].fundingRateHourlyPct | signed decimal string |
items[].fundingIndex | signed decimal string |
items[].openInterestLongBase | integer string |
items[].openInterestShortBase | integer string |
items[].openInterestLongQuote | integer string |
items[].openInterestShortQuote | integer string |
items[].vaultSizeQuote | integer string |
items[].maxLeverage | decimal string |
items[].maintenanceMarginBps | integer |
items[].liquidationBonusBps | integer |
items[].openFeeBps | integer or null |
items[].closeFeeBps | integer or null |
items[].heartbeatSeconds | integer |
items[].volume24hQuote | integer string |
items[].status | active | paused |
asOf | timestamp |
GET /v1/perps/{market}
Perp market details.
| Parameter | Type |
|---|---|
market | string, path |
Response 200:
| Field | Type |
|---|---|
market | object |
market.id | string |
market.name | string |
market.address | string |
market.base | object |
market.base.mint | string |
market.base.symbol | string |
market.base.name | string |
market.base.decimals | integer |
market.base.assetId | integer (optional) |
market.quote | object |
market.quote.mint | string |
market.quote.symbol | string |
market.quote.name | string |
market.quote.decimals | integer |
market.quote.assetId | integer (optional) |
market.collateral | object |
market.collateral.mint | string |
market.collateral.symbol | string |
market.collateral.name | string |
market.collateral.decimals | integer |
market.collateral.assetId | integer (optional) |
market.vaultId | string |
market.oracleAddress | string |
market.pricePrecision | integer |
market.oraclePrice | decimal string |
market.priceChange24hPct | signed decimal string |
market.fundingRateHourlyPct | signed decimal string |
market.fundingIndex | signed decimal string |
market.openInterestLongBase | integer string |
market.openInterestShortBase | integer string |
market.openInterestLongQuote | integer string |
market.openInterestShortQuote | integer string |
market.vaultSizeQuote | integer string |
market.maxLeverage | decimal string |
market.maintenanceMarginBps | integer |
market.liquidationBonusBps | integer |
market.openFeeBps | integer or null |
market.closeFeeBps | integer or null |
market.heartbeatSeconds | integer |
market.volume24hQuote | integer string |
market.status | active | paused |
asOf | timestamp |
GET /v1/perps/{market}/prices
Oracle price history and candles for a perp market.
| Parameter | Type |
|---|---|
market | string, path |
interval | M1 | M5 | M15 | H1 | H4 | D1, query, optional, default M5 |
limit | integer, query, optional, default 60 |
Response 200:
| Field | Type |
|---|---|
marketId | string |
pricePrecision | integer |
points | array of object |
points[].timestamp | timestamp |
points[].slot | string |
points[].price | decimal string |
points[].confidence | decimal string |
candles | array of object |
candles[].startAt | timestamp |
candles[].open | decimal string |
candles[].high | decimal string |
candles[].low | decimal string |
candles[].close | decimal string |
candles[].volumeBase | integer string |
candles[].volumeQuote | integer string |
candles[].batchCount | integer |
asOf | timestamp |
Vaults
GET /v1/vaults
List earn vaults.
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].name | string |
items[].address | string |
items[].kind | spot_liquidity | lending_pool | perps_vault |
items[].marketOrPoolId | string |
items[].assets | array of object |
items[].assets[].mint | string |
items[].assets[].symbol | string |
items[].assets[].name | string |
items[].assets[].decimals | integer |
items[].assets[].assetId | integer (optional) |
items[].earnsFrom | string |
items[].apyPct | decimal string |
items[].apy7dPct | decimal string |
items[].totalValueQuote | integer string |
items[].totalShares | integer string |
items[].sharePrice | decimal string |
items[].composition | array of object |
items[].composition[].asset | object |
items[].composition[].asset.mint | string |
items[].composition[].asset.symbol | string |
items[].composition[].asset.name | string |
items[].composition[].asset.decimals | integer |
items[].composition[].asset.assetId | integer (optional) |
items[].composition[].amount | integer string |
items[].composition[].valueQuote | integer string |
items[].composition[].weightPct | decimal string |
items[].status | active | paused |
asOf | timestamp |
GET /v1/vaults/{vault}
Vault details, composition and earnings history.
| Parameter | Type |
|---|---|
vault | string, path |
Response 200:
| Field | Type |
|---|---|
vault | object |
vault.id | string |
vault.name | string |
vault.address | string |
vault.kind | spot_liquidity | lending_pool | perps_vault |
vault.marketOrPoolId | string |
vault.assets | array of object |
vault.assets[].mint | string |
vault.assets[].symbol | string |
vault.assets[].name | string |
vault.assets[].decimals | integer |
vault.assets[].assetId | integer (optional) |
vault.earnsFrom | string |
vault.apyPct | decimal string |
vault.apy7dPct | decimal string |
vault.totalValueQuote | integer string |
vault.totalShares | integer string |
vault.sharePrice | decimal string |
vault.composition | array of object |
vault.composition[].asset | object |
vault.composition[].asset.mint | string |
vault.composition[].asset.symbol | string |
vault.composition[].asset.name | string |
vault.composition[].asset.decimals | integer |
vault.composition[].asset.assetId | integer (optional) |
vault.composition[].amount | integer string |
vault.composition[].valueQuote | integer string |
vault.composition[].weightPct | decimal string |
vault.status | active | paused |
history | array of object |
history[].batchNumber | integer |
history[].timestamp | timestamp |
history[].apyPct | decimal string |
history[].totalValueQuote | integer string |
history[].sharePrice | decimal string |
asOf | timestamp |
Batches
GET /v1/batches
Paged stream of batches (open batch shows count and countdown only).
| Parameter | Type |
|---|---|
cursor | string, query, optional |
limit | integer, query, optional, default 24 |
state | open | sealed | opening | cleared | settled, query, optional |
Response 200:
| Field | Type |
|---|---|
items | array of object, one of 5 shapes |
page | object |
page.nextCursor | string or null |
page.hasMore | boolean |
asOf | timestamp |
GET /v1/batches/{batch}
Single batch record (open batch shows sealed count and countdown only).
| Parameter | Type |
|---|---|
batch | integer, path |
Response 200, by state:
When state is open:
| Field | Type |
|---|---|
batchNumber | integer |
openedAt | timestamp |
closesAt | timestamp |
batchLengthSeconds | integer |
drandRound | integer |
sealedActionCount | integer |
serverTime | timestamp |
When state is sealed or opening:
| Field | Type |
|---|---|
batchNumber | integer |
openedAt | timestamp |
closesAt | timestamp |
batchLengthSeconds | integer |
drandRound | integer |
sealedActionCount | integer |
openedActionCount | integer |
serverTime | timestamp |
When state is cleared or settled:
| Field | Type |
|---|---|
batchNumber | integer |
openedAt | timestamp |
closesAt | timestamp |
clearedAt | timestamp |
settledAt | timestamp or null |
batchLengthSeconds | integer |
drandRound | integer |
sealedActionCount | integer |
openedActionCount | integer |
totalVolumeQuote | integer string |
markets | array of object |
markets[].marketId | string |
markets[].pair | string |
markets[].base | object |
markets[].base.mint | string |
markets[].base.symbol | string |
markets[].base.name | string |
markets[].base.decimals | integer |
markets[].base.assetId | integer (optional) |
markets[].quote | object |
markets[].quote.mint | string |
markets[].quote.symbol | string |
markets[].quote.name | string |
markets[].quote.decimals | integer |
markets[].quote.assetId | integer (optional) |
markets[].pricePrecision | integer |
markets[].clearingPrice | decimal string |
markets[].matchedVolumeBase | integer string |
markets[].matchedVolumeQuote | integer string |
markets[].vaultNetBaseDelta | signed integer string |
markets[].vaultNetQuoteDelta | signed integer string |
markets[].orderCount | integer |
markets[].orders | array of object |
markets[].orders[].id | string |
markets[].orders[].batchNumber | integer |
markets[].orders[].marketId | string |
markets[].orders[].side | buy | sell |
markets[].orders[].orderType | limit | market |
markets[].orders[].amountBase | integer string |
markets[].orders[].limitPrice | decimal string or null |
markets[].orders[].filledBase | integer string |
markets[].orders[].filledQuote | integer string |
markets[].orders[].clearingPrice | decimal string |
markets[].orders[].status | filled | partially_filled | unfilled |
markets[].orders[].settledAt | timestamp |
poolChanges | array of object |
poolChanges[].poolId | string |
poolChanges[].asset | object |
poolChanges[].asset.mint | string |
poolChanges[].asset.symbol | string |
poolChanges[].asset.name | string |
poolChanges[].asset.decimals | integer |
poolChanges[].asset.assetId | integer (optional) |
poolChanges[].suppliedDelta | signed integer string |
poolChanges[].borrowedDelta | signed integer string |
poolChanges[].totalSuppliedAfter | integer string |
poolChanges[].totalBorrowedAfter | integer string |
poolChanges[].sharePriceAfter | decimal string |
vaultChanges | array of object |
vaultChanges[].vaultId | string |
vaultChanges[].kind | spot_liquidity | lending_pool | perps_vault |
vaultChanges[].depositedDelta | signed integer string |
vaultChanges[].withdrawnDelta | signed integer string |
vaultChanges[].totalValueQuoteAfter | integer string |
vaultChanges[].sharePriceAfter | decimal string |
perpChanges | array of object |
perpChanges[].marketId | string |
perpChanges[].oraclePrice | decimal string |
perpChanges[].openInterestLongDelta | signed integer string |
perpChanges[].openInterestShortDelta | signed integer string |
perpChanges[].fundingRateHourlyPct | signed decimal string |
settlementSignatures | array of string |
Notes
GET /v1/notes
Encrypted Mesa notes by view tag, paged by slot cursor.
| Parameter | Type |
|---|---|
tag | string, query, optional |
afterSlot | string, query, optional |
beforeSlot | string, query, optional |
paginationToken | string, query, optional |
limit | integer, query, optional, default 100 |
Response 200:
| Field | Type |
|---|---|
context | object |
context.slot | string |
context.blockTime | integer |
outputTreeId | integer |
viewTag | string |
data | array of object |
data[].slot | string |
data[].signature | string |
data[].blockTime | integer or null |
data[].outputs | array of object |
data[].outputs[].slot | string |
data[].outputs[].txSignature | string |
data[].outputs[].txViewingPk | base64 or null |
data[].outputs[].salt | base64 or null |
data[].outputs[].outputSlot | object |
data[].outputs[].outputSlot.viewTag | string |
data[].outputs[].outputSlot.outputContext | object |
data[].outputs[].outputSlot.payload | base64 |
paginationToken | string or null |
asOf | timestamp |
GET /v1/notes/transactions
Shielded Mesa transactions by view tag, paged by slot cursor.
| Parameter | Type |
|---|---|
tag | string, query, optional |
afterSlot | string, query, optional |
beforeSlot | string, query, optional |
paginationToken | string, query, optional |
limit | integer, query, optional, default 100 |
Response 200:
| Field | Type |
|---|---|
context | object |
context.slot | string |
context.blockTime | integer |
outputTreeId | integer |
viewTag | string |
data | array of object |
data[].slot | string |
data[].signature | string |
data[].blockTime | integer or null |
data[].events | array of object |
data[].events[].slot | string |
data[].events[].txSignature | string |
data[].events[].eventIndex | integer |
data[].events[].txViewingPk | base64 or null |
data[].events[].salt | base64 or null |
data[].events[].outputSlots | array of object |
data[].events[].outputSlots[].viewTag | string |
data[].events[].outputSlots[].outputContext | object |
data[].events[].outputSlots[].payload | base64 |
data[].events[].messages | array of object |
data[].events[].messages[].viewTag | string |
data[].events[].messages[].payload | base64 |
data[].events[].nullifiers | array of string |
data[].events[].proofless | boolean |
data[].events[].ringConfig | string (optional) |
data[].events[].ringProgramId | string (optional) |
paginationToken | string or null |
asOf | timestamp |
POST /v1/notes/merkle-proofs
Merkle inclusion proofs for note commitments.
Request body:
| Field | Type |
|---|---|
treeAccount | string |
leaves | array of string |
Response 200:
| Field | Type |
|---|---|
context | object |
context.slot | string |
context.blockTime | integer |
proofs | array of object |
proofs[].leaf | string |
proofs[].leafIndex | string |
proofs[].merkleContext | object |
proofs[].merkleContext.tree | string |
proofs[].merkleContext.treeType | integer |
proofs[].path | array of string |
proofs[].root | string |
proofs[].rootSeq | string |
proofs[].rootIndex | integer |
asOf | timestamp |
POST /v1/notes/nullifiers
Check which nullifiers have been spent.
Request body:
| Field | Type |
|---|---|
nullifiers | array of string |
Response 200:
| Field | Type |
|---|---|
context | object |
context.slot | string |
context.blockTime | integer |
spent | array of string |
statuses | object |
asOf | timestamp |
Transactions
POST /v1/relay
Relay a wallet-less Mesa action as fee payer.
Request body:
| Field | Type |
|---|---|
action | place_order | reclaim | supply | redeem | borrow | repay | renew | close_position | perp_open | perp_close | perp_add_collateral | perp_remove_collateral | vault_deposit | vault_withdraw | withdraw | consolidate | liquidate |
batchNumber | integer (optional) |
marketId | string (optional) |
proofBytes | base64 (optional) |
sppTransactData | base64 (optional) |
publicInputs | base64 (optional) |
timelockCiphertext | base64 (optional) |
instructions | array of object (optional) |
instructions[].programId | string |
instructions[].accounts | array of object |
instructions[].accounts[].pubkey | string |
instructions[].accounts[].isSigner | boolean |
instructions[].accounts[].isWritable | boolean |
instructions[].dataBase64 | base64 |
computeUnitLimit | integer (optional) |
priorityFeeMicroLamports | string (optional) |
idempotencyKey | string |
Response 201:
| Field | Type |
|---|---|
id | string |
action | place_order | reclaim | supply | redeem | borrow | repay | renew | close_position | perp_open | perp_close | perp_add_collateral | perp_remove_collateral | vault_deposit | vault_withdraw | withdraw | consolidate | liquidate |
status | pending | submitted | unconfirmed | confirmed | finalized | failed | expired |
signature | string (optional) |
batchNumber | integer or null |
submittedAt | timestamp |
POST /v1/transactions/build
Build an unsigned v0 transaction for wallet-signed deposit or registration.
Request body:
| Field | Type |
|---|---|
kind | rings_register | rings_deposit | rings_withdraw | mesa_deposit |
wallet | string |
assetMint | string (optional) |
amount | string (optional) |
proofBytes | base64 (optional) |
sppTransactData | base64 (optional) |
publicInputs | base64 (optional) |
instructions | array of object (optional) |
instructions[].programId | string |
instructions[].accounts | array of object |
instructions[].accounts[].pubkey | string |
instructions[].accounts[].isSigner | boolean |
instructions[].accounts[].isWritable | boolean |
instructions[].dataBase64 | base64 |
computeUnitLimit | integer (optional) |
priorityFeeMicroLamports | string (optional) |
idempotencyKey | string |
Response 200:
| Field | Type |
|---|---|
id | string |
transactionBase64 | base64 |
blockhash | string |
lastValidBlockHeight | integer |
cosigned | boolean |
expiresAt | timestamp |
kind | rings_register | rings_deposit | rings_withdraw | mesa_deposit |
POST /v1/transactions/submit
Submit a wallet-signed transaction (relay or wallet-sent).
Request body, by mode:
When mode is relay:
| Field | Type |
|---|---|
buildId | string |
signedTransactionBase64 | base64 |
idempotencyKey | string |
When mode is wallet-sent:
| Field | Type |
|---|---|
buildId | string |
signature | string |
idempotencyKey | string |
Response 200:
| Field | Type |
|---|---|
id | string |
status | pending | submitted | unconfirmed | confirmed | finalized | failed | expired |
signature | string (optional) |
slot | string (optional) |
batchNumber | integer or null (optional) |
error | object (optional) |
error.stage | build | wallet-rejected | wallet-changed | simulation | send | confirm |
error.message | string |
error.nextStep | string (optional) |
error.retryable | boolean |
error.program | object (optional) |
error.program.address | string |
error.program.code | integer or null |
error.program.name | string or null |
updatedAt | timestamp |
GET /v1/transactions/{id}
Poll transaction status by tracking id.
| Parameter | Type |
|---|---|
id | string, path |
Response 200:
| Field | Type |
|---|---|
id | string |
status | pending | submitted | unconfirmed | confirmed | finalized | failed | expired |
signature | string (optional) |
slot | string (optional) |
batchNumber | integer or null (optional) |
error | object (optional) |
error.stage | build | wallet-rejected | wallet-changed | simulation | send | confirm |
error.message | string |
error.nextStep | string (optional) |
error.retryable | boolean |
error.program | object (optional) |
error.program.address | string |
error.program.code | integer or null |
error.program.name | string or null |
updatedAt | timestamp |
POST /v1/prove
Generate a Groth16 proof if browser proving is unavailable.
Request body:
| Field | Type |
|---|---|
circuit | deposit | withdraw | place | reclaim | settle | renew | repay | close_position | liquidate | sweep |
witnessBase64 | base64 |
Response 200:
| Field | Type |
|---|---|
circuit | deposit | withdraw | place | reclaim | settle | renew | repay | close_position | liquidate | sweep |
proofBase64 | base64 |
publicInputsBase64 | base64 |
provingMs | integer |
Positions
GET /v1/positions/lapsed
List lapsed positions eligible for liquidation checks.
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].kind | borrow | perp |
items[].marketId | string or null |
items[].targetAddress | string or null |
items[].collateralIndex | integer |
items[].slot | string |
items[].deadlineAt | timestamp or null |
items[].deadlineSeconds | string or null |
items[].tlockOpen | boolean |
items[].ciphertextBase64 | base64 |
items[].positionNoteHash | string or null |
items[].positionAccount | string or null |
asOf | timestamp |
Watcher
GET /v1/watcher/enrolments
List watcher enrolments for one or more position ids.
| Parameter | Type |
|---|---|
positionId | string, query, optional |
positionIds | string, query, optional |
Response 200:
| Field | Type |
|---|---|
items | array of object |
items[].id | string |
items[].positionId | string |
items[].positionKind | borrow | perp |
items[].status | active | renewing | lapsed | removed |
items[].enrolledAt | timestamp |
items[].lastRenewedAt | timestamp or null |
items[].nextDeadlineAt | timestamp |
items[].renewCount | integer |
asOf | timestamp |
POST /v1/watcher/enrolments
Enrol a sealed position with its read-only key.
Request body:
| Field | Type |
|---|---|
positionId | string |
positionKind | borrow | perp |
readOnlyKey | base64 |
nextDeadlineAt | timestamp (optional) |
Response 201:
| Field | Type |
|---|---|
id | string |
positionId | string |
positionKind | borrow | perp |
status | active | renewing | lapsed | removed |
enrolledAt | timestamp |
lastRenewedAt | timestamp or null |
nextDeadlineAt | timestamp |
renewCount | integer |
DELETE /v1/watcher/enrolments/{positionId}
Remove a watcher enrolment authorized by its read-only key.
| Parameter | Type |
|---|---|
positionId | string, path |
Request body:
| Field | Type |
|---|---|
readOnlyKey | base64 |
Response 200:
| Field | Type |
|---|---|
positionId | string |
removed | boolean |
removedAt | timestamp |