# Docs - Introduction - [What is Pear Protocol?](/introduction/what-is-pear-protocol) - [Why Pair Trading Matters](/introduction/why-pair-trading-matters): It's time for a new paradigm. One where our users make money. - [Quick start guide](/introduction/quick-start-guide): How to start trading on Pear - Products & Surfaces - [Orchard & the Pear Suite](/products-and-surfaces/the-orchard-engine-and-the-pear-suite) - [Baskets](/products-and-surfaces/baskets): Baskets trade a whole narrative - [Copy Trading](/products-and-surfaces/copy-trading): Mirror a leader’s trades automatically, scaled to your account - Vaults - [Vaults](/vaults) - Agent Pear - [AI Trading Assistant](/agent-pear/trading-assistant): Agent Pear, your AI trading assistant - [Agent Pear Signals](/agent-pear/signals): Agent Pear Signals algorithmic pair-trade ideas from Pear's quant engine - How it works - [Execution Logic](/how-it-works/execution-logic): Pear is a trading interface. You own your assets at all times. - [Auto-Rebalance](/how-it-works/auto-rebalance) - Use cases - [1. Narrative-based trading](/use-cases/1.-narrative-based-trading): Trade narratives by going long the winner and short the loser of the rotation. - [2. Fundamental trading](/use-cases/2.-fundamental-trading): Trade fundamentals against each other (TVL vs FDV, on-chain metrics vs price) as a relative-value position. - [3. Technical trading (charting)](/use-cases/3.-technical-trading-charting): Read the ratio, not the legs: technical analysis applied to the spread between two assets. - [4. Statistical arbitrage](/use-cases/4.-statistical-arbitrage): Trade spreads that are statistically bound to revert: cointegration, z-scores, and beta-neutral sizing. - [AI / Agent-assisted trading](/use-cases/5.-ai-agent-assisted-trading-new) - [Considerations](/use-cases/considerations): The practical factors that separate a considered pair trade from a coin flip: funding, slippage, correlation, and beta. - Venues & Markets - [Venues overview](/venues-and-markets/venues-overview): Which venues Pear trades on, and where: Hyperliquid, Lighter, CEXs on Pear Pro, SYMM on Base. - [Hyperliquid](/venues-and-markets/hyperliquid): Hyperliquid, non-custodial on-chain perps on HyperCore, the primary retail venue. - [Lighter](/venues-and-markets/lighter): Lighter, non-custodial zk-rollup perp orderbook, live on Orchard web app and Pear Pro. - [Pear Pro CEX/DEX](/venues-and-markets/pear-pro-cex-dex): Pear Pro, the professional terminal trading Hyperliquid, Lighter, Binance, Bybit, and OKX from one place. - [SYMM](/venues-and-markets/symm): SYMM (Symmio), the intent-based perp protocol that powers the Pear Base app on Base. - [Variational](/venues-and-markets/variational): Variational, a next-generation perp venue on Pear's roadmap, not yet integrated. - [Asset classes](/venues-and-markets/asset-classes) - MCP Server - Orchard MCP - [Orchard MCP](/mcp-server/orchard-mcp): Connect an agent to Pear market data and trading tools with Orchard MCP. - [Pear MCP integration guide](/mcp-server/orchard-mcp/pear-mcp-integration-guide): Build a Pear MCP integration with authentication, volume attribution, account selection, and trading tools. - API Integration - [Overview](/api-integration/overview): Build pair and basket trading across Hyperliquid, Binance, Bybit, OKX, and Lighter through one V3 gateway. - Access Management - [Access Management](/api-integration/access-management): Authenticate to the gateway and connect the exchange accounts Pear trades on. - [Authentication](/api-integration/access-management/authentication-process): Authenticate to the V3 gateway with an API key, wallet or email login, or OAuth, and scope requests to a trade account. - [OAuth 2.0](/api-integration/access-management/oauth): Delegated access with OAuth 2.0, from registering a client to running the authorization-code flow with PKCE and holding a grant the user can revoke. - [Account Linking](/api-integration/access-management/account-linking): Attach a wallet, an email login, or an X account to an existing Pear account, and sign in with X. - [Trade Accounts](/api-integration/access-management/trade-accounts): Connect and manage the exchange accounts Pear trades on your behalf. - [Connect an Exchange](/api-integration/access-management/connect-an-exchange): What each venue needs before a trade account can trade, from deposit to approvals. - Important Terms - [Important Terms](/api-integration/important-terms): The concepts a pair-trading integration has to get right. - [Instrument ID](/api-integration/important-terms/instrument-id): Every symbol field in the API takes an exchange-specific instrument ID, not the ticker. How to resolve one, where they appear, and how they fail. - [Client ID](/api-integration/important-terms/client-id): Attribute the trades your integration routes, then read back your own volume, open interest, users, and leaderboard with the same code. - [Orders and Executions](/api-integration/important-terms/orders-and-executions): What a trigger, schedule, ladder, execution, order, and fill each are, and how one becomes the next. - [Price Ratio](/api-integration/important-terms/price-ratio): How one long and one short collapse into a single line, which formula the API actually uses, and how to trade the ratio with a trigger. - [Weighted Price Ratio](/api-integration/important-terms/weighted-price-ratio): The weighted geometric ratio a multi-leg basket trades on, where the weights live in the API, and why the value on GET /markets/baskets is computed differently. - [Net Funding](/api-integration/important-terms/net-funding): What it costs to hold a basket once the paid and received funding legs net out, and why the sign on GET /markets/baskets is the opposite of the trader's-cost convention. - [Position Key](/api-integration/important-terms/position-key): The deterministic hash that decides whether a trade lands on an existing position or opens a new one, and how it differs from a basketKey. - [Synthetic Position](/api-integration/important-terms/synthetic-position): Why Pear's positions, entry prices, and PnL differ from the exchange's own view, and the fields that tell you when the basket view is incomplete. - [Trade Idea](/api-integration/trade-idea): Discover ready-to-trade baskets and pairs across venues. - Executing Trade - [Executing Trade](/api-integration/executing-trade): Open pair and basket trades across venues, and choose how they execute. - [Basket Trade](/api-integration/executing-trade/basket-trade): Open a multi-leg basket in a single call. - Order Type - [Order Type](/api-integration/executing-trade/order-type): Choose how a basket fills: market, chase limit, trigger, TWAP, or ladder. - [Market Order](/api-integration/executing-trade/order-type/market-order): Open a basket immediately at market. - [Chase Limit Order](/api-integration/executing-trade/order-type/chase-limit-order): Rest maker orders at the best price and follow it until the basket fills. Hyperliquid only. - [Trigger Order](/api-integration/executing-trade/order-type/trigger-order): Open a basket when a market condition is met. - [Time-Weighted Average Price](/api-integration/executing-trade/order-type/time-weighted-average-price): Spread a basket entry or exit into timed chunks, evenly (TWAP) or by volume (VWAP). - [Ladder Order](/api-integration/executing-trade/order-type/ladder-order): Stagger multiple basket entries across a ratio range. - Managing Open Position - [Managing Open Position](/api-integration/executing-trade/managing-open-position): Adjust, close, reverse, rebalance, and set risk on an open basket. - [Adjust a Position](/api-integration/executing-trade/managing-open-position/adjust-position-size): Grow or trim an open basket, whole or one leg at a time. - [Close Position](/api-integration/executing-trade/managing-open-position/close-position): Close an open basket, at market or over time. - [Take Profit / Stop Loss](/api-integration/executing-trade/managing-open-position/take-profit-stop-loss): Attach take-profit and stop-loss triggers to an open basket. - [Auto-Rebalance](/api-integration/executing-trade/managing-open-position/auto-rebalance): Keep a basket on its target weights automatically, in weights mode or beta mode. - [Managing Open Order](/api-integration/executing-trade/managing-open-order): List, cancel, and change resting orders (triggers, schedules, ladders). - Trade Activity - [Trade Activity](/api-integration/trade-activity): Read positions, resting orders, executions, fills, and history. - [Open Position](/api-integration/trade-activity/open-position): List open basket positions. - [Closed Position](/api-integration/trade-activity/closed-position): Read closed-trade history, with realized PnL, fees, and funding per leg. - [Open Order](/api-integration/trade-activity/open-order): List resting orders. - [Monitor TWAP](/api-integration/trade-activity/monitor-twap): Track a running TWAP or VWAP schedule, and read its slices. - [Execution](/api-integration/trade-activity/execution): Track what an action actually did, and read the venue orders it placed. - [Fills](/api-integration/trade-activity/fills): Read the individual fills behind a position, with prices and fees. - [Rebalance Activity](/api-integration/trade-activity/rebalance-activity): Read what auto-rebalance did to a position, and the events to track live. - [Trade History](/api-integration/trade-activity/trade-history): Read what already happened on the account, from single fills up to portfolio analytics. - [Portfolio](/api-integration/trade-activity/portfolio): Read account-level performance — realized cash flow, closed-position statistics, per-basket ranking, and chart series. - [Transaction Cost Analysis](/api-integration/trade-activity/transaction-cost-analysis): Measure execution quality against the price you could have had, per fill, per position, or across the account. - [Syncing Venue Activity](/api-integration/trade-activity/syncing-venue-activity): How Pear keeps its ledger in step with the venue, and how to ask for an import or refresh. - [Statistics](/api-integration/statistics): Public volume, open interest, all-time totals, and the trader leaderboard, scoped to your client ID. - [Copy Trading](/api-integration/copy-trading): Copy a Pear leader or a public Hyperliquid account through the API, and read what each copy did. - [Referrals and Rewards](/api-integration/rewards): Create and bind referral codes, read referees, and claim referral and copy-leader rewards in USDC. - [Vaults](/api-integration/vaults): Read Pear vaults, manage one with owner signatures, and trade as a vault through the API. - [Market Data](/api-integration/market-data): Exchange-native chart candles, order books, and historical funding, read straight from the venue with @pear-protocol/market-sdk. - [Venue Accounts](/api-integration/venue-accounts): Read balance, positions, leverage, and basket capacity straight from the exchange with @pear-protocol/exchanges-sdk. - [Websocket](/api-integration/websocket): Subscribe to real-time prices, funding, trades, trigger events, and your own account events over the V3 gateway WebSocket. - [Error Handling](/api-integration/error-handling): How the V3 gateway reports errors, and where asynchronous trade failures surface. - API Specification - [API Specification](/api-integration/api-specification): The full V3 gateway REST surface, and where to find exact request and response schemas. - Authentication: Sign in, register, refresh a session, and link a wallet or an X account. - [Authentication](/api-integration/api-specification/auth): Sign in, register, refresh a session, and link a wallet or an X account. - [Start linking an email login](/api-integration/api-specification/auth/post-auth-link-emailpass): Nothing is linked yet: this records a pending claim and emails a verification link. The email login exists only once `POST /auth/verify-email` redeems the token from that email together with a `password`, which becomes the login's password. Answers 204 without sending anything when the address is already this account's email login or awaits verification by another account. For an address already awaiting verification by this account it resends the email, at most once a minute. - [Link a wallet to the account](/api-integration/api-specification/auth/post-auth-link-wallet): Proves control of a wallet and adds it as a sign-in method. Uses the wallet sign-in challenge: call `POST /auth/nonce` for the address, sign the returned `message` unchanged with personal_sign (EIP-191), then call this within 5 minutes with the `nonce` and the signature. Send the same `Origin` header on both calls, or none on both: the server rebuilds the signed message from this request's `Origin`. An account holds at most one wallet. A refused challenge answers 400 rather than 401, because the session itself is valid. - [Start linking an X account](/api-integration/api-specification/auth/post-auth-link-x-start): Returns the X authorization URL to send the browser to. The flow finishes at `GET /auth/link/x/callback`, which returns the browser to `returnTo` with the outcome. First-party only: the request's `Origin` must be an allowlisted frontend origin, and `returnTo` must be a page on that origin. The authorization must finish within 10 minutes. - [Finish linking an X account](/api-integration/api-specification/auth/get-auth-link-x-callback): Redirect target for X; integrators never call it. Always answers 302 to the `returnTo` page (or `/` when the flow cannot be matched), never an error body, adding these query parameters: - `x_link`: `connected` (newly linked), `reconnected` (this X account was already linked; its profile is refreshed) or `error`. - `x_reason`, only with `error`: `denied` (the user cancelled on X), `expired_state` (`state` missing, already used or older than 10 minutes), `already_registered` (the X account is linked to another Pear account), `different_account` (this account already has a different X account; disconnect it first) or `x_unavailable` (X failed or is not configured). Takes no credential: the `state` parameter is what identifies the account, and it is unguessable, single-use and minted only by an authenticated start. - [Show or hide the X account on the leaderboard](/api-integration/api-specification/auth/patch-auth-link-x-visibility): Withholding stops the handle, name and avatar being published to other users while keeping the account linked, so signing in through X still works. Takes the wanted state, not a flip, so a retry lands on the same result. Does not require a linked X account: the setting belongs to the user and outlives the link, so it can be set beforehand and survives a disconnect and reconnect. - [Disconnect the linked X account](/api-integration/api-specification/auth/delete-auth-link-x): Removes the link and stops the handle being shown to other users. Also signs out the account's other sessions that signed in through X. A no-op when no X account is linked. - [Sign in](/api-integration/api-specification/auth/post-auth-login): Signs in and starts a session. Returns the token pair in the body and also sets the `_pear_access_token` and `_pear_refresh_token` cookies, so bearer and cookie clients are both served. - `method: wallet`: call `POST /auth/nonce` for the address, sign the returned `message` unchanged with personal_sign (EIP-191), then call this within 5 minutes with the `nonce` and the signature. Send the same `Origin` header on both calls, or none on both: the server rebuilds the signed message from this request's `Origin`. The first sign-in with a wallet creates the account; `accessCode` is read only then. - `method: email`: the email must be verified first (`POST /auth/register/emailpass`, then `POST /auth/verify-email`). - [Start signing in with X](/api-integration/api-specification/auth/post-auth-login-x-start): Returns the X authorization URL to send the browser to. The full flow: 1. Generate a random 32-byte verifier, keep it, and send its base64url SHA-256 as `handoffChallenge` with a `handoffId` naming this attempt. 2. Send the browser to `authorizeUrl`; the user must finish on X within 10 minutes. 3. X returns through `GET /auth/login/x/callback`, which redirects to `returnTo` with the outcome and, on success, an `x_ticket` fragment. 4. Redeem the ticket with the verifier at `POST /auth/login/x/exchange` within 60 seconds. First-party only: the request's `Origin` must be an allowlisted frontend origin, and `returnTo` must be a page on that origin. - [Finish signing in with X](/api-integration/api-specification/auth/get-auth-login-x-callback): Redirect target for X; integrators never call it. Settles the Pear account that has this X account connected, and never creates one. Always answers 302 to the `returnTo` page (or `/` when the flow cannot be matched), never an error body, adding: - `x_login`: `signed_in` or `error`. - `x_handoff`: the `handoffId` of the attempt, whenever the flow could be matched, so the browser knows which verifier the outcome belongs to. - `x_reason`, only with `error`: `denied` (the user cancelled on X), `expired_state` (`state` missing, already used or older than 10 minutes), `no_account` (no Pear account has this X account connected) or `x_unavailable` (X failed or is not configured). - On success, the fragment `x_ticket=`: single-use and valid for 60 seconds, redeemed at `POST /auth/login/x/exchange`. - [Redeem a finished X sign-in](/api-integration/api-specification/auth/post-auth-login-x-exchange): Exchanges the single-use ticket from the callback for a session, proving this is the browser that started the sign-in by presenting the verifier behind its challenge. Returns the token pair in the body and sets the session cookies, so bearer and cookie clients are both served. The ticket is spent on the first attempt, even a refused one. - [Request nonce for wallet authentication](/api-integration/api-specification/auth/post-auth-nonce): Step one of wallet sign-in (`POST /auth/login`), wallet linking (`POST /auth/link/wallet`) and OAuth consent sign-in (`POST /interaction/{uid}/login`). Returns a single-use challenge valid for 5 minutes: sign `message` unchanged with personal_sign (EIP-191) and send the signature with `nonce` and the same `address`. The message's domain and URI come from this request's `Origin` header, or the server default when it has none. The follow-up call is checked against a message rebuilt from its own `Origin`, so both calls must send the same `Origin`, or none. A new nonce does not invalidate earlier unexpired ones. - [Register new user with email and password](/api-integration/api-specification/auth/post-auth-register-emailpass): Starts an email sign-up: creates the account and emails a verification link. The account cannot sign in until `POST /auth/verify-email` redeems the token from that email (no `password` needed there; it is set here). `accessCode` applies to the new account. Always answers 204 and never reveals whether the email exists: when the email is already registered, or awaits verification from an earlier sign-up, nothing changes and no email is sent. Use `POST /auth/resend-verification/email` to resend. - [Logout user](/api-integration/api-specification/auth/post-auth-session-logout): Ends the current session: revokes it, so its access and refresh tokens stop working, and clears the session cookies. Other sessions of the account stay signed in. - [Get current user info](/api-integration/api-specification/auth/get-auth-session-me): Returns the signed-in user, how the current session signed in, and every identity (wallet, email, X) connected to the account. - [Get current user info via API key](/api-integration/api-specification/auth/get-auth-api-key-me): Resolves the user behind an x-api-key header. API-key auth only; never falls back to session. - [Refresh cookie-based session](/api-integration/api-specification/auth/post-auth-session-refresh): Rotates the cookie session: reads the `_pear_refresh_token` cookie, replaces both session cookies, and returns the new access token for callers that send it as a bearer header. The refresh token is single-use: a token that was already refreshed answers 401. When two tabs refresh at once, one of them gets 401 while the other's new cookies land in the shared cookie jar. A 401 for a dead session (revoked, expired or logged out) also clears the cookies. Cookie refreshes keep the session's original expiry; they never extend it. - [Refresh bearer tokens](/api-integration/api-specification/auth/post-auth-session-refresh-token): Exchanges a refresh token for a new token pair. Refresh tokens are single-use and rotate on every call: keep the returned `refreshToken` and discard the one you sent, which now answers 401. Two concurrent refreshes with the same token leave one caller with 401 and no tokens, so serialize refreshes per session. Each refresh restarts the refresh token's lifetime. Sets no cookies. - [Resend verification email](/api-integration/api-specification/auth/post-auth-resend-verification-link): Resends the verification email for the email this account is linking (`POST /auth/link/emailpass`). Revokes the previous token and issues a new one. Answers 204 without sending when the last email went out less than a minute ago. - [Resend verification email by email address](/api-integration/api-specification/auth/post-auth-resend-verification-email): Resend the verification email for a pending email claim using the email address. Does not require authentication. Always returns 204 to prevent email enumeration. - [Verify email claim](/api-integration/api-specification/auth/post-auth-verify-email): Redeems the single-use token from a verification email and creates the email login. For a token from `POST /auth/link/emailpass`, `password` is required and becomes the login's password; for a sign-up token it is ignored. Takes no credential and does not sign in: call `POST /auth/login` with `method: email` afterwards. Returns the settled claim so the caller can confirm which email and flow was verified. - [Change password](/api-integration/api-specification/auth/post-auth-password-change): Changes the password of the account's email login. Signs out every other session of the account; the current one stays signed in. A wrong `currentPassword` answers 400 rather than 401, because the session itself is valid. - [Request password reset](/api-integration/api-specification/auth/post-auth-password-forgot): Request a password reset email. Always returns 204 to prevent email enumeration. - [Reset password](/api-integration/api-specification/auth/post-auth-password-reset): Sets a new password with the single-use token from the reset email (`POST /auth/password/forgot`). Signs out every session of the account; sign in again afterwards. - API Keys: Create, list, and revoke the scoped API keys that server-side integrations use. - [API Keys](/api-integration/api-specification/api-keys): Create, list, and revoke the scoped API keys that server-side integrations use. - [List API keys](/api-integration/api-specification/api-keys/get-api-keys): Lists the caller's API keys, newest first, including revoked and expired ones (see `revokedAt` and `expiresAt`). Secrets are never returned; `keyPrefix` tells keys apart. - [Create API key](/api-integration/api-specification/api-keys/post-api-keys): Creates a scoped API key. The secret (`key`) is returned only in this response. Send it as the `x-api-key` header. A `read` key may call read-only (GET) routes; a `read_write` key may also call routes that change state. No API key can manage API keys: these routes take a session only. - [Revoke API key](/api-integration/api-specification/api-keys/delete-api-keys-id): Revoke an API key by ID; existing clients using it stop working. The key stays listed with `revokedAt` set. - OAuth Consent: Read and complete the consent screen of an OAuth authorization request. - [OAuth Consent](/api-integration/api-specification/oauth): Read and complete the consent screen of an OAuth authorization request. - [Read an authorization request](/api-integration/api-specification/oauth/get-interaction-uid): The client, scopes and state the consent screen shows. `/authorize` redirects the browser to the interaction page for `uid`; the request expires 10 minutes after it was made. Before anyone signs in (`prompt.name` is `login`), the `uid` alone grants access and no credential is needed. Once a user has signed in through `POST /interaction/{uid}/login`, only that user's first-party session may read it, sent as a bearer session token or the session cookie. - [Sign in to an authorization request](/api-integration/api-specification/oauth/post-interaction-uid-login): Signs the user in exactly like `POST /auth/login` (same body, same wallet challenge and `Origin` rules, and the first wallet sign-in creates the account) and binds the request to that user. Starts a first-party session and sets its cookies; confirm and abort must then come from this session. Answers with this request's interaction page, where `GET /interaction/{uid}` now shows the `consent` step. - [Grant an authorization request](/api-integration/api-specification/oauth/post-interaction-uid-confirm): Grants the client the scopes the user approved, narrowed to those it requested, and answers with the client's `redirect_uri` carrying the authorization code. Must come from the session that signed in to this request. Each grant counts as one connected agent, up to 10 per user by default; revoke one with `DELETE /oauth2/grants/{id}` to free a slot. - [Deny an authorization request](/api-integration/api-specification/oauth/post-interaction-uid-abort): Cancels the request and answers with the client's `redirect_uri` carrying `error=access_denied`. Must come from the session that signed in to this request, so a request nobody has signed in to cannot be denied. - OAuth Grants: List the clients a user authorized, and revoke one. - [OAuth Grants](/api-integration/api-specification/oauth-grants): List the clients a user authorized, and revoke one. - [List OAuth grants](/api-integration/api-specification/oauth-grants/get-oauth2-grants): Returns the active OAuth grants (authorized clients) the authenticated user holds. - [Revoke an OAuth grant](/api-integration/api-specification/oauth-grants/delete-oauth2-grants-id): Revokes one OAuth grant owned by the authenticated user. Its access and refresh tokens stop working at once, and the slot it held under the connected-agent limit is freed. - Users: Read the user profile, and change the display name and preferences. - [Users](/api-integration/api-specification/users): Read the user profile, and change the display name and preferences. - [Get current user profile](/api-integration/api-specification/users/get-users-profile): Returns the current authenticated user profile - [Update user display name](/api-integration/api-specification/users/patch-users-profile-display-name): Updates the public display name. The name is normalized before it is checked and stored (see `displayName`). Not idempotent: sending the current name answers 400. - [Update user preferences](/api-integration/api-specification/users/patch-users-preferences): Updates the fields sent and leaves the others unchanged. Not idempotent: an empty body, or one where every field equals its current value, answers 400. - Trade Accounts: Connect, update, restore, and delete the venue accounts that execute trades. - [Trade Accounts](/api-integration/api-specification/trade-accounts): Connect, update, restore, and delete the venue accounts that execute trades. - [List all trade accounts](/api-integration/api-specification/trade-accounts/get-trade-accounts): List all trade accounts for the authenticated user - [Create trade account](/api-integration/api-specification/trade-accounts/post-trade-accounts): Links an exchange account with credentials Pear trades through; the body shape depends on `connector`. Credentials are checked live against the exchange before anything is stored: Hyperliquid and TxFlow need an approved agent wallet, Lighter an API key registered in the given slot, Binance two key pairs of one account. A rejection answers 400 carrying the exchange's own message. Credentials are stored encrypted. After the link, Pear starts importing the account's history in the background, and binds a new TxFlow account to Pear's referral code. - [Create vault trade account](/api-integration/api-specification/trade-accounts/post-trade-accounts-vault): Creates the Hyperliquid trade account a Pear vault trades through. The server generates the API wallet and has the vault approve it on Hyperliquid, so the payload carries no credentials. The caller's linked wallet must be the vault's owner or trader. The call waits until the account is provisioned. Provisioning continues on the server if the connection drops: retry with the same `idempotencyKey` to attach to the running attempt and get its result, rather than starting a second one. The account belongs to the vault, not the caller: find it later with `GET /trade-accounts/vault/{vaultAddress}`. - [Vault trade account status](/api-integration/api-specification/trade-accounts/get-trade-accounts-vault-vaultaddress): Whether a Pear vault already has a trade account, and that account when it does. The caller's linked wallet must be the vault's owner or trader. Trade as the vault by sending its address in the `pear-vault-address` header. - [Refresh vault API wallet](/api-integration/api-specification/trade-accounts/post-trade-accounts-vault-vaultaddress-refresh): Replaces the vault trade account's API wallet with a newly approved one; Hyperliquid agent approvals expire after about 180 days. The caller's linked wallet must be the vault's owner or trader. The call waits until the new wallet is approved and stored; a retry of the same rotation attaches to the running one. - [Update trade account](/api-integration/api-specification/trade-accounts/patch-trade-accounts-id): Updates the alias, credentials or metadata; `connector` must be the account's own and selects the body shape. New credentials are checked live against the exchange like at creation and must reach the same exchange account. For Hyperliquid, Lighter and TxFlow, credentials must come with `metadata`, and changing a Hyperliquid or TxFlow agent wallet requires the new `credentials`. Not idempotent: a body that changes nothing answers 400. - [Delete trade account](/api-integration/api-specification/trade-accounts/delete-trade-accounts-id): Soft-deletes a trade account; it stays listed with `includeDeleted=true` and can be restored with `POST /trade-accounts/{id}/restore`. - [Get exchange credentials](/api-integration/api-specification/trade-accounts/post-trade-accounts-id-credentials): Returns the decrypted exchange credentials, for calling the exchange API directly. A POST so that read-only credentials cannot reach it: an API key needs `read_write`, an OAuth token `mcp:write`. - [Restore trade account](/api-integration/api-specification/trade-accounts/post-trade-accounts-id-restore): Restores a soft-deleted trade account, unless its exchange account was linked again meanwhile. - Sync: Ask Pear to import or refresh the history of a trade account from its venue. - [Sync](/api-integration/api-specification/sync): Ask Pear to import or refresh the history of a trade account from its venue. - [Request a sync](/api-integration/api-specification/sync/post-sync-refresh): Asks the server to sync this trade account's history from the venue now (the first full import, or a refresh). Always answers 202 before the sync runs; the sync happens in the background, and repeated requests within about 60 seconds are coalesced into one run. The body reports the account's state as last known, not the result of this request: `neverSynced` is true while Pear holds no sync starting point for the account (no recorded sync progress, no open position, no provisional fill), in which case this request queued the first full import, and `credentialsRejection` names why the venue refused the stored credentials on the last attempt. There is no completion callback: to see the outcome, call again later (or re-read the synced data) — `neverSynced` turns false once a sync run records progress, and `credentialsRejection` clears once an attempt succeeds or the credentials are updated. - Markets: Read normalized markets, and the pair and basket markets the selector shows. - [Markets](/api-integration/api-specification/markets): Read normalized markets, and the pair and basket markets the selector shows. - [Retrieve normalized pair and basket markets](/api-integration/api-specification/markets/get-markets-baskets): Returns one offset page of basket markets on one connector: first the baskets Pear has stats for (traded through Pear in the last 7 days, or holding Pear open interest today), ordered by 24h volume, then open interest, then 7-day volume, all descending; then every generated 1-long/1-short pair of priced instruments not already listed. A basket whose legs are not all in `scope`, or any of whose legs has no cached price or funding rate yet, is left out. `search` is case-insensitive and ignores whitespace: - any basket with stats matches when the search is a substring of its basket key, its display symbol (e.g. `btc,sol/eth`) or one of its leg instrument ids; - a 1-long/1-short basket also matches leg by leg: a plain term when it is a substring of either leg's instrument id, base symbol or `BASE/QUOTE` pair; `LONG1,LONG2/SHORT1,SHORT2` when the long leg matches one long term and the short leg one short term, so `btc/eth,sol` finds BTC long against ETH or SOL short. A multi-leg basket is matched only by the first rule. `count` is the total number of matching baskets across all pages; page with `offset` until `offset + markets.length >= count`. - [Count the positions and traders that ever opened each basket](/api-integration/api-specification/markets/post-markets-baskets-positions): Reports, per requested basket key, how many positions — and how many distinct traders — have ever opened that basket: cumulative best-effort counters bumped at open, never decremented on close. A basket is named by its canonical key — the basketKey /markets/baskets reports, derivable client-side with deriveBasketKey from @pear-protocol/utils. Counts are summed over the connectors in scope that stored the key, and an absent connector puts every venue in scope, so a trader active on two venues counts on each. Positions opened entirely on the exchange are excluded, so a count only reports Pear activity. - [Retrieve normalized markets](/api-integration/api-specification/markets/get-markets): Returns every instrument on one connector in `scope` joined with its live price, venue funding rate and venue 24h stats, ordered by base symbol. An instrument the price feed has not yet delivered a price, funding rate, 24h volume, open interest or 24h change for is left out rather than returned partially, so the list can be shorter than `/instruments` right after a listing or a feed restart. `totals` sums the rows returned. - Recommended Baskets: List the baskets Pear curates. - [Recommended Baskets](/api-integration/api-specification/recommended-baskets): List the baskets Pear curates. - [List recommended baskets](/api-integration/api-specification/recommended-baskets/get-baskets-recommended): Publicly list every admin-curated recommended basket in admin display order - Instruments: List tradable instruments, and map an instrument symbol to its id. - [Instruments](/api-integration/api-specification/instruments): List tradable instruments, and map an instrument symbol to its id. - [Retrieve a list of instruments](/api-integration/api-specification/instruments/get-instruments): Returns every instrument of one connector in `scope` (default `all`), ordered by base symbol, with its order grid, minimums and tradeability. - [Retrieve a lite list of instruments](/api-integration/api-specification/instruments/get-instruments-lite): Returns the same instruments as `GET /instruments`, trimmed to id, base, type, margin modes and contract size, for clients that only need to identify instruments and convert contract quantities. - [Retrieve instrument symbol to ID map](/api-integration/api-specification/instruments/get-instruments-symbol-to-id-map): Returns a map from symbol to instrument id for one connector: perps keyed by base symbol, spot markets by `BASE/QUOTE`. - Prices: Read mid and mark prices. - [Prices](/api-integration/api-specification/prices): Read mid and mark prices. - [Returns a map of mid and mark prices](/api-integration/api-specification/prices/get-prices): Returns the latest cached mid and mark prices for every instrument of one connector. An instrument without a cached price of a kind is absent from that map. Use it on page load only; refresh prices from the realtime API. - Funding: Read funding rates. - [Funding](/api-integration/api-specification/funding): Read funding rates. - [Retrieve funding rates](/api-integration/api-specification/funding/get-funding): Returns the current venue funding rate and next funding time for every instrument of one connector that has funding data cached. - Trade: Open, adjust, close, and reverse positions. - [Trade](/api-integration/api-specification/trade): Open, adjust, close, and reverse positions. - [Open a position](/api-integration/api-specification/trade/post-trade-open): Open a position on a basket of one or more instruments. The set of instruments identifies the position. - `MARKET`: trades now with immediate-or-cancel orders. If a position on the same set of instruments already exists, the request becomes an adjust of that position: the returned execution has `intent: ADJUST`. `trigger` attaches a TP/SL close trigger once the open succeeds; when the open becomes an adjust, `trigger` is ignored and no trigger is created. - `CHASE_LIMIT`: Hyperliquid only. Rests post-only maker orders at the best price and follows it until filled or `deadlineSec` passes, then applies `onDeadline`. Refused if a position on the same set of instruments exists, or another chase is working one of the instruments. Stop it early with `POST /executions/{id}/cancel` or `/complete`. The trade runs asynchronously: the response is `202` with the accepted execution, usually still `IDLE`. Poll `GET /executions/{id}` (or follow the execution events) until `status` is `COMPLETED`, `FAILED` or `CANCELLED`; a refusal found while trading, such as a leg below the venue minimum or a stale price, ends the execution `FAILED` with `failure` rather than an HTTP error. Not idempotent: a retried request places a second trade. - [Adjust a position](/api-integration/api-specification/trade/post-trade-positionid-adjust): Change the size of legs of an open position. Each leg adds to or reduces exposure by its `side`. - `MARKET`: trades now with immediate-or-cancel orders; `reduceOnly` legs only reduce. - `CHASE_LIMIT`: Hyperliquid only. Rests post-only maker orders at the best price and follows it until filled or `deadlineSec` passes, then applies `onDeadline`. A leg that opposes the exposure on its instrument rests reduce-only. Refused while another execution holds the position, while a schedule runs on it, or while another chase works one of its instruments. A TP/SL trigger that fires cancels the chase and closes the position. Stop it early with `POST /executions/{id}/cancel` or `/complete`. The trade runs asynchronously: the response is `202` with the accepted execution, usually still `IDLE`. Poll `GET /executions/{id}` (or follow the execution events) until `status` is `COMPLETED`, `FAILED` or `CANCELLED`; a refusal found while trading, such as a leg below the venue minimum or a stale price, ends the execution `FAILED` with `failure` rather than an HTTP error. Not idempotent: a retried request places a second trade. - [Close a position](/api-integration/api-specification/trade/post-trade-positionid-close): Close the whole position. - `MARKET`: closes now with immediate-or-cancel orders. A running chase open on the position is cancelled first and what it filled is closed. If a chase close is already working the position, it is completed at market instead and the response returns that chase execution (`orderType: CHASE_LIMIT`). - `CHASE_LIMIT`: Hyperliquid only. Rests post-only reduce-only orders and follows the best price until filled or `deadlineSec` passes, then applies `onDeadline`. Refused while another execution holds the position, while a schedule runs on it, while an increase trigger is active on it, or while another chase works one of its instruments. A TP/SL trigger that fires cancels the chase and closes the rest. The trade runs asynchronously: the response is `202` with the accepted execution, usually still `IDLE`. Poll `GET /executions/{id}` (or follow the execution events) until `status` is `COMPLETED`, `FAILED` or `CANCELLED`; a refusal found while trading, such as a leg below the venue minimum or a stale price, ends the execution `FAILED` with `failure` rather than an HTTP error. Not idempotent: a retried request places a second trade. - [Reverse a position](/api-integration/api-specification/trade/post-trade-positionid-reverse): Flip every leg of the position to the opposite side with immediate-or-cancel orders (`MARKET` only). The trade runs asynchronously: the response is `202` with the accepted execution, usually still `IDLE`. Poll `GET /executions/{id}` (or follow the execution events) until `status` is `COMPLETED`, `FAILED` or `CANCELLED`; a refusal found while trading, such as a leg below the venue minimum or a stale price, ends the execution `FAILED` with `failure` rather than an HTTP error. Not idempotent: a retried request places a second trade. - [Close all positions](/api-integration/api-specification/trade/post-trade-close-all): Close every open position of the trade account with immediate-or-cancel orders (`MARKET` only). Unlike the other trade routes, this call waits for the whole run before answering: running chases are stopped first (a chase close is completed at market, a chase open is cancelled and its fills closed), then every position is closed. The `202` response carries every execution already in its final status, and `preempted` lists the chases it had to stop. Expect it to take as long as the closes themselves. Not idempotent: a retried request places a second trade. - Triggers: Create and cancel triggers, which include take profit and stop loss. - [Triggers](/api-integration/api-specification/triggers): Create and cancel triggers, which include take profit and stop loss. - [Create an open or add-to-position trigger](/api-integration/api-specification/triggers/post-triggers-open): Create a conditional order that opens a new position (`intent: OPEN`) or adds to an existing one (`intent: ADJUST` with `positionId`) once its `condition` is met. The trigger is stored `ACTIVE` and returned synchronously; the server then evaluates the condition continuously and fires it once, placing the market order (`type: MARKET`) or starting a TWAP schedule (`type: TWAP`, reported as `scheduleId`). Follow it with `GET /triggers`: after firing its `status` is `TRIGGERED` and its `fills` list the orders it placed; the resulting executions appear on `GET /executions` with `includeTriggers=true`. - `OPEN` is refused if a position on the same set of instruments is already open. Its `attachTriggers` (at most 5, at most one trailing) become close triggers on the new position after it opens. - `ADJUST` needs an open position of this trade account with no trade in flight, and a position holds at most 5 active triggers (ladder rungs excluded), at most one of them trailing. Not idempotent: retrying a request creates a second trigger. - [Create a close trigger](/api-integration/api-specification/triggers/post-triggers-close): Create a conditional order that closes or reduces an open position once its condition is met: a static take-profit or stop-loss (`bracketType` with a threshold condition) or a trailing stop (`trailing` with a `*_trailing` condition). - **Direction.** A static close fires at or above `threshold` for `TAKE_PROFIT` and `NONE`, strictly below it for `STOP_LOSS`. For a `price` condition on an instrument the position is short, send the crossing direction in `bracketType` and the intent in `semanticBracketType` (see those fields). - **Size.** `type: MARKET` closes `closePercent` of the position (all of it when omitted) in one market order; `type: TWAP` closes the whole position over `durationSec` as a schedule. - **Limits.** The position must be open with no trade in flight, and holds at most 5 active triggers (ladder rungs excluded), at most one of them trailing. The trigger is stored `ACTIVE` and returned synchronously; it fires once, after which `GET /triggers` shows it `TRIGGERED` with its fills. It is cancelled automatically when the position closes, and a size-dependent one (`notional`, `upnl` and their trailing forms) also on a resize when `onPositionResize` is `cancel`. Not idempotent: retrying a request creates a second trigger. - [Retrieve a list of triggers](/api-integration/api-specification/triggers/get-triggers): List the trade account's triggers, newest first, cursor-paginated. - [Cancel a trigger](/api-integration/api-specification/triggers/patch-triggers-triggerid-cancel): Queue the cancellation of an `ACTIVE` trigger and return at once (202); its `status` becomes `CANCELLED` with `cancelledReason: USER` shortly after, as `GET /triggers` shows. - [Cancel all triggers](/api-integration/api-specification/triggers/patch-triggers-cancel-all): Queue the cancellation of every `ACTIVE` trigger of the trade account, ladder rungs included, and return their ids at once (202); each becomes `CANCELLED` shortly after. - Schedules: Create and cancel schedules, which execute against a position over time. - [Schedules](/api-integration/api-specification/schedules): Create and cancel schedules, which execute against a position over time. - [List schedules](/api-integration/api-specification/schedules/get-schedules): Returns the trade account's schedules, newest first, with cursor-based pagination. - [Create a new schedule](/api-integration/api-specification/schedules/post-schedules): Trade in slices over a time window instead of all at once: `OPEN` builds a position on a basket (or adds to the open one), `CLOSE` winds an open position down in full. `TWAP` spreads the size evenly; `VWAP` follows historical volume and runs on `hyperliquid` and `lighter` only. Creation is synchronous: the response carries the ACTIVE schedule, and slices then run in the background. Each slice is an execution of its own. Poll `GET /schedules/{scheduleId}` for progress and per-slice fills; the schedule ends as COMPLETED, PARTIALLY_FILLED (TWAP only), FAILED (see `failure`) or CANCELLED. Before anything is stored the plan is checked: a basket holds at most one ACTIVE schedule, and an even split of the size into slices, each shrunk by the maximum size randomization, must still clear each leg's venue minimum order size. `VWAP` is checked against the same even split, so a VWAP slice in a low-volume period can still fall below a minimum once running. Not idempotent: a retried request after success answers 409 for the same basket. - [Get schedule details](/api-integration/api-specification/schedules/get-schedules-scheduleid): Returns one schedule with a page of its execution history: planned slices by index, with each executed slice's fills when include=fills. Slices are paged by index: pass `nextCursor` back as `cursor` until it is absent. - [Cancel a schedule](/api-integration/api-specification/schedules/patch-schedules-scheduleid-cancel): Stop an ACTIVE schedule: no further slice runs and it ends as CANCELLED with `cancelledReason` USER. Fills from slices that already ran are kept. Returns once the cancellation is recorded. - [Cancel all schedules](/api-integration/api-specification/schedules/patch-schedules-cancel-all): Cancel every ACTIVE schedule on the trade account, as `PATCH /schedules/{scheduleId}/cancel` does for one, and return their ids. - Ladders: Create, read, and cancel ladder orders. - [Ladders](/api-integration/api-specification/ladders): Create, read, and cancel ladder orders. - [List ladders](/api-integration/api-specification/ladders/get-ladders): Returns the trade account's ladders, newest first, with cursor-based pagination. - [Create a new ladder](/api-integration/api-specification/ladders/post-ladders): Create a ladder order as a parent with child trigger rungs. The band from `config.thresholdStart` to `config.thresholdEnd` is cut into `config.levels` rungs, each a trigger on `condition` at its own threshold. Each leg's `amount` is the total over the ladder and is split across the rungs, so the rungs together trade the full size. When a rung fires it places a market order for its share: the first opens the position (with any `attachTriggers`), later ones add to it. If the basket already has an OPEN position, every rung adds to it. Creation is synchronous and nothing trades yet. Follow the rungs with `GET /ladders/{ladderId}` (each rung is a trigger that turns TRIGGERED when it fires; its trade is listed by `GET /executions` with `includeTriggers=true`). A band the market has already reached, or one priced from data older than 60 seconds, is refused. Not idempotent: a retry creates a second ladder. - [Retrieve a ladder](/api-integration/api-specification/ladders/get-ladders-ladderid): Returns a ladder parent with ordered child trigger rungs. - [Cancel a ladder](/api-integration/api-specification/ladders/post-ladders-ladderid-cancel): Cancel all active child rungs and mark the ladder as cancelled. Rungs that already fired, and the position they built, are left as they are. - Rebalance: Rebalance a position now, or configure auto-rebalance. - [Rebalance](/api-integration/api-specification/rebalance): Rebalance a position now, or configure auto-rebalance. - [Manually rebalance a position](/api-integration/api-specification/rebalance/post-rebalance-manual-positionid): Manually rebalance a position by providing the weightings: each leg is resized with a market order so its share of the position's gross USD notional matches its target weight. Synchronous: the response arrives after the adjustment trade has run, and `plan.outcome` says what happened. No execution id is returned; the trade is an ADJUST execution on the position. A leg already at its target is skipped. The rebalance changes the position, so an ACTIVE auto-rebalance config on it is paused (`pausedReason` POSITION_CHANGED). Not idempotent: a retry rebalances again from the new state. - [List auto-rebalance configs](/api-integration/api-specification/rebalance/get-rebalance-auto): List the auto-rebalance configs for the authenticated trade account, newest first, with cursor-based pagination. Cancelled configs are not listed. - [Create an auto-rebalance config](/api-integration/api-specification/rebalance/post-rebalance-auto): Create a bot that watches a position and auto-rebalances it when drift crosses tolerance. `minimumDriftPct` is a fraction (0.05 = 5%). Rebalances run in the background and are logged under `GET /rebalance/{positionId}/events`; the config pauses itself when the position changes or rebalances keep failing. A LIVE_BETA config reports beta state PENDING until its baseline is set. - [Update an auto-rebalance config](/api-integration/api-specification/rebalance/patch-rebalance-auto-id): Update drift threshold, timeframe, or status (ACTIVE/PAUSED). Reactivating re-validates the watched position, so a config whose pair no longer holds is rejected rather than silently reactivated. Only the fields sent change. - [Atomically replace an auto-rebalance config](/api-integration/api-specification/rebalance/post-rebalance-auto-id-replace): Replace the mode configuration without leaving the position without persisted automation. The old config stops and a new one, with a new id, takes its place in one step; the response carries the new config. Use it to switch `weightSource`. - [Cancel an auto-rebalance config](/api-integration/api-specification/rebalance/post-rebalance-auto-id-cancel): Cancel a config: it stops polling and drops out of lists; rebalance history is retained. - [List rebalance events for a position](/api-integration/api-specification/rebalance/get-rebalance-positionid-events): Paginated log of executed and failed rebalance attempts for a given position, newest first. Only auto-rebalance attempts are logged; a manual rebalance is not. - Leverage: Set the leverage of a trade account. - [Leverage](/api-integration/api-specification/leverage): Set the leverage of a trade account. - [Set leverage](/api-integration/api-specification/leverage/put-leverage): Set the leverage and margin mode for one instrument, or for up to 20 instruments at once with `items`, on the trade account's venue. `marginMode` is required on every venue except Bybit, which refuses it; every item is checked before any is applied. The call waits for the venue and runs in turn with the account's trades, once for the whole batch. A single instrument answers `{}`; a batch answers one result per item, in request order, and a symbol the venue refuses fails alone. Setting the same values again is harmless. - Margin: Add or remove margin on an open isolated position. - [Margin](/api-integration/api-specification/margin): Add or remove margin on an open isolated position. - [Adjust isolated margin](/api-integration/api-specification/margin/post-margin): Adds or removes margin on an open isolated position without changing its size. `amount` is signed: `"+50"` adds 50 USD, `"-50"` removes 50 USD. OKX is not supported: every OKX position is opened in cross margin. Retry-safe only with a key: a retry carrying the same `idempotencyKey` receives the outcome of the first attempt, while a retry without one moves the margin again. The response carries the key used as `adjustmentId`. - Saved Baskets: Save, update, and delete basket templates. - [Saved Baskets](/api-integration/api-specification/saved-baskets): Save, update, and delete basket templates. - [List saved baskets](/api-integration/api-specification/saved-baskets/get-baskets-saved): List all saved baskets for the trade account, most recently updated first - [Create saved basket](/api-integration/api-specification/saved-baskets/post-baskets-saved): Save a basket snapshot under a name (unique per trade account, case-insensitive). A trade account holds at most 100 saved baskets. Legs: 1 to 20, each symbol at most once, weights summing to 1 (within 1e-9); a leg's `id`, when sent, must equal its `symbol`. - [Update saved basket](/api-integration/api-specification/saved-baskets/patch-baskets-saved-id): Rename a saved basket and/or replace its legs; send at least one of `name` and `legs`. New legs follow the same rules as on create. - [Delete saved basket](/api-integration/api-specification/saved-baskets/delete-baskets-saved-id): Delete a saved basket by ID - Positions: List open positions and closed-trade history. - [Positions](/api-integration/api-specification/positions): List open positions and closed-trade history. - [Retrieve a list of positions](/api-integration/api-specification/positions/get-positions): Returns the position entities of the trade account named by `X-Trade-Account-Id`, on that account's connector. `status` takes one value or a comma-separated list (`OPEN,OPENING`). Paging: `nextCursor` is the ISO-8601 `createdAt` or `updatedAt` of the last row, whichever column `orderBy` sorts on, so keep `orderBy` unchanged while paging; the next page holds rows strictly past that instant, so rows sharing it can be skipped. An unparseable cursor is ignored and the first page is returned. The `connector` query parameter is accepted but ignored: the trade account's own connector always applies. - [Retrieve closed-position history](/api-integration/api-specification/positions/get-positions-closed): Returns server-composed closed positions, newest close first, with per-leg entry and exit economics. A page may hold fewer than `limit` positions and still return a `nextCursor`: closed positions with no confirmed fills are skipped. Page until `nextCursor` is absent, never until a page comes back short. `nextCursor` is opaque; an unusable cursor is ignored and the first page is returned. `startDate`/`endDate` take ISO-8601 or epoch milliseconds; a value that parses as neither is ignored (no bound). `includeSteps` is accepted only together with `positionId`. - [Retrieve open-position history](/api-integration/api-specification/positions/get-positions-open): Returns server-composed open positions — the realized part of every open position — newest opened first, with lifetime volume, live gross unrealized PnL, and per-leg entry, exit and remaining economics. One row per open position: a position whose fills are not visible yet still appears, carrying a zero economic state and its attributed funding. Page until `nextCursor` is absent; `nextCursor` is opaque, and an unusable cursor is ignored and the first page is returned. `includeSteps` is accepted only together with `positionId`, because account-wide step history is unbounded. - Trades: Read trade history, with fills grouped by execution. - [Trades](/api-integration/api-specification/trades): Read trade history, with fills grouped by execution. - [List grouped trade history](/api-integration/api-specification/trades/get-trades): Returns fill-level trades grouped by execution, with compound cursor pagination. The history is a live view: when reconciliation replaces a provisional fill, its group time moves to the venue timestamp (always earlier), so a client paging concurrently with a reconciliation may receive that group a second time. Group ids are stable — deduplicate by id; groups are never skipped. `nextCursor` is opaque; an unusable cursor is ignored and the first page is returned. A group `id` is `execution:` for the fills one Pear execution placed, or `fill:` for a single fill no execution recorded (an external or synced fill). Groups are ordered newest first by `at`, their earliest fill. Each fill carries its effect on the position, per asset: `basisBefore`/`basisAfter` are the signed quantity (`+` long, `-` short) and entry basis the position held immediately before and after the fill (`FLAT`: no quantity; `PRICED`: the weighted-average entry price; `UNPRICED`: a zero-price synthetic fill opened part of the basis, so no entry price is known). `positionEffect.kind` is `OPEN` (from flat), `INCREASE`, `REDUCE`, `CLOSE` (to flat) or `FLIP` (through flat to the other side, with both the reduced and the newly opened quantity). Every reducing kind carries a `realization`: `PRICED` with the entry and exit price and the gross PnL (USD, `+` is a gain) booked on the reduced quantity, or `UNPRICED` when no price existed to value it. `settlement` is `PROVISIONAL` until the venue confirms the fill, then `CONFIRMED`; a provisional fill can still change price, quantity and fees. `tradeFee` (venue) and `pearFee` are absent while no fee is recorded for the fill yet. - Executions: Track the executions that trade requests create. - [Executions](/api-integration/api-specification/executions): Track the executions that trade requests create. - [List executions](/api-integration/api-specification/executions/get-executions): Lists the trade account's executions, newest first, with cursor pagination. Executions spawned by schedules and triggers are hidden unless `includeSchedule` / `includeTriggers` is set. - [Get execution](/api-integration/api-specification/executions/get-executions-id): Returns one execution with its legs summed; poll it after a `202` from a trade route until `status` is `COMPLETED`, `FAILED` or `CANCELLED`. `GET /executions/{id}/orders` pages its venue orders. - [List execution orders](/api-integration/api-specification/executions/get-executions-id-orders): Returns one execution's venue orders, newest first, with cursor-based pagination and no cap: every resting attempt, re-price, cross and refusal. - [Cancel a chase limit execution](/api-integration/api-specification/executions/post-executions-id-cancel): Stores a cancel for a CHASE_LIMIT execution and answers at once; the engine pulls every resting order and keeps what filled. Poll `GET /executions/:id` for the ending (`status` and `stopCause`). `CANCELLING`: the cancel is stored and runs. `CROSSING`: a complete was stored first and runs instead. A settled execution answers `SKIPPED`. A basket that has not started yet (`IDLE`) answers `CANCELLING`: the open ends it `CANCELLED` before any order rests. - [Complete a chase limit execution](/api-integration/api-specification/executions/post-executions-id-complete): Stores a complete for an ACTIVE CHASE_LIMIT execution and answers at once; the engine pulls every resting order and trades the remainder at market with the account slippage setting. Poll `GET /executions/:id` for the ending. `CROSSING`: the complete is stored and runs. `CANCELLING`: a cancel was stored first and runs instead. A refused trading agent sends `execution.blocked`; the execution ends `FAILED` with `stopCause: UNAUTHORIZED` once its orders are off the venue. A settled execution answers `SKIPPED`. A basket that has not started yet answers 409, or the stored stop when one exists. - Fills: Read the fills of an account or a position. - [Fills](/api-integration/api-specification/fills): Read the fills of an account or a position. - [List fills](/api-integration/api-specification/fills/get-fills): Lists the trade account's fills with cursor pagination, newest first by default (`orderBy`). Each fill lists how it splits across positions in `assignments`. Superseded (`RECONCILED`) fills are never listed. - [List fills of a position](/api-integration/api-specification/fills/get-fills-positionid): Lists every fill of one position, oldest first, in one unpaginated response; quantities, USD values and fees are the position's share of each fill. An unknown position id, or one of another trade account, returns an empty list rather than 404. - Portfolio: Read the portfolio overview and its risk analytics. - [Portfolio](/api-integration/api-specification/portfolio): Read the portfolio overview and its risk analytics. - [Retrieve portfolio overview](/api-integration/api-specification/portfolio/get-portfolio): Returns portfolio overview metrics for the trade account named by `X-Trade-Account-Id`. **Range.** `startDate` is inclusive and `endDate` exclusive; each takes ISO-8601 or epoch milliseconds. `endDate` defaults to now and an absent `startDate` means all history. A value that parses as neither format is ignored, as if it were absent. **Intervals.** `realizedCashflow.intervals` and `volume.intervals` are returned only when neither date is given. Each family has a fixed bucket count, in UTC: `oneDay` 24 hourly buckets ending with the current hour, `oneWeek` 7 and `oneMonth` 30 daily buckets ending today, `oneYear` 12 monthly buckets ending this month, and `all` 10 equal buckets from the UTC day of the first fill or funding payment. **Units.** Money amounts are USD as JSON numbers (floats), not decimal strings. `source=pear` counts only fills placed through Pear, and affects `volume` only; PnL, fees and funding always cover every fill. `openSnapshot` is the live state now, whatever the range. - [Retrieve portfolio analytics](/api-integration/api-specification/portfolio/get-portfolio-analytics): Returns realized cashflow, completed-position statistics, per-basket performance, open exposure and volume for the trade account named by `X-Trade-Account-Id`. **Range.** `startDate` is inclusive and `endDate` exclusive; each takes ISO-8601 or epoch milliseconds, and a value that parses as neither is ignored, as if absent. `endDate` defaults to now. Without `startDate`, `interval` picks the start in UTC days counted back from the day `endDate` falls in: `1d` that day, `1w` 7 days, `1m` 30 days, `1y` (the default) 366 days, `all` from the first fill or funding payment. `interval` is ignored when `startDate` is given. `config` echoes the range the server resolved. **Series.** `realizedCashflow.series` and `volume.series` hold one bucket per UTC day of the range (the first bucket starts at midnight UTC of the start day). They are returned unless `includeSeries=false`. **Units.** Money amounts are USD as JSON numbers (floats), not decimal strings. `source=pear` counts only fills placed through Pear, and affects `volume` only. `openSnapshot` is the live state now, whatever the range. - TCA: Read transaction cost analysis for an execution or a position. - [TCA](/api-integration/api-specification/tca): Read transaction cost analysis for an execution or a position. - [Retrieve TCA metrics for an execution](/api-integration/api-specification/tca/get-tca-executions-executionid): Returns the transaction cost analysis (TCA) of one execution of the trade account: its summary, each fill's metrics, and the benchmark prices they were measured against, newest fill metric first. An execution that does not exist, belongs to another account, or has no TCA yet answers 200 with `summary` absent and an empty `fillMetrics`, not 404. - [Retrieve TCA metrics for a position](/api-integration/api-specification/tca/get-tca-positions-positionid): Returns the TCA fill metrics of one position of the trade account, newest first, cursor-paged. Where a fill was split across positions, its quantity-dependent amounts (notional, slippage, spread cost) are scaled to the share assigned to this position, and the fees are that share's fees. Pass the previous page's `nextCursor` (the ISO-8601 `createdAt` of its last metric) as `cursor`; the next page holds metrics created strictly before it, so metrics sharing that instant can be skipped. An unknown position answers an empty page. - [Retrieve TCA execution summaries](/api-integration/api-specification/tca/get-tca-summary): Returns the trade account's TCA execution summaries, newest first, cursor-paged, and `totals` over every summary in the `from`/`to` window (not just the page). `from` and `to` are inclusive ISO-8601 bounds on when the summary was recorded, not when the execution ran. Pass the previous page's `nextCursor` (the ISO-8601 `createdAt` of its last summary) as `cursor`; the next page holds summaries created strictly before it, so summaries sharing that instant can be skipped. - Statistics: Read protocol volume, open interest, and the trader leaderboard. - [Statistics](/api-integration/api-specification/statistics): Read protocol volume, open interest, and the trader leaderboard. - [Get PEAR Protocol volume statistics](/api-integration/api-specification/statistics/get-statistics-volume): Time series of the fills routed through Pear, one point per `resolution` bucket: USD volume, Pear fees, fill count, active users and first-time users. `startDate`/`endDate` are ISO 8601 and inclusive on the bucket start; `timestamp` is the bucket start in Unix epoch milliseconds. Without `connector` the connectors are aggregated into one series. `clientId` narrows to fills attributed to one client code, `other` to fills attributed to no client, and an unknown code returns an empty series. - [Get PEAR Protocol open interest statistics](/api-integration/api-specification/statistics/get-statistics-oi): Time series of the USD open interest and count of open Pear positions, snapshotted hourly; each `resolution` bucket holds its latest snapshot. `startDate`/`endDate` are ISO 8601 and inclusive on the bucket start; `timestamp` is the bucket start in Unix epoch milliseconds. Without `connector` the connectors are aggregated into one series. `clientId` narrows to fills attributed to one client code, `other` to fills attributed to no client, and an unknown code returns an empty series. - [Get the PEAR Protocol trader leaderboard](/api-integration/api-specification/statistics/get-statistics-leaderboard): Ranks trade accounts by net PnL, volume, trade count or return on capital. Returns at most 200 rows. `startDate`/`endDate` are Unix epoch seconds: start inclusive, end exclusive. Volume and trade count count every fill in the window; PnL, fees and ROI count only positions opened inside it. Unrealized PnL is included whenever the window still contains now — an absent endDate, or one that has not yet arrived; only a window that has already closed returns settled realized PnL alone. ROI is the account's return on capital: the summed PnL net of fees of its measurable positions divided by the summed peak cash each of them committed, so a position weighs by the capital behind it; it is omitted for an account whose positions could none of them be measured. `clientId`, `connector`, `asset` and `includeUnlinkedX` select accounts before the top-N cut. Accounts whose owner linked no X account are left off the board; pass includeUnlinkedX=true to rank them too. A trader who linked X and then withheld the handle keeps their row, unnamed. Open to everyone, and the same board for everyone: the linked X handle, name, avatar and user id are returned to any caller, unless their owner has hidden them. Every row includes all ACTIVE follower accounts, their visible X profiles, and followerCount. Followers are current when the leaderboard cache is built, independent of the performance date range; membership and X visibility changes appear when the ranking cache expires. Boards are cached per minute; a request that needs a fresh ranking while another one is running gets a 503 and should retry shortly. Deprecated: read a published board from `GET /statistics/leaderboard/{slug}` instead (see the `Link` response header). - [Get a published PEAR Protocol leaderboard by slug](/api-integration/api-specification/statistics/get-statistics-leaderboard-slug): Serves the board last published under this slug, with its window and filters fixed by the board. Seeded slugs: 24h, 7d, 30d, 1y, all-time (trailing windows), weekly-leaderboard (weeks from Monday 14:00 UTC), and the fixed campaigns trading-competition, hyperliquid-leaderboard, lighter-leaderboard, hyperliquid-vs-lighter-hyperliquid and hyperliquid-vs-lighter-lighter; more may be added, and no route lists them. sortBy (totalNetPnl, volume, trades, roi) defaults to the board's published default and is echoed back; limit defaults to 200 and has no upper cap. Accounts deleted since publication are removed before sorting and cutting, so limit returns a full board. updatedAt (ISO) says when the board was computed and is never refused for its age; window bounds are unix seconds, absent when open, and can be passed back to GET /statistics/leaderboard. status is upcoming (empty, updatedAt is evaluation time), live (published snapshot), or final (fixed campaign frozen archive, updatedAt is archivedAt). Fixed campaigns switch at exactly endDate. Unknown or paused slugs return 404; missing current snapshots or final archives return 503. - [List the archived periods of a PEAR Protocol leaderboard](/api-integration/api-specification/statistics/get-statistics-leaderboard-slug-archive): Lists every finished period archived under this slug, newest first, without their rows: startDate and endDate in unix seconds and archivedAt (ISO), when the period was ranked. Inactive boards are listed too. A board whose window never ends a period (e.g. 24h, all-time) returns an empty list. Takes no query parameters and is not paginated. Unknown slugs return 404. - [Get an archived period of a PEAR Protocol leaderboard](/api-integration/api-specification/statistics/get-statistics-leaderboard-slug-archive-startdate): Serves the finished period of this slug starting at startDate (unix seconds, as listed by the archive route), ranked settled when it ended. Inactive boards are served too. sortBy (totalNetPnl, volume, trades, roi) defaults to the sort the period was archived under and is echoed back; limit defaults to 200 and has no upper cap. Accounts deleted since are removed before sorting and cutting. window carries both bounds in unix seconds; archivedAt (ISO) is when the period was ranked, not a freshness signal. Unknown slugs and periods never archived return 404. - Traders: Discover traders to follow, and read a public trader profile. - [Traders](/api-integration/api-specification/traders): Discover traders to follow, and read a public trader profile. - [List curated traders](/api-integration/api-specification/traders/get-traders-curated): One page of active curated venue addresses with their display name, category and X account, newest first; search and category narrow it - [List tracked builders](/api-integration/api-specification/traders/get-traders-builders): Every Hyperliquid builder whose most profitable users Pear tracks, by name. The builder and HyperTracker lists under /traders are snapshots Pear copies from HyperTracker on a schedule; `snapshotAt` says when. - [List a builder's top traders](/api-integration/api-specification/traders/get-traders-builder-traders): One page of a tracked builder's users ranked by PnL over a window; an untracked builder is empty - [List the most favorited traders](/api-integration/api-specification/traders/get-traders-most-favorited): One page of the wallets HyperTracker users favorite most, all-time - [List the top claimed traders](/api-integration/api-specification/traders/get-traders-top-claimed): One page of wallets whose owners claimed and verified them on HyperTracker, ranked by PnL over a window - [List Hyperliquid's top traders](/api-integration/api-specification/traders/get-traders-hyperliquid-leaderboard): One page of Hyperliquid's public leaderboard: the top 50 by PnL, or by ROI among accounts worth at least $10k with at least $100k volume and $10k PnL, over a window - [Read one ordered account performance series ready to render](/api-integration/api-specification/traders/get-traders-tradeaccountid-performance): The account's equity, PnL and return over `range`, oldest point first, at the times its performance was captured: hourly for `24h` and `7d`, at most one point per day for `30d` and per week for `1y` and `all`. Missed captures are skipped, never interpolated. - `equityUsd` is absent where no equity reading at most an hour old backs the point. - `pnlUsd` is the net PnL change since the first point in the range with accounting, and is absent before it or where accounting is missing. - `roiPercent` is the PnL since the first point with accounting and positive equity, divided by that equity, in percent; deposits and withdrawals never move the denominator. Absent before that point. - `hasGap` turns true at the first point whose accounting left out a value it could not measure, and stays true for the rest of the series. - [Read paginated public trader closed-position history](/api-integration/api-specification/traders/get-traders-tradeaccountid-closed-positions): One cursor page of the account's closed positions, most recently closed first, without funding or step detail. `startDate`/`endDate` bound the close time (inclusive) and accept an ISO 8601 date-time or Unix epoch milliseconds as digits. Page with `cursor` until `nextCursor` is absent. - [Read public trader identity, recent trading records, and all current followers](/api-integration/api-specification/traders/get-traders-tradeaccountid): Returns the latest 20 records per trading section and the complete ACTIVE follower list. Follower profiles respect X visibility settings. Missing and deleted leader accounts are unavailable. Anonymous by default. With `includeCopyState=true` the request must carry a credential and an `X-Trade-Account-Id` header naming one of your own live trade accounts; each position then reports `copyStatus`/`copyReason`, the result of that account copying this trader. - Statistics Totals: Read the all-time protocol totals. - [Statistics Totals](/api-integration/api-specification/statistics-totals): Read the all-time protocol totals. - [Get PEAR Protocol all-time statistics totals](/api-integration/api-specification/statistics-totals/get-statistics-totals): All-time totals of fills routed through Pear: USD volume, Pear fees, fill count and distinct users, on one connector or (without `connector`) across all of them, where a user active on several connectors counts once. `clientId` narrows them to the fills attributed to one client code; `other` selects fills attributed to no client, and an unknown code returns all zeros. - Fees: Quote the trading fee of the selected trade account. - [Fees](/api-integration/api-specification/fee): Quote the trading fee of the selected trade account. - [Quote the trading fee and fee recipient](/api-integration/api-specification/fee/get-fee): Returns the trading fee in canonical bps, the connector fee recipient and the derivation behind them for the authenticated user's selected trade account. The connector is taken from the trade account. Pass clientId to quote the same attribution route a trade would carry. Quoting never redeems a capped discount. Derivation: the base rate for the caller's role and connector is replaced by a matching override, if any; the applicable discounts then reduce it, their rates adding up (not compounding) to at most 100%; the result rounds up to the next 0.1 bps. This is Pear's fee only: the venue's own trading fee is not included. - Fee Recipient: Read the fee recipient a connector must approve. - [Fee Recipient](/api-integration/api-specification/fee-recipient): Read the fee recipient a connector must approve. - [Get the fee recipient to approve for a connector](/api-integration/api-specification/fee-recipient/get-fee-recipient): Returns the connector-native fee recipient for the authenticated user's role — the builder address a Hyperliquid user approves, the integrator account index a Lighter user approves. Served from the same source the order path names, so the approval target and the fee recipient on orders cannot diverge. Absent when no recipient is configured for that connector and role, in which case there is nothing to approve; any connector may be asked, including one Pear collects no fee on. - Referrals: Create and bind referral codes, and read referral status. - [Referrals](/api-integration/api-specification/referrals): Create and bind referral codes, and read referral status. - [Create a referral code](/api-integration/api-specification/referrals/post-referrals-create): Issues one case-sensitive referral code to the authenticated user. A code the user already owns in the legacy referral registry is claimed rather than refused. Each user owns at most one code. Idempotent: resubmitting the code the user already owns answers 201 again. - [Bind a referral code](/api-integration/api-specification/referrals/post-referrals-bind): Permanently attributes the authenticated user to the owner of an exact case-sensitive code. The binding cannot be changed afterwards. Idempotent: binding the code the user is already bound to answers 204 again. - [List referred users](/api-integration/api-specification/referrals/get-referrals-referees): Returns the users bound to the authenticated referrer, with optional binding times, Pear execution counts, per-user and all-referee volume, the allocated Pear fees and referral earnings each referee generated for the referrer, and all-referee referrer earnings. Cursor-paged: pass the previous page's opaque `nextCursor`; an unusable cursor is ignored and the first page is returned. - [Get referral status](/api-integration/api-specification/referrals/get-referrals-status): Returns referral codes owned by the authenticated user and their permanent referrer code - Rewards: Read referral and copy-leader reward balances, and claim them. - [Rewards](/api-integration/api-specification/rewards): Read referral and copy-leader reward balances, and claim them. - [List reward claims](/api-integration/api-specification/rewards/get-rewards-claims): Returns the authenticated user's reward claims, newest creation first, cursor-paged. Each item carries the same lifecycle shape as the claim status endpoint. A malformed cursor is ignored and paging restarts from the newest claim. Pass the previous page's opaque `nextCursor` as `cursor`. - [Create a reward claim](/api-integration/api-specification/rewards/post-rewards-claims): Claims the caller's `claimable` reward balance, paid in USDC on Arbitrum to `destination`; the client never names an amount, and the payout may be capped below the balance by available custody (see `reservedAmount` on the claim). Session tokens only. A user has at most one claim in flight: while one is (`TRANSFER_INTENT_READY` or `PAYOUT_PENDING`), this call resumes it and its stored destination stays authoritative even if a retry submits another one. Answers 200 for every claim outcome; `status` says what happened. When a claim exists (`TRANSFER_INTENT_READY`, `PAYOUT_PENDING`, `PAID`, `RELEASED`) the body carries `claimId` and the `Location` response header points at `/rewards/claims/{claimId}`; poll it until `status` is `PAID` or `RELEASED`. The other statuses explain why no claim was created, and nothing is persisted for them. - [Get reward summary](/api-integration/api-specification/rewards/get-rewards): Returns the caller's referral and copy-leader reward balances (USDC) and whether payouts are open. `accrual.status` is `DISABLED` while reward balances are switched off; `payout.status` is `DISABLED` while new claims are not accepted. Earnings mature on the UTC day after they are booked. - [Get reward claim status](/api-integration/api-specification/rewards/get-rewards-claims-claimid): Returns the authenticated user's persisted claim lifecycle and known payout timestamps - Notifications: List notifications, and set the read state of one. - [Notifications](/api-integration/api-specification/notifications): List notifications, and set the read state of one. - [List notifications](/api-integration/api-specification/notifications/get-notifications): Returns the authenticated user's notifications, newest first, at most `limit` (≤ 100) per call. There is no cursor: to read further back, pass the oldest `createdAt` received as `endDate`. Both date bounds are inclusive, so that boundary notification comes back again and must be deduplicated by `id`. `parameters.type` tells which payload shape a notification carries; `category` says what happened. - [Mark notifications as read](/api-integration/api-specification/notifications/post-notifications-read): Marks a single notification (by `id`) or every notification created at or before `timestamp` (epoch milliseconds) as read. Send exactly one of the two. `updated` counts the notifications that changed; an unknown id, another user's notification, or one already read counts 0 rather than failing. - [Mark a notification as unread](/api-integration/api-specification/notifications/post-notifications-unread): Marks a single notification (by `id`) as unread again. `updated` is 0 for an unknown id, another user's notification, or one already unread. - Lighter: Lighter-specific helpers for API keys, integrator approval, account tier, fast withdrawal, and subaccounts. - [Lighter](/api-integration/api-specification/lighter): Lighter-specific helpers for API keys, integrator approval, account tier, fast withdrawal, and subaccounts. - [Mint Fun.xyz universal deposit addresses for a Lighter wallet](/api-integration/api-specification/lighter/post-misc-lighter-uda): Returns one deposit address per supported chain family, all crediting the wallet's zkLighter account. Works before the account exists: the first deposit creates it. Read `uda.status` first: `blocked` carries no address. zkLighter only; `/misc/lighter-rhc` has no deposit-address routes. - [Read Fun.xyz bridge deposits for a Lighter wallet](/api-integration/api-specification/lighter/get-misc-lighter-uda-walletaddress): Lists every deposit the bridge has seen for the wallet, with its current bridge status. Keyed by wallet, so it tracks a first deposit before the Lighter account exists. The wallet must be the caller's own signed-in EVM wallet. zkLighter only. - [Create a Lighter subaccount](/api-integration/api-specification/lighter/post-misc-lighter-sub-account-create): Signs and submits a create-subaccount transaction with the supplied main account API key. Needs no L1 wallet signature. - [Transfer perpetual collateral between a Lighter main account and subaccount](/api-integration/api-specification/lighter/post-misc-lighter-sub-account-transfer): Verifies both account indexes against the owning L1 address, then signs and submits the same-master transfer with the source account API key. The transfer is free and needs no L1 wallet signature. - [Set a Lighter subaccount's display metadata](/api-integration/api-specification/lighter/post-misc-lighter-sub-account-set-metadata): Authenticates as the main account and updates the target subaccount's name and description - [Create a Lighter API key pair ready for L1 signing](/api-integration/api-specification/lighter/post-misc-lighter-create-api-key): Step 1 of 2 of registering an API key. Generates a new key pair and returns it with a ChangePubKey transaction for slot `apiKeyIndex`, already signed with the new key. 1. Call this route and keep `privateKey`: the server returns it once, and it is the `apiPrivateKey` of every later call. 2. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 3. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex` and `apiKeyIndex` to `change-pub-key`. The transaction reserves the key slot's next nonce, so sign and submit promptly: any other transaction on that nonce first makes `change-pub-key` answer 409, and the flow restarts here. - [Register a Lighter API key on-chain](/api-integration/api-specification/lighter/post-misc-lighter-change-pub-key): Step 2 of 2 of registering an API key (see `create-api-key`). Attaches the L1 wallet signature to `txInfo` and submits it, then waits up to 10 s for Lighter to execute the registration; a 200 means the key is usable. - [Prepare an integrator approval transaction for L1 signing](/api-integration/api-specification/lighter/post-misc-lighter-prepare-approve-integrator): Step 1 of 2 of approving Pear as the account's integrator, so Pear can charge its fee on the account's orders. Signs an ApproveIntegrator transaction with the API key: it names the integrator account Pear's orders on this deployment name for the caller, Pear's configured maximum perps and spot fees, and an expiry 5 years out. 1. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 2. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex` and `apiKeyIndex` to `submit-approve-integrator`. - [Submit a signed integrator approval transaction](/api-integration/api-specification/lighter/post-misc-lighter-submit-approve-integrator): Step 2 of 2 (see `prepare-approve-integrator`). Attaches the L1 wallet signature to `txInfo` and submits the approval to Lighter. - [Create a Lighter auth token](/api-integration/api-specification/lighter/post-misc-lighter-create-auth-token): Creates an auth token for Lighter's private API from the API key, valid for `ttlSeconds` (default 600). Nothing is sent to Lighter, so a token is returned even for a key Lighter does not hold. - [Prepare a Lighter fast collateral withdrawal](/api-integration/api-specification/lighter/post-misc-lighter-prepare-fast-withdraw): Step 1 of 2 of a fast withdrawal. Signs, with the API key, a transfer of `amount` to Lighter's fast-withdraw pool, with `toAddress` bound into it; Lighter's quoted `fee` is charged on top. 1. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 2. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex`, `toAddress`, `apiKeyIndex` and `apiPrivateKey` to `submit-fast-withdraw`. - [Submit a Lighter fast collateral withdrawal](/api-integration/api-specification/lighter/post-misc-lighter-submit-fast-withdraw): Step 2 of 2 (see `prepare-fast-withdraw`). Attaches the L1 wallet signature and submits the transfer to Lighter's fast-withdraw processor. `accountIndex` and `toAddress` must match the prepared transfer. - [Change a Lighter account tier](/api-integration/api-specification/lighter/post-misc-lighter-change-account-tier): Moves the account onto the standard, plus, or premium tier, which Lighter allows once every 24 hours and only while the account holds no open orders or positions. Needs no L1 wallet signature. - Lighter (Robinhood Chain): The same Lighter helpers, for the Robinhood Chain deployment of Lighter. - [Lighter (Robinhood Chain)](/api-integration/api-specification/lighter-rhc): The same Lighter helpers, for the Robinhood Chain deployment of Lighter. - [Create a Lighter subaccount](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-sub-account-create): Signs and submits a create-subaccount transaction with the supplied main account API key. Needs no L1 wallet signature. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Transfer perpetual collateral between a Lighter main account and subaccount](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-sub-account-transfer): Verifies both account indexes against the owning L1 address, then signs and submits the same-master transfer with the source account API key. The transfer is free and needs no L1 wallet signature. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Set a Lighter subaccount's display metadata](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-sub-account-set-metadata): Authenticates as the main account and updates the target subaccount's name and description **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Create a Lighter API key pair ready for L1 signing](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-create-api-key): Step 1 of 2 of registering an API key. Generates a new key pair and returns it with a ChangePubKey transaction for slot `apiKeyIndex`, already signed with the new key. 1. Call this route and keep `privateKey`: the server returns it once, and it is the `apiPrivateKey` of every later call. 2. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 3. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex` and `apiKeyIndex` to `change-pub-key`. The transaction reserves the key slot's next nonce, so sign and submit promptly: any other transaction on that nonce first makes `change-pub-key` answer 409, and the flow restarts here. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Register a Lighter API key on-chain](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-change-pub-key): Step 2 of 2 of registering an API key (see `create-api-key`). Attaches the L1 wallet signature to `txInfo` and submits it, then waits up to 10 s for Lighter to execute the registration; a 200 means the key is usable. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Prepare an integrator approval transaction for L1 signing](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-prepare-approve-integrator): Step 1 of 2 of approving Pear as the account's integrator, so Pear can charge its fee on the account's orders. Signs an ApproveIntegrator transaction with the API key: it names the integrator account Pear's orders on this deployment name for the caller, Pear's configured maximum perps and spot fees, and an expiry 5 years out. 1. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 2. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex` and `apiKeyIndex` to `submit-approve-integrator`. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Submit a signed integrator approval transaction](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-submit-approve-integrator): Step 2 of 2 (see `prepare-approve-integrator`). Attaches the L1 wallet signature to `txInfo` and submits the approval to Lighter. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Create a Lighter auth token](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-create-auth-token): Creates an auth token for Lighter's private API from the API key, valid for `ttlSeconds` (default 600). Nothing is sent to Lighter, so a token is returned even for a key Lighter does not hold. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Prepare a Lighter fast collateral withdrawal](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-prepare-fast-withdraw): Step 1 of 2 of a fast withdrawal. Signs, with the API key, a transfer of `amount` to Lighter's fast-withdraw pool, with `toAddress` bound into it; Lighter's quoted `fee` is charged on top. 1. Sign `messageToSign` with the account's L1 wallet using EIP-191 `personal_sign` (viem `signMessage`). 2. Send that signature as `l1Signature`, `txInfo` unchanged, and the same `accountIndex`, `toAddress`, `apiKeyIndex` and `apiPrivateKey` to `submit-fast-withdraw`. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Submit a Lighter fast collateral withdrawal](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-submit-fast-withdraw): Step 2 of 2 (see `prepare-fast-withdraw`). Attaches the L1 wallet signature and submits the transfer to Lighter's fast-withdraw processor. `accountIndex` and `toAddress` must match the prepared transfer. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - [Change a Lighter account tier](/api-integration/api-specification/lighter-rhc/post-misc-lighter-rhc-change-account-tier): Moves the account onto the standard, plus, or premium tier, which Lighter allows once every 24 hours and only while the account holds no open orders or positions. Needs no L1 wallet signature. **Robinhood Chain deployment** (`lighter_rhc`): signs for chain id 466324 against `https://api.rh.lighter.xyz`, with **USDG** as collateral instead of USDC, and Pear's Robinhood Chain fee recipient for integrator approvals. Its accounts, API keys and nonces are separate from zkLighter's (`/misc/lighter`), and it has no UDA deposit routes. - Copy Subscriptions: Start, resize, resume, and stop copying a leader. - [Copy Subscriptions](/api-integration/api-specification/copy-subscriptions): Start, resize, resume, and stop copying a leader. - [List copy subscriptions](/api-integration/api-specification/copy-subscriptions/get-copy-subscriptions): The authenticated user's subscriptions with lifetime volume. Active subscriptions include live period PnL and ROI. Stopped Pear-leader subscriptions expose endCapture with the frozen calculated result when capture completes. - [Start copying a leader](/api-integration/api-specification/copy-subscriptions/post-copy-subscriptions): `X-Trade-Account-Id` is the **follower** account copies land in; it must be yours and on the leader venue. An account may follow only one leader, cannot follow while it has followers, and cannot follow a leader that itself follows. Existing leader positions are joined by default (set syncExistingPositions to false to skip them); joins run after the response, so every `joinResults` entry is UNCONFIRMED and the outcomes appear in the subscription activities. A Pear leader's entry size is the leader equity fraction applied to yours. An external leader (`leader.kind` EXTERNAL) must be a Hyperliquid address that holds a position or traded in the last 7 days; it is copied at a fixed scale, your equity over the leader equity at subscribe, which resize retakes. - [Stop copying](/api-integration/api-specification/copy-subscriptions/post-copy-subscriptions-id-end): End the subscription. Existing positions remain under your account control. Copying installs no local protection. - [Resize an external leader copy](/api-integration/api-specification/copy-subscriptions/post-copy-subscriptions-id-resize): Retake the copy scale as your equity over the leader equity now. Every copied coin then moves to the new target. Applies only to an active subscription to an external leader. - [Resume a paused external leader copy](/api-integration/api-specification/copy-subscriptions/post-copy-subscriptions-id-resume): Copy again after repeated failures paused the subscription; every coin converges within a minute. Applies only to an active subscription to an external leader. A subscription without a scale takes one now. - Copy Accounts: Read the copy state of a follower, and the followers and statistics of a leader. - [Copy Accounts](/api-integration/api-specification/copy-accounts): Read the copy state of a follower, and the followers and statistics of a leader. - [Get current copy state](/api-integration/api-specification/copy-accounts/get-copy-state): Returns NONE or ACTIVE for the trade account in `X-Trade-Account-Id`, as a follower. ACTIVE includes lifetime position metrics. - [List current copy followers](/api-integration/api-specification/copy-accounts/get-copy-followers): Returns every ACTIVE follower of the leader account in `X-Trade-Account-Id`, newest first. Followers that linked X and did not hide it carry their X profile. - [Get leader copy statistics](/api-integration/api-specification/copy-accounts/get-copy-stats): Copy totals for the leader account in `X-Trade-Account-Id`. Counts current and lifetime followers. Optional startDate/endDate filter copied fills, start inclusive and end exclusive; follower counts ignore them. - Copy Activity: Read what a copy subscription did with each leader action. - [Copy Activity](/api-integration/api-specification/copy-activity): Read what a copy subscription did with each leader action. - [List copy activity](/api-integration/api-specification/copy-activity/get-copy-subscriptions-id-activities): Newest first: one row per leader action, including copied, partial, skipped and failed ones. Ended subscriptions stay readable. Returns at most `limit` rows and has no cursor, so older rows past it are not reachable. - Vaults: Create, list, and read vaults, their statistics, and their positions. - [Vaults](/api-integration/api-specification/vaults): Create, list, and read vaults, their statistics, and their positions. - [List vaults](/api-integration/api-specification/vaults/get-vaults): Pages through vaults, newest first, optionally filtered by owner, trader or name. `inactive` vaults are left out unless `owner` is given. - [Create a vault](/api-integration/api-specification/vaults/post-vaults): Deploys a vault owned by the wallet that signs the create action. The signer must be an approved creator. Answers 201 once deployed, or 202 while the deploy is still in progress after 75 s. **Signing.** The prospective leader signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract`, primary type `CreateVault(address leader, string name, string description, string imageUri, uint256 configId, uint256 maxWithdrawalPeriodDays, string nonce, uint256 deadline)`. `leader` is EIP-55 checksummed and must equal the signer. An omitted `imageUri` is signed as `""` and an omitted `maxWithdrawalPeriodDays` as `0`. `deadline` is unix seconds, at most 300 s ahead of the server clock; `nonce` is any non-empty string. The signature must be canonical (low-s, v = 27 or 28). `buildCreateVaultMessage`, `CREATE_VAULT_TYPES` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. **Idempotency and polling.** The operation id is `activityId` = keccak256(signature). Re-sending the same signed body before its deadline attaches to the same operation instead of starting another, and answers its result. The route waits up to 75 s: it answers with the result, or 202 with `activityId` while the operation keeps running. Then poll `GET /vaults/activity/{activityId}` until `status` is `succeeded` or `failed`. - [Read the vault overview](/api-integration/api-specification/vaults/get-vaults-overview): One offset page of vaults, newest first, each with its latest NAV snapshot and a sparkline. `inactive` vaults are left out. - [List a wallet's vault investments](/api-integration/api-specification/vaults/get-vaults-investments): Values the wallet's position in every vault it deposited into or owns, at the chain head. A vault whose chain state can't be read is listed in `failedVaults` and sets `partial`, instead of failing the request. - [Read NAV series for several vaults](/api-integration/api-specification/vaults/post-vaults-snapshots-bulk): NAV series for up to 50 vaults over one window, in epoch **seconds**. Each series is oldest first and capped at 1000 points. Unknown vaults come back with an empty series. - [Read vault statistics](/api-integration/api-specification/vaults/get-vaults-vaultaddress-stats): TVL, PnL, drawdown, investors and the leader's position, plus `userStats` for `address` when given. Figures are pinned to the block of the newest NAV snapshot the vault's indexed event ledger covers, or read at the chain head while that ledger is incomplete. - [Read one vault activity](/api-integration/api-specification/vaults/get-vaults-activity-id): The polling target after a 202 from a leader-signed route: `{id}` is the `activityId` (`0x` + 64 lowercase hex), keccak256 of the signature. Poll until `status` leaves `pending`. - [List a vault's open positions](/api-integration/api-specification/vaults/get-vaults-vaultaddress-positions-open): The open positions of the vault's Hyperliquid trade account, newest first, cursor-paged. Public: no credential needed; funding attribution is not included. - [List a vault's closed positions](/api-integration/api-specification/vaults/get-vaults-vaultaddress-positions-closed): The closed positions of the vault's Hyperliquid trade account, ordered by close time (newest first), cursor-paged. Public: no credential needed. - [Read a vault](/api-integration/api-specification/vaults/get-vaults-vaultaddress): The vault at this address: its status, display metadata, owner, trader and agent addresses, and withdrawal period. - [Update vault metadata](/api-integration/api-specification/vaults/patch-vaults-vaultaddress): Replaces the vault's display metadata with a leader-signed full set. Answers 200 once applied, or 202 while still in progress after 75 s. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `UpdateVaultMetadata(address vault, string name, string about, string imageUri, string nonce, uint256 deadline)`, with `name`, `about` and `imageUri` signed verbatim (`""` clears a field). **Idempotency and polling.** The operation id is `activityId` = keccak256(signature). Re-sending the same signed body before its deadline attaches to the same operation instead of starting another, and answers its result. The route waits up to 75 s: it answers with the result, or 202 with `activityId` while the operation keeps running. Then poll `GET /vaults/activity/{activityId}` until `status` is `succeeded` or `failed`. - [Set the vault trader](/api-integration/api-specification/vaults/post-vaults-vaultaddress-trader): Assigns the vault's trader with a leader signature: the trader is approved as an agent on the vault's Hyperliquid account. Answers 200 once applied, or 202 while still in progress after 75 s. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `SetTrader(address vault, address trader, string nonce, uint256 deadline)`, with `trader` = `traderAddress`, EIP-55 checksummed. **Idempotency and polling.** The operation id is `activityId` = keccak256(signature). Re-sending the same signed body before its deadline attaches to the same operation instead of starting another, and answers its result. The route waits up to 75 s: it answers with the result, or 202 with `activityId` while the operation keeps running. Then poll `GET /vaults/activity/{activityId}` until `status` is `succeeded` or `failed`. - Vault NAV: Read the net asset value of a vault, latest or as a series. - [Vault NAV](/api-integration/api-specification/vault-nav): Read the net asset value of a vault, latest or as a series. - [Read the latest vault NAV](/api-integration/api-specification/vault-nav/get-vaults-vaultaddress-nav-latest): The vault's most recent NAV snapshot. - [Read a vault NAV series](/api-integration/api-specification/vault-nav/get-vaults-vaultaddress-nav): NAV points over the requested window at the requested resolution, oldest first, at most 5000. An unknown vault returns no points. - [Read vault NAV statistics](/api-integration/api-specification/vault-nav/get-vaults-vaultaddress-nav-stats): Share-price statistics over a trailing window, from raw snapshots. An unknown vault or an empty window answers `samples: 0` with null figures. - Vault Events: Read the deposits, withdrawals, and pending withdrawal requests of a vault. - [Vault Events](/api-integration/api-specification/vault-events): Read the deposits, withdrawals, and pending withdrawal requests of a vault. - [List vault transactions](/api-integration/api-specification/vault-events/get-vaults-vaultaddress-transactions): The vault's indexed on-chain deposits and withdrawals, newest first, paged by `limit` and `offset`. An unknown vault returns an empty list. - [List vault withdrawal requests](/api-integration/api-specification/vault-events/get-vaults-vaultaddress-withdrawal-requests): The vault's pending withdrawal requests in queue order (oldest first), optionally for one `userAddress`. Settled requests are not listed. `coverage.ready` says whether the indexer has caught up far enough for the list to be the complete queue. - Vault Bridge: Read vault activity, and move USDC from the vault agent back to the vault. - [Vault Bridge](/api-integration/api-specification/vault-bridge): Read vault activity, and move USDC from the vault agent back to the vault. - [List vault activity](/api-integration/api-specification/vault-bridge/get-vaults-vaultaddress-activity): The vault's 100 most recent leader operations, newest first. - [Withdraw from the vault to EVM](/api-integration/api-specification/vault-bridge/post-vaults-vaultaddress-withdraw-to-evm): Moves USDC from the vault agent's Hyperliquid (HyperCore) balance back to the vault contract on HyperEVM. The destination is always the vault itself. One withdrawal per vault runs at a time. Answers 200 once the USDC has landed, or 202 while still in progress after 75 s. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `WithdrawToEvm(address vault, string amount, string token, string nonce, uint256 deadline)`, with `amount` signed verbatim and `token` = `tokenId` verbatim, or `"0"` when omitted. **Idempotency and polling.** The operation id is `activityId` = keccak256(signature). Re-sending the same signed body before its deadline attaches to the same operation and answers its result. After a 202, poll `GET /vaults/activity/{activityId}` until `status` is `succeeded` or `failed`. - Vault Agent: Approve the vault trading agent, and set its Hyperliquid account mode. - [Vault Agent](/api-integration/api-specification/vault-agent): Approve the vault trading agent, and set its Hyperliquid account mode. - [Approve the vault's trading agent](/api-integration/api-specification/vault-agent/post-vaults-vaultaddress-agent-approve): Has the vault agent wallet approve the vault contract to spend the vault's asset (USDC) without limit, on HyperEVM, now instead of on the keeper's next pass. Synchronous: answers once the approval is mined, or at once when an allowance already exists. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `AgentApprove(address vault, string nonce, uint256 deadline)`. - [Enable unified accounting for the vault](/api-integration/api-specification/vault-agent/post-vaults-vaultaddress-set-unified-account): Switches the vault agent's Hyperliquid account to `unifiedAccount` mode, the same as `set-account-mode` with that mode. A switch needs the agent to hold no open positions; repeating the current mode is accepted. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `SetUnifiedAccount(address vault, string nonce, uint256 deadline)`. **Replay.** The call is synchronous and the server does not consume the nonce, so the same signed body can be sent again until its deadline; repeating the current mode changes nothing. - [Set the vault account mode](/api-integration/api-specification/vault-agent/post-vaults-vaultaddress-set-account-mode): Switches the vault agent's Hyperliquid account mode. A switch needs the agent to hold no open positions; the mode is confirmed by reading it back from Hyperliquid. **Signing.** The vault owner signs EIP-712 typed data with the domain `{name: "PearVaultService", version: "1", chainId: 999}` and no `verifyingContract` (an offline signature: no chain switch). `vault` is the `{vaultAddress}` path segment, EIP-55 checksummed. `nonce` (string) and `deadline` (uint256, unix seconds, at most 300 s ahead of the server clock) are the body fields of the same name. The signature must be canonical (low-s, v = 27 or 28). `buildLeaderActionTypedData` and `VAULT_ACTION_DOMAIN` in `@pear-protocol/utils` build the exact typed data. Primary type `SetAccountMode(address vault, string mode, string nonce, uint256 deadline)`, with `mode` signed verbatim. **Replay.** The call is synchronous and the server does not consume the nonce, so the same signed body can be sent again until its deadline; repeating the current mode changes nothing. - Protocol Metrics: Read headline protocol metrics and weekly volume. - [Protocol Metrics](/api-integration/api-specification/metric): Read headline protocol metrics and weekly volume. - [Headline protocol metrics (frozen dead-venue history + live V2 engine)](/api-integration/api-specification/metric/get-metric): All-time totals add a frozen history of retired venues to the live Pear V2 engine figures; daily figures come from the engine only. Without `timestamp` the figures come from an in-memory cache refreshed at most every 4 hours, and a stale copy is served when the V2 engine is unreachable. With `timestamp` every request reads the engine. - [Weekly and monthly volume (live V2 engine)](/api-integration/api-specification/metric/get-metric-weeklyvolume): Without `timestamp` the figures come from an in-memory cache refreshed at most every 4 hours, and a stale copy is served when the V2 engine is unreachable. With `timestamp` every request reads the engine. - Staking and Referral Stats: Read the PEAR a wallet staked, and referral trading volume. - [Staking and Referral Stats](/api-integration/api-specification/stats): Read the PEAR a wallet staked, and referral trading volume. - [PEAR staked by a wallet since a start date, in tokens and USD](/api-integration/api-specification/stats/get-stats-staked): Sums the stake events of `address` on or after `startDate` from the PEAR staking subgraph (unstakes are not subtracted), valuing each at the hourly PEAR/USD price closest to its event time. - [Whether a wallet has staked at least the given USD amount since a start date](/api-integration/api-specification/stats/get-stats-staked_above_amount): Computes the USD value `GET /stats/staked` reports for `address` and `startDate`, and compares it with `amount` (USD) using greater-than-or-equal. - [Referral stats: referees and their per-venue trading volume](/api-integration/api-specification/stats/get-stats-referral): Resolves the referees of `address` or `code` (as `GET /referral/referees` does), then reads each referee's Hyperliquid trading from the Pear V2 engine, from the later of the window start and the day they were referred. The window start is `startDate`, else its deprecated alias `date`, else `period`; without any of them it is the day the referee was referred. A referee whose V2 stats cannot be read reports zeros rather than failing the request. The intent venues are retired and always report zeros. - Referees by Code: List the referees of a referrer address or referral code. - [Referees by Code](/api-integration/api-specification/referral): List the referees of a referrer address or referral code. - [List a referrer's referees by address or referral code](/api-integration/api-specification/referral/get-referral-referees): Send `referrer` or `code`; `code` wins when both are sent. A `referrer` is resolved to its code on-chain (PlatformLogic on Arbitrum), then the referees registered under the code are read from the PlatformLogic subgraph. - PEAR Supply: Read PEAR circulating and total supply. - [PEAR Supply](/api-integration/api-specification/supply): Read PEAR circulating and total supply. - [PEAR circulating supply (plain text; ?format=json for the full breakdown)](/api-integration/api-specification/supply/get-circulating): Plain text by default: circulating supply in whole PEAR, rounded to 6 decimals with trailing zeros trimmed (e.g. `123456789.5`). With `format=json` (any case), the same body as `GET /circulating/breakdown`. Responses carry `Cache-Control: public, max-age=60, s-maxage=60`; the chain is read at most once a minute. - [PEAR total supply (plain text)](/api-integration/api-specification/supply/get-circulating-total): Total supply in whole PEAR, rounded to 6 decimals with trailing zeros trimmed. Responses carry `Cache-Control: public, max-age=60, s-maxage=60`; the chain is read at most once a minute. - [Full PEAR supply breakdown](/api-integration/api-specification/supply/get-circulating-breakdown): Total, locked and circulating supply read from the PEAR token on Arbitrum, with the balance of each wallet excluded from circulating supply. Amounts are decimal strings in whole PEAR. Responses carry `Cache-Control: public, max-age=60, s-maxage=60`; the chain is read at most once a minute. - PEAR Total Supply: Read PEAR total supply as JSON. - [PEAR Total Supply](/api-integration/api-specification/total-supply): Read PEAR total supply as JSON. - [PEAR total supply (JSON)](/api-integration/api-specification/total-supply/get-total-supply): Total supply in whole PEAR as a JSON number, rounded to 6 decimals. Responses carry `Cache-Control: public, max-age=60, s-maxage=60`; the chain is read at most once a minute. - Fees - [Trading Fees](/fees/trading-fees) - [Referrals](/fees/referrals) - [stPEAR-based trading discounts](/fees/stpear-based-trading-discounts) - Tokenomics - [PEAR & stPEAR](/tokenomics/token) - [Tokenomics Update - July 2025](/tokenomics/tokenomics-update-july-2025) - [Staking](/tokenomics/staking) - [Staking walkthrough](/tokenomics/staking-walkthrough) - [Staking FAQs](/tokenomics/staking-faqs) - [DAO & Governance](/tokenomics/dao-and-governance) - Smart Contracts - [Smart Contract addresses](/smart-contracts/smart-contract-addresses) - [Audits and Security](/smart-contracts/audits-and-security) - Resources - [Restricted Territories](/resources/restricted-territories): >- - [Brand Assets](/resources/brand-assets) - [Agent Pear Statistics](/resources/agent-pear-statistics) - [Margin & Liquidations](/resources/portfolio-margin-and-liquidations): How margin and liquidation work on Hyperliquid and Lighter trade accounts. - [FAQs](/resources/faqs): Frequently Asked Questions - Legal - [Terms of Service](/legal/terms-of-service) - [Privacy Policy](/legal/privacy-policy)