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.jsonIt 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-clientFor 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
| Group | Covers | SDK |
|---|---|---|
| Authentication | Nonce, login, sessions, email verification, X links | sdk.auth |
| API Keys | Create, list, revoke keys | sdk.core.apiKeys |
| OAuth Consent | Read and complete the consent screen of an authorization request | sdk.auth.getInteractionDetails, submitInteractionLogin, confirmInteraction, abortInteraction |
| OAuth Grants | Clients a user authorized, and revoking one | sdk.auth.listOauthGrants, sdk.auth.revokeOauthGrant |
| Users | Profile, display name, preferences | sdk.core.users |
| Trade Accounts | Connect and manage venue accounts | sdk.core.accounts |
| Markets | Baskets and single-instrument markets | sdk.core.markets |
| Instruments | Tradable instruments, symbol-to-ID map | sdk.core.instruments |
| Prices | Mid and mark prices | sdk.core.prices |
| Funding | Funding rates | sdk.core.funding |
| Oracle | BTC dominance | sdk.core.oracle |
| Trade | Open, adjust, close, reverse | sdk.core.trade |
| Triggers | Conditional entries, take profit, stop loss | sdk.core.triggers |
| Schedules | TWAP | sdk.core.schedules |
| Ladders | Staggered entries | sdk.core.ladders |
| Rebalance | Manual and automatic rebalancing | sdk.core.rebalance |
| Leverage | Per-instrument leverage | sdk.core.trade.setLeverage |
| Saved Baskets | Basket templates | sdk.core.savedBaskets |
| Positions | Open positions and closed history | sdk.core.positions |
| Executions | What each action did | sdk.core.executions |
| Fills | Individual fills | sdk.core.fills |
| Portfolio | Overview and risk analytics | sdk.core.portfolio |
| TCA | Transaction cost analysis | sdk.core.tca |
| Statistics | Volume, open interest, leaderboard | sdk.core.statistics |
| Statistics Totals | All-time protocol totals | sdk.core.statistics.totals |
| Fees | Fee quote for the selected trade account | sdk.core.fee.get |
| Fee Recipient | The recipient a connector must approve | sdk.core.fee.recipient |
| Referrals | Codes and referral status | sdk.core.referrals |
| Notifications | List and read state | sdk.core.notifications |
| Lighter | Lighter-specific setup helpers | sdk.core.misc.lighter |
| Fill Sync | Apply, confirm, and reconcile venue fills | sdk.core.sync.fills |
| Funding Sync | Apply historical funding payments | sdk.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
| Convention | Detail |
|---|---|
| Account scoping | Account-scoped endpoints require the x-trade-account-id header. |
| Instrument IDs | A leg's symbol field takes the exchange's instrument ID, not the ticker. See Instrument ID. |
| Decimals | Sizes, prices, and amounts are decimal strings, so no precision is lost in JSON. |
| Pagination | Most 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 calls | 202 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. |