Skip to content
LogoLogo

API

The Flint perps exchange exposes these gRPC packages:

PackageAudienceAuthServices
flint.margin.user.v1Traders, frontends, analytics, keepersNone — publicPerpMarketService, MarketDataService, OrderService, FundingService, AccountService, MarketService, RiskService, SponsorshipService
flint.margin.user.v1.notificationsAccount ownersOwner bearer sessionNotificationService
flint.margin.maker.v1Market makersBearer session (see below); NodeService is publicAuthService, MakerService, TxService, SessionService, SpreadProtectService, NodeService, EscalationService

These packages are served by the same Flint server processes that serve the spot API, on the same two listeners. Public margin services live on the public host. TxService, SessionService, SpreadProtectService, and EscalationService live only on the authed (maker) host; AuthService, MakerService, and NodeService are on both. See Endpoints. NotificationService lives on the public host and authenticates every method. It is unavailable until the server enables notifications.

Field-level detail for every message, enum, and RPC is generated from the proto: User API reference and Maker API reference.

Every service speaks vanilla gRPC and gRPC-Web on the same URL. Pick whichever transport fits your stack — see Protocols & transports.

Writes happen on-chain

There is no "place order" or "deposit" RPC. Every trading state change — deposits, withdrawals, perp orders, maker quotes, liquidations — is a Solana transaction against the Flint margin program. The API helps you build, price, submit, and observe those transactions:

  • Build instructions with the on-chain clients — see On-chain clients.
  • Dry-run them with OrderService.PreviewOrder, AccountService.SimulateAction, or AccountService.GetActionLimits.
  • Submit them yourself over Solana RPC, through SponsorshipService.SponsorTransaction (Flint pays the fee), or — for makers — through TxService.SubmitTx.

Email notification settings are off-chain writes. The notification service exposes GetSettings, RequestEmailVerification, VerifyEmail, and DisableEmail. Public fill history and client-local read/dismiss state power the notification bell independently of email delivery. See the notification SDK guide.

flint.margin.user.v1 — public

No credentials. Every RPC is keyed for rate limiting by client IP.

Perp markets — PerpMarketService

RPCKindWhat it does
ListPerpMarketsunaryPerp contract catalog: symbol, assets, tick/lot size, margin rates and tiers, open-interest cap. Filtering by statuses and page_token is not supported yet.
GetPerpMarketunaryOne perp contract by PerpId.
GetMarketStatsunaryMark, index, oracle, and last-trade prices, 24 h volume and change, open interest, funding, and top of book for one or more perps.
GetVolumeBreakdownunaryPer-perp volume over rolling windows.
GetVolumeSeriesunaryBucketed volume time series.
SubscribeMarketStatsstreamLive market stats. Not yet served

Order books, trades, candles — MarketDataService

RPCKindWhat it does
GetOrderBookunaryL2 book snapshot for one perp (depth ≤ 100).
SubscribeOrderBookstreamSnapshot, then sequenced deltas. A delta replaces the size at a price; zero deletes the level.
GetTradesunaryArchived public trades for a time range.
SubscribeTradesstreamLive public trades. Not yet served
GetCandlesunaryOHLCV candles. Only the trade price source is archived; mark and index sources return UNIMPLEMENTED.
SubscribeCandlesstreamLive candle updates.

Orders — OrderService

RPCKindWhat it does
PreviewOrderunarySimulates a perp order against the current book and the account's margin without signing or submitting it.
ListOrdersunaryAn account's orders. Not yet served
GetOrderunaryOne order. Not yet served
SubscribeOrdersstreamLive order updates. Not yet served

Funding — FundingService

RPCKindWhat it does
GetFundingRatesunaryCurrent funding rate per perp. rate is a fraction per interval_seconds; positive means longs pay shorts.
SubscribeFundingRatesstreamLive funding-rate updates.
GetFundingRateHistoryunaryHistorical funding rates. Not yet served
GetFundingPaymentsunaryAn account's funding payments. Not yet served
SubscribeFundingPaymentsstreamLive funding payments. Not yet served

Trader accounts — AccountService

