PearPear
API Integration

API Specification

The full V3 gateway REST surface, and where to find exact request and response schemas.

The V3 gateway is a typed REST API served from https://pro-gateway.pearprotocol.io.

Every endpoint below has its own page, generated from the gateway's OpenAPI spec. Each page lists the parameters, the request body, and the response schemas, with request examples in cURL, JavaScript, Go, Python, Java, C#, and Rust. You can also send the request from the page itself.

Pick a group in the sidebar, or start with Authentication.

Download the spec

The OpenAPI 3.1 document these pages are generated from is served at /openapi.json.

curl -O https://docs.pear.garden/openapi.json

It is the gateway's own spec, published verbatim, so it stays in step with the pages beside it. Point a client generator at it, or import it into Postman, Insomnia, or Bruno:

npx @openapitools/openapi-generator-cli generate \
  -i https://docs.pear.garden/openapi.json \
  -g typescript-fetch \
  -o ./pear-client

For TypeScript you rarely need to: @pear-protocol/core-sdk is already generated from this spec and ships the types with it.

Using the SDK instead

For TypeScript, prefer the SDK over raw HTTP: it wraps authentication, x-trade-account-id scoping, and returns fully typed results.

  • @pear-protocol/core-sdk, the typed REST client for everything below (sdk.auth, sdk.core, sdk.external).
  • @pear-protocol/types, Zod schemas and DTOs for every request, response, and entity.

sdk.external is the third namespace, and covers no group in the table below. It searches prediction markets for a prediction_market trigger condition: sdk.external.triggers.kalshi.{search, marketNames} and sdk.external.triggers.polymarket.{search, marketNames}. See Trigger Order.

Two more SDKs read the exchanges directly rather than this gateway: @pear-protocol/market-sdk for charts, order books, and historical funding, and @pear-protocol/exchanges-sdk for venue account state and basket sizing. See Market Data and Venue Accounts.

Endpoint groups

GroupCoversSDK
AuthenticationNonce, login, sessions, email verification, X linkssdk.auth
API KeysCreate, list, revoke keyssdk.core.apiKeys
OAuth ConsentRead and complete the consent screen of an authorization requestsdk.auth.getInteractionDetails, submitInteractionLogin, confirmInteraction, abortInteraction
OAuth GrantsClients a user authorized, and revoking onesdk.auth.listOauthGrants, sdk.auth.revokeOauthGrant
UsersProfile, display name, preferencessdk.core.users
Trade AccountsConnect and manage venue accountssdk.core.accounts
MarketsBaskets and single-instrument marketssdk.core.markets
InstrumentsTradable instruments, symbol-to-ID mapsdk.core.instruments
PricesMid and mark pricessdk.core.prices
FundingFunding ratessdk.core.funding
OracleBTC dominancesdk.core.oracle
TradeOpen, adjust, close, reversesdk.core.trade
TriggersConditional entries, take profit, stop losssdk.core.triggers
SchedulesTWAPsdk.core.schedules
LaddersStaggered entriessdk.core.ladders
RebalanceManual and automatic rebalancingsdk.core.rebalance
LeveragePer-instrument leveragesdk.core.trade.setLeverage
Saved BasketsBasket templatessdk.core.savedBaskets
PositionsOpen positions and closed historysdk.core.positions
ExecutionsWhat each action didsdk.core.executions
FillsIndividual fillssdk.core.fills
PortfolioOverview and risk analyticssdk.core.portfolio
TCATransaction cost analysissdk.core.tca
StatisticsVolume, open interest, leaderboardsdk.core.statistics
Statistics TotalsAll-time protocol totalssdk.core.statistics.totals
FeesFee quote for the selected trade accountsdk.core.fee.get
Fee RecipientThe recipient a connector must approvesdk.core.fee.recipient
ReferralsCodes and referral statussdk.core.referrals
NotificationsList and read statesdk.core.notifications
LighterLighter-specific setup helperssdk.core.misc.lighter
Fill SyncApply, confirm, and reconcile venue fillssdk.core.sync.fills
Funding SyncApply historical funding paymentssdk.core.sync.funding

Real-time updates (prices, funding, trades, positions, executions, triggers) come over the WebSocket, which is not part of the REST spec.

The OAuth 2.0 protocol endpoints are not in the spec either. /.well-known/oauth-authorization-server, /register, /authorize, /token, and /revoke are excluded from it, so the reference generates no page for them. The OAuth Consent group above covers only the /interaction/{uid} screen the user sees. See Access Management.

Conventions

ConventionDetail
Account scopingAccount-scoped endpoints require the x-trade-account-id header.
Instrument IDsA leg's symbol field takes the exchange's instrument ID, not the ticker. See Instrument ID.
DecimalsSizes, prices, and amounts are decimal strings, so no precision is lost in JSON.
PaginationMost account lists page by cursor and return nextCursor. Market lists page by offset. Exceptions: GET /notifications pages by limit with startDate/endDate; GET /statistics/leaderboard takes limit only; GET /saved-baskets, GET /positions/lite, GET /fills/provisionals-lite, and GET /trade-accounts take no pagination.
Trading calls202 Accepted with an execution: /trade/open, /trade/{positionId}/adjust, /trade/{positionId}/close, /trade/{positionId}/reverse, /trade/close-all, and the trigger, schedule, and ladder cancels. 200 OK: creating a trigger, schedule, ladder, or auto-rebalance config, and every other rebalance route. Either way the outcome arrives over the WebSocket. See Error Handling.

On this page