RPCKindWhat it does
GetAccountunaryOne trader account: spot collateral legs, perp positions, and cross-margin health.
SubscribeAccountstreamSnapshot on subscribe, then account and valuation updates (valuation-driven updates may be coalesced).
BatchGetAccountsunarySeveral accounts by TraderId.
SubscribeAccountsstreamLive updates for a set of accounts; each message replaces the selected set.
ListAccountsunaryTrader accounts an authority (base58 pubkey) owns or is a delegate on.
ListDelegatesunaryWallet and passkey delegates registered on an account.
GetActionLimitsunaryMax deposit / withdraw / lend / redeem / borrow / repay per collateral market, with the binding constraint.
SimulateActionunarySimulates a collateral action (deposit, withdraw, lend, redeem, borrow, repay) and returns the post-state, without signing or submitting. Rate limited as a simulation.
GetFillsunaryAn account's perp fills.
SubscribeFillsstreamLive perp fills for an account.
GetTradingFeesunaryFee rates that apply to an account.
GetTradingLimitsunaryPer-account trading limits. Not yet served
GetPositionHistoryunaryPerp position history. Not yet served
GetActivityunaryArchived collateral activity — deposits, withdrawals, lend/redeem, borrow/repay, liquidations, loss socialization. Needs the history archive; observed activity may have gaps and is not proof of settlement.
SubscribeActivitystreamLive activity only. Reconcile with GetActivity after a disconnect.
GetAccountHistoryunaryArchived account value (NAV) and PnL history.
GetInterestHistoryunaryArchived interest accrued on collateral legs.
GetRankedAccountsunaryLeaderboard ranking by metric and timeframe.
RenameAccountunarySets an account's display label. The request carries an ed25519 signature from the controlling key.

Collateral markets — MarketService

Collateral is held in cross-margin spot markets that also lend and borrow.

RPCKindWhat it does
ListMarketsunaryEvery collateral market: asset metadata (mint, decimals), collateral weight, borrow margin rates, oracle price, APRs, utilisation, caps, flags, and oracle state.
GetMarketunaryOne collateral market by SpotId.
SubscribeMarketsstreamOne snapshot per market, then updates.
GetMarketHistoryunaryArchived APR, utilisation, supply, and price history, bucketed.

Risk views — RiskService

RPCKindWhat it does
GetMarketOverviewunaryProtocol- and market-level risk aggregates, including liquidation shock tables.
SimulateAccountRiskunaryRe-values an account under hypothetical price shocks. Rate limited as a simulation.
GetInsuranceFundunaryInsurance-fund balances. Rate limited as a simulation.
ListAccountsAtRiskunaryAccounts ordered by health ratio, lowest first.
SubscribeAccountsAtRiskstreamFull snapshot first, then deltas.
ListLargestAccountsunaryAccounts ordered by gross supplied assets.

Fee sponsorship — SponsorshipService

Flint can pay the network fee for margin transactions. The sponsor is fee payer only; the transaction may invoke only the margin program, the compute-budget program, and the secp256r1 precompile.

RPCKindWhat it does
GetSponsorshipPubkeyunaryBase58 fee-payer key to put in the transaction's fee-payer slot. UNAVAILABLE when sponsorship isn't configured.
SponsorTransactionunaryTakes a wire-format VersionedTransaction with every signature except the sponsor's, co-signs, submits, and returns the signature after confirmation. Rate limited as a transaction.

flint.margin.maker.v1 — authenticated

Sessions — AuthService

RPCKindWhat it does
ChallengeunaryIssues a single-use nonce (30 s TTL) for a base58 public key.
AuthenticateunaryVerifies a signature over FLINT-MARGIN-AUTH-V1: ‖ nonce and mints a bearer session (6 h TTL) scoped to one trader account.
RevokeunaryRevokes a session token.

The signing key must be the owner of a trader account or an active TRADE- or QUOTE-scoped delegate on it. Authenticate returns every trader_ids the key controls and selects one (trader_id in the request, or the lowest controlled id). The domain prefix differs from the spot API's, so a signed margin challenge can never be replayed as a spot login.

AuthService is on both hosts. Authenticate against the authed host if you also need TxService.

Maker reads — MakerService

Every MakerService RPC is scoped to the session's selected trader account.

RPCKindWhat it does
SubscribeMarketSnapshotsstreamPerp book snapshots annotated with your best resting quotes.
GetFillsunaryYour maker fills, with markouts.
SubscribeFillsstreamLive maker fills.
GetVolumeBreakdownunaryYour maker volume per perp over rolling windows.
GetVolumeSeriesunaryYour maker volume as a time series.
GetMarkoutSummaryunaryWhole-window markout summary, without GetFills' page limit.
GetQuotingStateunaryLatest observed state of your on-chain quoting entries, including sequence numbers.
SubscribeQuotesstreamLive quoting updates, filtered by perp and quoter key.
ListRecentQuotesunaryArchived quoting updates for a time range, paged by cursor.
GetQuoteunaryOne quoting update by signature, instruction index, and update index.
GetStatsunaryYour fill, transaction, oracle-update, and quote-update rates over 1 s, 1 m, and 5 m.
GetActivityunaryArchived actions by your trader account, newest first (at most 1000).
GetDecodedTransactionunaryOne of your transactions by signature, decoded into Flint events.
ListQuotingAuthoritiesunaryKeys that opened sessions for your trader: open sessions, best RTT, regions, SDKs, last submit and landing, SOL balance.
ListQuoterSessionsunaryLive and recent sessions, most recently seen first, with IP, SDK, RTT, and clock drift.
GetSdkCredentialsunaryThe read-only Kellnr registry token for the Rust SDK. Needs an organization (see Authentication).

GetFills, GetVolumeBreakdown, GetVolumeSeries, GetMarkoutSummary, ListRecentQuotes, GetQuote, GetActivity, GetDecodedTransaction, and GetSdkCredentials read the history archive and return FAILED_PRECONDITION on a deployment without it.

There is no maker balance RPC. Read collateral, positions, and health with the public AccountService.GetAccount or SubscribeAccount.

Transactions — TxService (authed host only)

RPCKindWhat it does
SubmitTxunarySubmits a fully signed legacy, v0 or v1 transaction. The session's key must be one of its required signers. Returns on acceptance, not confirmation.
SubscribeTxStatusstreamAck / landed / failed transitions for every transaction submitted under this session's trader.
SubscribeBlockhashstreamRecent blockhash, last_valid_block_height, and a priority-fee recommendation.
SubscribeSlotsstreamSlot ticks.
SubscribeLeadersstreamUpcoming leader schedule with TPU addresses.

Session heartbeat — SessionService (authed host only)

RPCKindWhat it does
Sessionbidi streamThe server sends a Ping every 30 s; reply at once with a Pong echoing its seq. Feeds the RTT and clock drift that ListQuoterSessions reports.

Session is bidirectional, so it needs HTTP/2 gRPC; gRPC-Web can't carry it. The Rust maker client answers it for you.

Spread protection — SpreadProtectService (authed host only)

RPCKindWhat it does
SubscribeSpreadProtectstreamA reset_state with the baseline default_spread_mult, then current and future widen_windows: an inclusive slot range and a spread_mult of at least 1.0.

The feed is advisory and the same for every maker. Nothing on-chain enforces it; widen your own quotes by the highest multiplier active at the current slot.

Nodes — NodeService

Public: no session needed, on both hosts.

RPCKindWhat it does
GetNodeInfounaryThis node's build, proto revision, cluster, region, margin program id, leader proximity, and health. A node whose margin state is stale or not loaded reports itself degraded or halted.
ListNodesunaryPublished endpoints, optionally for one cluster, with region and a current flag. Listing does not imply health.

Escalation — EscalationService (authed host only)

RPCKindWhat it does
PageTheTeamunaryPages Flint's on-call team with your message and returns a page id. Confirms dispatch, not response.

Authentication

flint.margin.user.v1 and NodeService need nothing. The rest of flint.margin.maker.v1 expects:

authorization: Bearer <session_token>

Mint the token with AuthService.Challenge → sign → Authenticate (the Rust and TypeScript SDKs wrap this as AuthFlow).

ServiceAccepts
MakerService (except GetSdkCredentials)A keypair session, or a Flint organization session or organization API key (x-api-key: <key>) for an organization with perps access.
MakerService.GetSdkCredentials, EscalationServiceA keypair session whose trader belongs to an organization, or the organization credentials above.
TxService, SessionService, SpreadProtectServiceKeypair sessions only.

URL convention

POST https://<host>/flint.margin.user.v1.<Service>/<Method>
POST https://<host>/flint.margin.maker.v1.<Service>/<Method>
Content-Type: application/grpc             (gRPC binary)
              application/grpc-web+proto   (gRPC-Web, browsers)

No URL parameters and no versioning beyond the package name.

Wire conventions

  • Money, prices, quantities, and rates are Decimal { value: string } — for example "155.14". Never parse them as floats. See Prices, sizes, units.
  • Timestamps are Timestamp { micros: uint64 }, Unix microseconds.
  • PerpId and SpotId are uint32; TraderId is uint64.
  • Many responses carry DataProvenance (commitment, slot, observed_at) — observation metadata, not a claim that the node is caught up with the chain.

Rate limits

The same per-key token-bucket limiter as the spot API applies. The key is your trader session on authenticated calls and your client IP otherwise. Going over budget returns RESOURCE_EXHAUSTED; back off exponentially and retry.

ClassApplies toDefault limit
ReadsEvery unary RPC not listed below50 requests/sec
SimulationsAccountService.SimulateAction, RiskService.SimulateAccountRisk, RiskService.GetInsuranceFund5 requests/sec
TransactionsTxService.SubmitTx, SponsorshipService.SponsorTransaction10 tx/sec and 300 tx/min
StreamsEvery streaming RPC, including SessionService.Session100 concurrent streams

A stream holds one slot for its lifetime rather than drawing on the per-second budget, so prefer one long-lived subscription to polling. Limits are configurable server-side.

Schema downloads

The bundles are generated from the canonical per-file tree under proto/flint/margin/ in the flint-protos repository.