# Overview
Source: https://docs.pacifica.fi/api-documentation/api
Welcome to Pacifica's API documentation. We offer complete REST and Websocket APIs to suit your trading needs.\
\
The documentation includes clear descriptions, parameter requirements, example responses, and code snippets to help developers quickly implement these endpoints in their applications.\
\
You can also use the API via the Pacifica Python SDK: [https://github.com/pacifica-fi/python-sdk](https://github.com/pacifica-fi/python-sdk)\
\
For any feedback, suggestions, and additional help with integration into Pacifica's API, please let us know in our [discord API channel](https://discord.com/channels/1325864651816435822/1378723526957334548)!\
# API FAQ
Source: https://docs.pacifica.fi/api-documentation/api/api-faq
* [403 CloudFront](/api-documentation/api/api-faq/403-cloudfront): Common error caused by GET requests with an empty request body.
* [Delayed account\_positions](/api-documentation/api/api-faq/delayed-account_positions): Potential delay of snapshot endpoints and best practice for reconstructing local state
# 403 CloudFront
Source: https://docs.pacifica.fi/api-documentation/api/api-faq/403-cloudfront
Common error caused by GET requests with an empty request body.
**Question:**\
Why am I getting a 403 "The request could not be satisfied" error from CloudFront?\\
\
**Answer:**\
After our migration to CloudFront, GET requests with an empty request body will be rejected with a 403 error (while previously accepted).\
\
Using `curl` as an example, remove the `-d '{}'` or any empty payload from your GET requests. GET requests should not include a request body.\
\
**Example:**
This **will not** work:
```shellscript theme={null}
curl -X GET -H "PF-API-KEY: your-api-key" -H "Content-Type: application/json" -d '{}' "https://api.pacifica.fi/api/v1/positions?account=..."
```
This **will** work:
```shellscript theme={null}
curl -X GET -H "PF-API-KEY: your-api-key" "https://api.pacifica.fi/api/v1/positions?account=..."
```
# Delayed account\_positions
Source: https://docs.pacifica.fi/api-documentation/api/api-faq/delayed-account_positions
Potential delay of snapshot endpoints and best practice for reconstructing local state
**Question:**\
My `account_positions`/`account_orders` updates are sometimes delayed. What should I do to reliably construct a local state based on Pacifica's WS feeds?\
\
**Answer:**\
`account_positions` and `account_orders` are snapshot-driven channels. They show your current state but can be delayed under high load.\
\
For real-time updates with no delay, use our event-driven channels:
* `account_trades` - update on every fill as it happens
* `account_order_updates` - update on every order state change
We recommend using our snapshot-driven channels for initialization/checks, and our event-driven channels to construct a real-time local state.
# Error Codes
Source: https://docs.pacifica.fi/api-documentation/api/error-codes
This section provides a comprehensive list and definition of all error codes generated by the Pacifica API
### Pacifica API Response Codes (REST API)
| 400 | Bad Request |
| --- | --------------------------------------- |
| 403 | Forbidden: restricted region |
| 404 | Not Found |
| 409 | Conflict |
| 422 | Business Logic Error - See below |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
| 504 | Gateway Timeout |
### Business Logic Errors (Code 422)
These values are returned in the `code` field of a `422` response.
| Code | Name |
| ---- | ------------------------------------------------------------------------------ |
| 0 | `INTERNAL` |
| 1 | `ACCOUNT_NOT_FOUND` |
| 2 | `ACCOUNT_ALREADY_EXISTS` |
| 3 | `BOOK_NOT_FOUND` |
| 4 | `INVALID_TICK_LEVEL` |
| 5 | `INSUFFICIENT_BALANCE` |
| 6 | `ORDER_NOT_FOUND` |
| 7 | `ORDER_AMOUNT_TOO_LOW` |
| 8 | `ORDER_AMOUNT_TOO_HIGH` |
| 9 | `OVER_WITHDRAWAL` |
| 10 | `OPEN_ORDER_LIMIT_REACHED` |
| 11 | `INVALID_LEVERAGE` |
| 12 | `CANNOT_UPDATE_MARGIN` |
| 13 | `POSITION_NOT_FOUND` |
| 14 | `DATABASE_ERROR` |
| 15 | `INVALID_DEPOSIT_NONCE` |
| 16 | `INVALID_STOP_TICK` |
| 17 | `INVALID_STOP_ORDER_SIDE` |
| 18 | `INVALID_STOP_ORDER_AMOUNT` |
| 19 | `INVALID_STOP_ORDER_REDUCE_ONLY` |
| 20 | `INVALID_ORDER_TYPE` |
| 21 | `INVALID_REDUCE_ONLY_ORDER_SIDE` |
| 22 | `INVALID_REDUCE_ONLY_ORDER_AMOUNT` |
| 23 | `NO_POSITION_FOR_REDUCE_ONLY_ORDER` |
| 24 | `INVALID_LIQUIDATION_SIDE` |
| 25 | `NO_REASONABLE_PRICE` |
| 26 | `CHANNEL_CLOSED` |
| 27 | `RESPONSE_DROPPED` |
| 28 | `IMMEDIATE_LIQUIDATION` |
| 29 | `WITHDRAW_AMOUNT_TOO_LOW` |
| 30 | `PRICE_TOO_FAR_FROM_MARK` |
| 31 | `DAILY_WITHDRAW_LIMIT_EXCEEDED` |
| 32 | `WITHDRAWAL_BLOCKED` |
| 33 | `INVALID_TRANSFER_RELATIONSHIP` |
| 34 | `SUBACCOUNT_WITHDRAWAL_NOT_ALLOWED` |
| 35 | `SUBACCOUNT_CANNOT_CREATE_SUBACCOUNT` |
| 36 | `DUPLICATE_CLIENT_ORDER_ID` |
| 37 | `UNUSED_CLIENT_ORDER_ID` |
| 38 | `TRADING_DISABLED` |
| 39 | `INVALID_FEE_MODE` |
| 40 | `NOT_MAIN_ACCOUNT` |
| 41 | `OPEN_INTEREST_LIMIT_EXCEEDED` |
| 42 | `EXCHANGE_WITHDRAW_LIMIT_REACHED` |
| 43 | `TWAP_DUPLICATE_CLIENT_ORDER_ID` |
| 44 | `TWAP_UNUSED_CLIENT_ORDER_ID` |
| 45 | `TWAP_ORDER_FAIL_TO_GET_SUB_ORDER_AMOUNT` |
| 46 | `TWAP_ORDER_DURATION_TOO_SHORT` |
| 47 | `TWAP_ORDER_NOT_FOUND` |
| 48 | `TWAP_ORDER_COUNT_PER_SYMBOL_LIMIT_EXCEEDED` |
| 49 | `POSITION_TPSL_LIMIT_EXCEEDED` |
| 50 | `INVALID_BUILDER_CODE` |
| 51 | `UNSUPPORTED_OPERATION` |
| 52 | `INVALID_TICK_SIZE` |
| 53 | `ORDER_BLOCKED_BY_LOAN_POOL_STRESS` |
| 54 | `ASSET_ALREADY_EXISTS` |
| 55 | `ASSET_NOT_FOUND` |
| 56 | `ASSET_NOT_ACTIVE` |
| 59 | `INVALID_AMOUNT` |
| 61 | `SPOT_WITHDRAWAL_EXCEEDS_COLLATERAL` |
| 62 | `INSUFFICIENT_SPOT_BALANCE` |
| 63 | `MISSING_MARK_PRICE` |
| 64 | `INVALID_FLOOR_PRICE_PCT` |
| 65 | `SPOT_EXCLUSION_BREACHES_COLLATERAL` |
| 66 | `LAKE_NOT_FOUND` |
| 67 | `LAKE_ADDRESS_COLLISION` |
| 68 | `LAKE_MIN_DEPOSIT_AMOUNT` |
| 69 | `LAKE_INVALID_SHARES` |
| 70 | `LAKE_OVER_WITHDRAWAL` |
| 71 | `LAKE_NICKNAME_ALREADY_EXISTS` |
| 72 | `LAKE_WITHDRAWAL_NOT_ALLOWED` |
| 73 | `LAKE_MANAGER_IS_SUBLAKE` |
| 74 | `LAKE_NOT_CREATOR` |
| 75 | `LAKE_DEPOSIT_CAP_EXCEEDED` |
| 76 | `LAKE_WITHDRAW_TOO_EARLY` |
| 77 | `LAKE_INVALID_REV_SHARE_CONFIG` |
| 78 | `LAKE_DEPOSITOR_OVER_WITHDRAWAL` |
| 79 | `LAKE_ALREADY_HAS_MANAGER` |
| 80 | `LAKE_MANAGER_BALANCE_PORTION_TOO_LOW` |
| 81 | `LAKE_INVALID_BALANCE_PORTION_CONFIG` |
| 82 | `LAKE_LIQUIDATION_PORTION_ABOVE_MIN_PORTION` |
| 83 | `LAKE_TRADING_HALTED` |
| 84 | `INVALID_WITHDRAW_NONCE` |
| 85 | `LAKE_INVALID_WITHDRAW_WINDOW_CONFIG` |
| 86 | `LAKE_WITHDRAW_DURATION_ABOVE_WINDOW` |
| 87 | `LAKE_WITHDRAW_WINDOW_CLOSED` |
| 88 | `INVALID_SPOT_DEPOSIT_NONCE` |
| 89 | `SPOT_DEPOSIT_NONCE_GAP` |
| 90 | `INVALID_SPOT_WITHDRAW_NONCE` |
| 91 | `SPOT_BRIDGE_NOT_FOUND` |
| 92 | `SPOT_BRIDGE_INACTIVE` |
| 93 | `LAKE_SYMBOL_NOT_ALLOWED` |
| 94 | `LAKE_MAX_LEVERAGE_EXCEEDED` |
| 95 | `GAME_CONFIG_NOT_FOUND` |
| 96 | `GAME_ACCOUNT_NOT_FOUND` |
| 97 | `GAME_ACCOUNT_ADDRESS_COLLISION` |
| 99 | `GAME_DEPOSIT_CAP_EXCEEDED` |
| 100 | `GAME_OPERATION_NOT_ALLOWED` |
| 101 | `GAME_ALREADY_ENDED` |
| 102 | `GAME_INVALID_CONFIG` |
| 103 | `GAME_ACCOUNT_WITHDRAWAL_NOT_ALLOWED` |
| 104 | `GAME_LEVERAGE_EXCEEDED` |
| 105 | `GAME_DEPOSIT_BELOW_MINIMUM` |
| 106 | `REDUCE_ONLY_NOT_SUPPORTED_FOR_SPOT` |
| 107 | `TP_SL_NOT_SUPPORTED_FOR_SPOT` |
| 108 | `BUILDER_CODE_NOT_SUPPORTED_FOR_SPOT` |
| 109 | `MARGIN_SETTINGS_NOT_APPLICABLE_FOR_SPOT` |
| 110 | `INVALID_BOOK_CONFIG` |
| 111 | `TAP_GAME_NOT_ACTIVE` |
| 112 | `TAP_GAME_INVALID_AMOUNT` |
| 113 | `TAP_GAME_ERROR` |
| 114 | `INVALID_COLLATERAL_LIMIT` / `LAKE_SELF_DEPOSIT_NOT_ALLOWED` |
| 115 | `SPOT_COLLATERAL_LIMIT_BREACHES_COLLATERAL` / `LAKE_DEPOSITOR_NOT_WHITELISTED` |
| 116 | `DAILY_SPOT_WITHDRAW_LIMIT_EXCEEDED` / `RFQ_SELF_QUOTE_NOT_ALLOWED` |
| 117 | `EXCHANGE_SPOT_WITHDRAW_LIMIT_REACHED` / `RFQ_NOT_SUPPORTED_FOR_SPOT` |
| 118 | `INVALID_SPOT_LIMIT` / `RFQ_MISSING_CLIENT_ORDER_ID` |
| 119 | `ORACLE_NOT_AVAILABLE` |
| 120 | `VAULT_WITHDRAWAL_NOT_ALLOWED` |
| 121 | `RFQ_QUOTE_WORSE_THAN_BOOK` |
Note: codes 57, 58, 60, and 98 are currently unused/reserved. Codes 114–118 are each shared by two distinct error variants in the backend.
### WebSocket Error Codes
| 200 | SUCCESS\_CODE |
| --- | --------------------------- |
| 400 | INVALID\_REQUEST\_CODE |
| 401 | INVALID\_SIGNATURE\_CODE |
| 402 | INVALID\_SIGNER\_CODE |
| 403 | UNAUTHORIZED\_REQUEST\_CODE |
| 420 | ENGINE\_ERROR\_CODE |
| 429 | RATE\_LIMIT\_EXCEEDED\_CODE |
| 500 | UNKNOWN\_ERROR\_CODE |
# Last Order ID
Source: https://docs.pacifica.fi/api-documentation/api/last-order-id
Pacifica uses last order ID as an exchange-wide identifier to order all exchange events
### Overview
`last_order_id` is an exchange-wide, nonce included in all trading-related API responses. Use it to determine the ordering of events across endpoints without relying on server timestamps.
### Why Use It
Server-side timestamps can be affected by clock drift. last\_order\_id provides guaranteed sequential ordering across all trading events.
### Affected Endpoints
#### REST API
* [/api/v1/positions](/api-documentation/api/rest-api/account/get-positions)
* [/api/v1/trades](/api-documentation/api/rest-api/markets/get-recent-trades)
* [/api/v1/orders](/api-documentation/api/rest-api/orders/get-open-orders)
#### WebSocket
* [bbo](/api-documentation/api/websocket/subscriptions/best-bid-offer-bbo)
* [trades](/api-documentation/api/websocket/subscriptions/trades)
* [account\_positions](/api-documentation/api/websocket/subscriptions/account-positions)
* [account\_orders](/api-documentation/api/websocket/subscriptions/account-order-updates)
* [account\_order\_updates](/api-documentation/api/websocket/subscriptions/account-order-updates)
* [account\_trades](/api-documentation/api/websocket/subscriptions/account-trades)
### Notes
* The last\_order\_id is shared across all above endpoints, allowing you to sequence events from different streams relative to each other.
* For specific response implementation, check each endpoint's docs above.
# Market Symbols
Source: https://docs.pacifica.fi/api-documentation/api/market-symbols
Symbols accepted by the Pacifica API are CASE SENSITIVE.
For example, `'BTC'` is the expected form in requests, whereas requests with symbol field `'Btc'` or`'btc'` will fail.\
\
All market symbols are capitalized, except for markets with abbreviated numerical prefixes such as `'kBONK'` and `'kPEPE'` , which have the prefix in lower-case. Requests containing symbol fields such as `'KBONK'`, `'kbonk'`, or `'kBonk'` will fail.
# MCP Server
Source: https://docs.pacifica.fi/api-documentation/api/mcp
The Pacifica MCP server exposes the REST API as Model Context Protocol tools for AI agents.
The Pacifica MCP server is a [Model Context Protocol](https://modelcontextprotocol.io) server that exposes Pacifica's REST API as MCP tools.\
An MCP client such as Claude Desktop, Claude Code, or OpenAI Codex can then read the markets and place trades on your behalf, using natural language.
It wraps the same REST endpoints documented elsewhere in this section, covering:
* **Market data:** exchange info, prices, orderbook, candles, funding rates, and more.
* **Account and positions:** balances, settings, positions, and history queries.
* **Order management:** limit, market, stop, TP/SL, and TWAP orders, plus batch operations.
* **Spot:** spot asset data, balances, and withdrawals.
It also adds **on-chain funding** tools that act on Solana directly: mint test USDP on testnet and deposit USDC/USDP into your exchange balance.
The server is open source and published to npm:
* Source: [github.com/pacifica-fi/pacifica-mcp](https://github.com/pacifica-fi/pacifica-mcp)
* Package: [`@pacifica-fi/mcp-server`](https://www.npmjs.com/package/@pacifica-fi/mcp-server)
## Prerequisites
* **Node.js 18 or newer**
* A **Pacifica account address** (your main account or a subaccount)
* For trading (optional): a signing key, either your main wallet's secret key or, recommended, a revocable **agent key** bound to your account
Read-only access (market data and account queries) needs only the account address.\
Placing or cancelling orders requires a signing key. See [Configuration](/api-documentation/api/mcp/configuration).
## Quickstart
The server runs the same way in every client: the command is `npx -y @pacifica-fi/mcp-server`, which downloads and runs the latest published version automatically (no manual install step), configured through environment variables.
At minimum, set `ADDRESS` to your account. Add a signing key (`AGENT_PRIVATE_KEY`, recommended, or `PRIVATE_KEY`) to place trades, or omit it for read-only access.
Only the config format differs per client. See [Client Setup](/api-documentation/api/mcp/clients) for step-by-step instructions for Claude Desktop, Claude Code, OpenAI Codex, Factory, Hermes, and Crush.
On startup the server logs the active account and auth mode to stderr (visible in the MCP logs), e.g. `[pacifica-mcp] account=
mode=agent-key`.
> **Note:** By default the server targets the Pacifica **testnet** (`https://test-api.pacifica.fi`). To trade on production, set `PACIFICA_BASE_URL=https://api.pacifica.fi` in the `env` block. See [Configuration](/api-documentation/api/mcp/configuration) for all environment variables.
## Next Steps
* [Configuration](/api-documentation/api/mcp/configuration): environment variables, auth modes, and security.
* [Client Setup](/api-documentation/api/mcp/clients): configs for Claude Desktop, Claude Code, OpenAI Codex, Factory, Hermes, and Crush.
* [Tools](/api-documentation/api/mcp/tools): the full list of tools the server exposes.
# Client Setup
Source: https://docs.pacifica.fi/api-documentation/api/mcp/clients
Configure the Pacifica MCP server in Claude Desktop, Claude Code, OpenAI Codex, Factory, Hermes, and Crush.
Every MCP client runs the server the same way - the command is `npx -y @pacifica-fi/mcp-server` with the environment variables from [Configuration](/api-documentation/api/mcp/configuration) (`ADDRESS` plus `AGENT_PRIVATE_KEY` or `PRIVATE_KEY`; omit the key for read-only).
Only the config format differs per client.
The examples below use agent-key mode; swap in `PRIVATE_KEY`, or drop the key entirely for read-only.
## Claude Desktop
Go to **Settings → Developer → Edit Config** to open `claude_desktop_config.json`, then add the `pacifica` server:
```json theme={null}
{
"mcpServers": {
"pacifica": {
"command": "npx",
"args": ["-y", "@pacifica-fi/mcp-server"],
"env": {
"ADDRESS": "",
"AGENT_PRIVATE_KEY": ""
}
}
}
}
```
Restart Claude Desktop after saving. On startup the server logs the active account and auth mode to the MCP logs, e.g. `[pacifica-mcp] account= mode=agent-key`.
## Claude Code
Add it with the CLI:
```bash theme={null}
claude mcp add pacifica \
--transport stdio \
--env ADDRESS= \
--env AGENT_PRIVATE_KEY= \
-- npx -y @pacifica-fi/mcp-server
```
Or create `.mcp.json` in your project root (commit it to share with your team):
```json theme={null}
{
"mcpServers": {
"pacifica": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@pacifica-fi/mcp-server"],
"env": {
"ADDRESS": "",
"AGENT_PRIVATE_KEY": ""
}
}
}
}
```
Verify with `claude mcp list`. Docs: [code.claude.com/docs/en/mcp](https://code.claude.com/docs/en/mcp)
## OpenAI Codex
Add it with the CLI:
```bash theme={null}
codex mcp add pacifica \
--env ADDRESS= \
--env AGENT_PRIVATE_KEY= \
-- npx -y @pacifica-fi/mcp-server
```
Or edit `~/.codex/config.toml` (note the nested `.env` table):
```toml theme={null}
[mcp_servers.pacifica]
command = "npx"
args = ["-y", "@pacifica-fi/mcp-server"]
[mcp_servers.pacifica.env]
ADDRESS = ""
AGENT_PRIVATE_KEY = ""
```
Docs: [developers.openai.com/codex/mcp](https://developers.openai.com/codex/mcp)
## Factory (droid)
Add it with the CLI:
```bash theme={null}
droid mcp add pacifica "npx -y @pacifica-fi/mcp-server" \
--env ADDRESS= \
--env AGENT_PRIVATE_KEY=
```
Or edit `~/.factory/mcp.json` (user-level) or `.factory/mcp.json` (project-level):
```json theme={null}
{
"mcpServers": {
"pacifica": {
"command": "npx",
"args": ["-y", "@pacifica-fi/mcp-server"],
"env": {
"ADDRESS": "",
"AGENT_PRIVATE_KEY": ""
}
}
}
}
```
Docs: [docs.factory.ai/cli/configuration/mcp](https://docs.factory.ai/cli/configuration/mcp)
## Hermes Agent
Edit `~/.hermes/config.yaml` (YAML, top-level `mcp_servers` key):
```yaml theme={null}
mcp_servers:
pacifica:
command: "npx"
args: ["-y", "@pacifica-fi/mcp-server"]
env:
ADDRESS: ""
AGENT_PRIVATE_KEY: ""
```
Reload with `/reload-mcp` inside Hermes, or restart it.
Docs: [hermes-agent.nousresearch.com/docs/user-guide/features/mcp](https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp)
## Crush
Edit `crush.json` in your project root (or `~/.config/crush/crush.json` for all projects).
The top-level key is `mcp` (not `mcpServers`), and Crush expands `$VAR` shell references in values - so keep secrets in your environment rather than in the file:
```json theme={null}
{
"$schema": "https://charm.land/crush.json",
"mcp": {
"pacifica": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@pacifica-fi/mcp-server"],
"env": {
"ADDRESS": "$PACIFICA_ADDRESS",
"AGENT_PRIVATE_KEY": "$PACIFICA_AGENT_PRIVATE_KEY"
}
}
}
}
```
Docs: [github.com/charmbracelet/crush](https://github.com/charmbracelet/crush)
# Configuration
Source: https://docs.pacifica.fi/api-documentation/api/mcp/configuration
Environment variables, authentication modes, and security for the Pacifica MCP server.
The MCP server is configured entirely through environment variables passed in your MCP client's config.\
Which keys you provide determines the [mode](#modes) the server runs in.
## Environment Variables
| Variable | Required | Description |
| --------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ADDRESS` | yes | Public address the actions apply to, your main account or a subaccount. Sent as the `account` field. |
| `PRIVATE_KEY` | no | Base58 Solana secret key (Ed25519) of the main account. Signs POST requests when no agent key is set. |
| `AGENT_PRIVATE_KEY` | no | Base58 secret key of an API **agent wallet** (revocable). When set, signs POST requests and sends `agent_wallet`, so you never expose your main key. The agent must already be bound to `ADDRESS`. Takes precedence over `PRIVATE_KEY`. |
| `AGENT_WALLET` | no | Agent wallet public key. Defaults to the value derived from `AGENT_PRIVATE_KEY`; only set this to override. |
| `PACIFICA_BASE_URL` | no | API host. Defaults to testnet `https://test-api.pacifica.fi`. Set to `https://api.pacifica.fi` for production. |
| `SOLANA_RPC_URL` | no | Solana RPC endpoint used by the on-chain funding tools (`mintUsdp`, `depositUsdp`). Defaults to public devnet `https://api.devnet.solana.com`; set a dedicated RPC to avoid public rate limits. |
| `PACIFICA_PROGRAM_ID` | no | Override the Pacifica on-chain program id used by `depositUsdp`. Defaults per network: the shipped testnet program on testnet, the Pacifica mainnet program on mainnet. |
| `PACIFICA_USDC_MINT` | no | Override the collateral mint used by `depositUsdp`. Defaults per network: testnet USDP on testnet, Circle USDC on mainnet. |
## Modes
The server picks a mode from the keys you provide:
* **Read-only:** set only `ADDRESS`. All read (GET) tools work; write (POST) tools return a clear "read-only mode" error.
* **Agent-key (recommended):** set `ADDRESS` + `AGENT_PRIVATE_KEY`. Full trading without ever putting your main wallet's private key in the config.
* **Main-key:** set `ADDRESS` + `PRIVATE_KEY`. Full trading, signing with the main wallet key (legacy behavior).
On startup the server logs the active account and mode to stderr (visible in the MCP logs), e.g. `[pacifica-mcp] account= mode=agent-key`.
## On-Chain Funding Tools
Two tools - `mintUsdp` and `depositUsdp` - sign and send Solana transactions directly instead of calling the REST API, so they have their own requirements:
* They require `PRIVATE_KEY`. An agent key signs API requests only and cannot sign on-chain transactions, so it does not work for these tools - this is the one case where the main key is required.
* They use `SOLANA_RPC_URL` for the Solana connection. It defaults to public devnet; set a dedicated RPC to avoid rate limits.
* `mintUsdp` is testnet only and is registered only when `PACIFICA_BASE_URL` targets testnet. `depositUsdp` works on both networks; on **mainnet it moves real USDC**.
On testnet, a typical flow is `mintUsdp` to credit your wallet, then `depositUsdp` to move those funds into your exchange balance. See [Tools](/api-documentation/api/mcp/tools#funding) for the tool list.
## Recommended: Agent Key
An agent key is a revocable key bound to your account: it can trade, but it cannot move funds the way your main wallet can, and you can revoke it at any time.\
Generate and bind one once at [app.pacifica.fi/apikey](https://app.pacifica.fi/apikey). You sign the binding in-browser, so your main secret never leaves your wallet.\
Then configure the MCP with only your account address and the agent key:
```json theme={null}
{
"mcpServers": {
"pacifica": {
"command": "npx",
"args": ["-y", "@pacifica-fi/mcp-server"],
"env": {
"ADDRESS": "",
"AGENT_PRIVATE_KEY": ""
}
}
}
}
```
For more on how agent keys work in Pacifica's signing scheme, see [API Agent Keys](/api-documentation/api/signing/api-agent-keys).
## Security
> **Important:** Never commit or paste your `PRIVATE_KEY` or `AGENT_PRIVATE_KEY` anywhere public. Treat any key that has been exposed as compromised and rotate it.
* Prefer an **agent key** over your main key: it is revocable and limited in scope.
* The config file holds your key in plaintext, so protect it like any other secret.
# Tools
Source: https://docs.pacifica.fi/api-documentation/api/mcp/tools
The full list of tools the Pacifica MCP server exposes, grouped by category.
The server exposes the tools below, grouped by category.
**Access** indicates the mode required:
* **Read** tools are GET requests and work in any mode, including read-only (`ADDRESS` only).
* **Write** tools are signed POST requests and require a signing key (`AGENT_PRIVATE_KEY` or `PRIVATE_KEY`). In read-only mode they return a clear "read-only mode" error.
* **On-chain** tools sign and send a Solana transaction directly rather than calling the REST API, so they require `PRIVATE_KEY` specifically - an agent key cannot sign on-chain transactions.
See [Configuration](/api-documentation/api/mcp/configuration) for how to set the mode.
## Markets
Market data and exchange info. All read-only.
| Tool | Access | Description |
| ------------------------------ | ------ | -------------------------------------------------------------------------------------------- |
| `getInfo` | Read | Exchange/market info (tick and lot size, max leverage, order limits) for all tradable pairs. |
| `getPrices` | Read | Funding, mark, oracle, and mid prices, plus open interest and 24h volume, for all pairs. |
| `getOrderbook` | Read | Current orderbook snapshot (bids and asks) for a pair. |
| `getRecentTrades` | Read | Recent trades for a pair. |
| `getKline` | Read | Candlestick (K-line) data for a pair and time interval. |
| `getMarkPriceKline` | Read | Mark-price candlestick data for a pair and time interval. |
| `getSparklines` | Read | Compact sparkline price series for one or more pairs. |
| `getFees` | Read | Fee tiers and their maker/taker fee rates. |
| `getFundingRateHistory` | Read | Funding rate history for a pair (cursor-paginated). |
| `getAggregatedFundingRates` | Read | Aggregated funding rates across exchanges. |
| `getLoanPool` | Read | Loan pool statistics (borrowed, borrowable, utilization, APR/APY). |
| `getPositionLiquidationPrices` | Read | Liquidation prices for the account's open positions. |
| `getCurrentTime` | Read | Current server time in milliseconds since the Unix epoch. |
## Account
Account info, settings, and history.
| Tool | Access | Description |
| ------------------------- | ------ | ------------------------------------------------------------------------------------ |
| `getAccountInfo` | Read | High-level account info: balance, equity, margin usage, fee tier, and spot balances. |
| `getAccountSettings` | Read | Non-default margin/leverage settings, auto-lend status, and per-asset spot settings. |
| `getAccountLoanInfo` | Read | Loan info: borrowed amounts, pending interest, and collateral utilization. |
| `getPortfolioHistory` | Read | Account equity and PnL history over a time range. |
| `getBalanceHistory` | Read | Balance-change history: deposits, withdrawals, transfers, and payouts. |
| `getFundingHistory` | Read | Funding-payment history on perpetual positions (cursor-paginated). |
| `getDailyAccountActivity` | Read | Daily activity summary (points, fees, volume) for a time range. |
| `getPayoutHistory` | Read | Payout history (cursor-paginated). |
| `getDepositHistory` | Read | Deposit history (cursor-paginated). |
| `getWithdrawalHistory` | Read | Withdrawal history (cursor-paginated). |
| `getPendingWithdrawals` | Read | Pending withdrawals not yet batched. |
| `updateLeverage` | Write | Set the leverage multiplier for a pair. |
| `updateMarginMode` | Write | Switch a pair between isolated and cross margin. |
| `updateSpotSettings` | Write | Set whether a spot asset is included in unified margin collateral. |
| `setAutoLendDisabled` | Write | Set the auto-lend preference for spot collateral. |
| `withdraw` | Write | Withdraw funds from the perp account. |
| `bindAgentWallet` | Write | Bind an agent wallet to the account (legacy direct-bind endpoint). |
## Orders & Positions
Order management and position tools.
| Tool | Access | Description |
| ------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| `getOpenOrders` | Read | All open (unfilled) orders for the account. |
| `getOrderHistory` | Read | Summarized order history (cursor-paginated). |
| `getOrderHistoryById` | Read | Full event history of a single order by ID. |
| `getCurrentPositions` | Read | All currently held positions. |
| `getPositionHistory` | Read | Per-fill trade/position history (cursor-paginated, max 30-day range). |
| `getOpenTwapOrders` | Read | All running TWAP orders. |
| `getTwapOrderHistory` | Read | Summarized TWAP order history (cursor-paginated). |
| `getTwapOrderHistoryById` | Read | Full per-event history of a single TWAP order by ID. |
| `openOrder` | Write | Create a limit order, optionally with an attached take-profit and/or stop-loss. |
| `createMarketOrder` | Write | Create a market order with max slippage, optionally with TP/SL. |
| `editOrder` | Write | Edit a limit order (cancels the original and creates a new post-only order). |
| `cancelOrder` | Write | Cancel an unfilled order by symbol and order ID. |
| `cancelAllOrders` | Write | Cancel all unfilled orders, or all for a single pair. |
| `createStopOrder` | Write | Create a standalone stop-loss/take-profit order. |
| `cancelStopOrder` | Write | Cancel a stop-loss/take-profit order by ID. |
| `setPositionTpsl` | Write | Attach take-profit and/or stop-loss to an existing position. |
| `addIsolatedMargin` | Write | Add USDC margin to an isolated position. |
| `createTwapOrder` | Write | Create a TWAP order that splits the total amount into market sub-orders over a duration. |
| `cancelTwapOrder` | Write | Cancel a running TWAP order by ID. |
| `batchOrders` | Write | Execute up to 10 order actions (create, cancel, edit, TP/SL) in one request. |
## Spot
Spot asset data, balances, and withdrawals.
| Tool | Access | Description |
| --------------------------- | ------ | ------------------------------------------------------------------------ |
| `getSpotAssets` | Read | List available spot assets and their parameters. |
| `getBridgeInfo` | Read | Bridge parameters for all spot assets. |
| `getBridgeParameters` | Read | Bridge parameters for a single spot asset. |
| `getSpotBalanceHistory` | Read | Spot asset balance history (cursor-paginated). |
| `getSpotDepositHistory` | Read | Spot asset deposit history (cursor-paginated). |
| `getSpotWithdrawalHistory` | Read | Spot asset withdrawal history (cursor-paginated). |
| `getPendingSpotWithdrawals` | Read | Pending spot asset withdrawals not yet batched. |
| `withdrawSpotAsset` | Write | Queue an on-chain spot asset withdrawal to your wallet (not reversible). |
## Funding
On-chain tools that fund your wallet and exchange balance. They sign and send Solana transactions directly rather than calling the REST API, so they require `PRIVATE_KEY` - an agent key cannot sign on-chain transactions - and they use `SOLANA_RPC_URL` (defaults to public devnet). See [Configuration](/api-documentation/api/mcp/configuration).
| Tool | Access | Description |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mintUsdp` | On-chain | Mint test USDP into your wallet's token account. Testnet only - registered only when `PACIFICA_BASE_URL` targets testnet. |
| `depositUsdp` | On-chain | Deposit your wallet's USDC/USDP into the Pacifica exchange balance used for trading. Works on testnet and mainnet; on mainnet it moves real USDC. |
On testnet, a typical flow is `mintUsdp` to credit your wallet, then `depositUsdp` to move those funds into your exchange balance.
# Rate Limits
Source: https://docs.pacifica.fi/api-documentation/api/rate-limits
Pacifica uses a credit-based rate limiting system with a 60-second rolling window.
### Credit Quotas
The API config key system allows Pacifica to provision higher rate limits to verified users, ensuring real traders have adequate resources while protecting against abuse.
| Tier | Base Credits/60s |
| -------------------- | ---------------- |
| Unidentified IP | 100 |
| Valid API Config Key | 300 |
These are base quotas and may be increased based on account reputation. The credit is shared across a main account and all its subaccounts. Naturally, higher [fee tier](/trading-on-pacifica/trading-fees) grants an account higher rate limits.
| Tier | Credits/60s |
| ---- | ----------- |
| 1 | 300 |
| 2 | 600 |
| 3 | 1200 |
| 4 | 2400 |
| 5 | 6000 |
| VIP1 | 12000 |
| VIP2 | 24000 |
| VIP3 | 30000 |
### Credit Costs
| Action | Unidentified IP | API Config Key |
| ----------------------- | --------------- | -------------- |
| Standard request/action | 1 | 1 |
| Order cancellation | 0.5 | 0.5 |
| Heavy GET requests | 3-12 | 1-4 |
When credits are exhausted, requests return HTTP 429.
### WebSocket Limits
* Max 100 concurrent connections per IP
* Max 20 subscriptions per channel per connection
These are default limits; production deployments may set higher values, and quotas can be raised for specific accounts.
### Checking Your Quota
> **Note:** All credit values are multiplied by 10 to support fractional costs (e.g., `r=1200` = 120.0 credits).
**REST API** - Response headers:
```
ratelimit: "credits";r=1200;t=32
ratelimit-policy: "credits";q=1250;w=60
```
**WebSocket** - `rl` field in action responses:
```json theme={null}
{"rl": {"r": 1200, "q": 1250, "t": 32}}
```
| Field | Description |
| ----- | ---------------------- |
| `r` | Remaining credits |
| `t` | Seconds until refresh |
| `q` | Total quota per window |
| `w` | Window size in seconds |
# API Config Keys
Source: https://docs.pacifica.fi/api-documentation/api/rate-limits/api-config-keys
The following guide covers the creation and usage of Pacifica API Config Keys.
Pacifica offers API Config Key rate limiting on APIs that allows for more flexible limits.\
For more information around API Config Key limits, please reach out to us in the [Discord API channel](https://discord.com/channels/1325864651816435822/1378723526957334548).\
\
API Config Keys are generated via REST API. The Python SDK provides examples for how API Config Key can be generated, listed and revoked: [https://github.com/pacifica-fi/python-sdk/blob/main/rest/api\_config\_keys.py](https://github.com/pacifica-fi/python-sdk/blob/main/rest/api_config_keys.py).\
\
Each account can have up to 5 API Config Keys.
```http theme={null}
POST /api/v1/account/api_keys/create
POST /api/v1/account/api_keys/revoke
POST /api/v1/account/api_keys
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
#### Response
```json theme={null}
{
"data": {
"api_key": "AbCdEfGh_2mT8x..."
}
}
```
Note:\
API Config Keys are generated with a prefix for fast lookup\
Format: `"{8_char_prefix}_{base58_encoded_uuid}"`
### Using a Pacifica API Config Key
Pacifica's API Config Keys are used to enhance websocket rate-limiting. The default rate for an API Config Key follows the same restrictions as IP-based rate limits.\
\
Pacifica API Config Keys are used in the connection header to specify API Config Key rate limiting. Using the Python SDK as an example,
* for Websockets, add `extra_headers={"PF-API-KEY": "your_rate_limit_key"}`into `websockets.connect`
* for REST APIs, add `"PF-API-KEY": "your_rate_limit_key"` into `headers` with `{"Content-Type": "application/json"}`
# REST API
Source: https://docs.pacifica.fi/api-documentation/api/rest-api
All example API calls use the Pacifica Mainnet URL, but you can make the same requests against Testnet using the Pacifica Testnet URL.
Mainnet REST endpoint URL: [https://api.pacifica.fi/api/v1](https://api.pacifica.fi/api/v1)\
Testnet REST endpoint URL: [https://test-api.pacifica.fi/api/v1](https://test-api.pacifica.fi/api/v1)
Requests and responses use JSON.
# Account
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account
This section covers details for interacting with user accounts on Pacifica.
* [Get account info](/api-documentation/api/rest-api/account/get-account-info): This endpoint allows users to get all high-level account info such as balance, fee level, equity, etc.
* [Get account settings](/api-documentation/api/rest-api/account/get-account-settings): This endpoint allows users to get account margin and leverage settings (if they are not at default values)
* [Update leverage](/api-documentation/api/rest-api/account/update-leverage): This endpoint allows users to change their account leverage for a specific trading pair. For open positions, users can only increase the leverage setting.
* [Update margin mode](/api-documentation/api/rest-api/account/update-margin-mode): This endpoint allows users to switch between isolated and cross margin modes for a specific trading pair. For open positions, users cannot change the margin mode.
* [Get positions](/api-documentation/api/rest-api/account/get-positions): This endpoint allows users to get current positions.
* [Get trade history](/api-documentation/api/rest-api/account/get-trade-history): This endpoint allows users to get trade history
* [Get funding history](/api-documentation/api/rest-api/account/get-funding-history): This endpoint allows users to get funding history.
* [Get account equity history](/api-documentation/api/rest-api/account/get-account-equity-history): This endpoint allows users to get account equity and PnL history (over time).
* [Get account balance history](/api-documentation/api/rest-api/account/get-account-balance-history): This endpoint allows users to get account balance history. Returns all balance effects that affect the queried account.
* [Request withdrawal](/api-documentation/api/rest-api/account/request-withdrawal): This endpoint allows users to request withdrawal.
* [Get account loan info](/api-documentation/api/rest-api/account/get-account-loan-info): This endpoint returns loan and collateral information for a given account under unified margin.
* [Add isolated margin](/api-documentation/api/rest-api/account/add-isolated-margin): This endpoint allows users to add margin to an isolated position.
* [Update spot settings](/api-documentation/api/rest-api/account/update-spot-settings): This endpoint allows users to update spot asset settings for unified margin.
* [Toggle auto-lending](/api-documentation/api/rest-api/account/toggle-auto-lending): This endpoint allows users to enable or disable automatic lending.
* [Get spot balance history](/api-documentation/api/rest-api/account/get-spot-balance-history): This endpoint allows users to get spot asset balance history.
* [Withdraw spot asset](/api-documentation/api/rest-api/account/withdraw-spot-asset): This endpoint allows users to withdraw a spot asset.
* [Get pending spot withdrawals](/api-documentation/api/rest-api/account/get-pending-spot-withdrawals): This endpoint returns pending spot asset withdrawals.
* [Get spot deposit history](/api-documentation/api/rest-api/account/get-spot-deposit-history): This endpoint returns spot asset deposit history.
* [Get spot withdrawal history](/api-documentation/api/rest-api/account/get-spot-withdrawal-history): This endpoint returns spot asset withdrawal history.
# Add Isolated Margin
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/add-isolated-margin
This endpoint allows users to add margin to an isolated position.
```http theme={null}
POST /api/v1/positions/add_isolated_margin
```
The operation type for signing is `"add_isolated_margin"`.
Transfers USDC from free balance into the isolated margin pool for the specified position.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"amount" | string | required | Amount of USDC to add as margin | 100.000000 |
"agent\_wallet" | string | optional | Agent wallet address | 8zFqj1Kp... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 10000 |
#### Response
* Status 200: Successfully added isolated margin
```json theme={null}
{
"success": true
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"symbol": "BTC",
"amount": "100.000000",
}
response = requests.post(
"/api/v1/positions/add_isolated_margin",
json=payload,
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Account Balance History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-balance-history
This endpoint allows users to get account balance history. Returns all balance effects that affect the queried account.
```http theme={null}
GET /api/v1/account/balance/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"limit" | integer | optional | Maximum number of records to return, defaults to system defined limit | 100 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
"include\_trades" | boolean | optional | If true, includes trade events. By default only shows deposit, withdraw, subaccount transfer, and payout events | false |
```http theme={null}
/api/v1/account/balance/history?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved balance history
```json theme={null}
{
"success": true,
"data": [
{
"amount": "100.000000",
"balance": "1200.000000",
"pending_balance": "0.000000",
"event_type": "deposit",
"created_at": 1716200000000
}
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
| ------------------- | -------------- | ------------------------------------------------------------ |
| `'amount'` | decimal string | Amount change to balance after event |
| `'balance'` | decimal string | Account balance after event |
| `'pending_balance'` | decimal string | Pending balance after event |
| `'event_type'` | string | Type of balance event (see below) |
| `'created_at'` | integer | Timestamp in milliseconds of when the balance event occurred |
| `'next_cursor'` | string | Next cursor for pagination |
| `'has_more'` | boolean | True if there exists a `'next_cursor'` |
| Event Type (String) | Description |
| ------------------------ | ------------------------------------------ |
| `'deposit'` | Deposit funds to account |
| `'deposit_release'` | Release of previously pending deposit |
| `'withdraw'` | Withdrawal of funds from account |
| `'trade'` | Trading activity (fees, realized PnL) |
| `'market_liquidation'` | Liquidation by market orders |
| `'backstop_liquidation'` | Liquidation by backstop liquidator |
| `'adl_liquidation'` | Liquidation by auto-deleveraging |
| `'subaccount_transfer'` | Transfer between subaccounts |
| `'funding'` | Funding payment |
| `'payout'` | Payout event (from e.g. affiliate program) |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/portfolio?account/balance/history?account=42trU9A5..."
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Account Equity History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-equity-history
This endpoint allows users to get account equity and PnL history (over time).
```http theme={null}
GET /api/v1/portfolio
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"time\_range" | string | required | Time range of history: 1d, 7d, 14d, 30d, all | 7d |
"start\_time" | integer | optional | Start time in milliseconds | 1760271000000 |
"end\_time" | integer | optional | End time in milliseconds | 1761842220000 |
"limit" | integer | optional | Maximum number of records to return, defaults to 100 | 100 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
```http theme={null}
/api/v1/portfolio?account=42trU9A5...&time_range=7d
```
#### Response
* Status 200: Successfully retrieved portfolio history
```json theme={null}
{
"success": true,
"data": [
{
"account_equity": "61046.308885",
"pnl": "9297.553505",
"timestamp": 1761177600000
},
...
],
"error": null,
"code": null
}
```
| Field | Type | Description |
| ------------------ | -------------- | -------------------------------------------------------- |
| `'account_equity'` | decimal string | Account equity (balance + unrealized PnL) at last update |
| `'PnL'` | decimal string | PnL of account since creation |
| `'timestamp'` | integer | Timestamp in milliseconds of last account equity update |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/portfolio?account=42trU9A5...&time_range=7d",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Account Info
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-info
This endpoint allows users to get all high-level account info such as balance, fee level, equity, etc.
```http theme={null}
GET /api/v1/account
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Account address | 42trU9A5... |
```http theme={null}
/api/v1/account?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved account information
```json theme={null}
{
"success": true,
"data": {
"balance": "2000.000000",
"fee_level": 0,
"maker_fee": "0.00015",
"taker_fee": "0.0004",
"account_equity": "2150.250000",
"available_to_spend": "1800.750000",
"available_to_withdraw": "1500.850000",
"pending_balance": "0.000000",
"pending_interest": "0.000000",
"spot_collateral": "0.000000",
"cross_account_equity": "2100.500000",
"spot_market_value": "250.000000",
"total_margin_used": "349.500000",
"cross_mmr": "420.690000",
"positions_count": 2,
"orders_count": 3,
"stop_orders_count": 1,
"updated_at": 1716200000000,
"spot_balances": [
{
"symbol": "SOL",
"amount": "1.50000000",
"available_to_withdraw": "1.00000000",
"pending_balance": "0.50000000",
"daily_withdraw_amount_usd": "250.000000",
"effective_daily_deposit_limit_usd": "50000.000000",
"effective_daily_withdraw_limit_usd": "250000.000000"
}
]
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| ------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- |
| `'balance'` | decimal string | Current account balance, defined as amount of USD in account before settlement |
| `'fee_level'` | integer | Current fee tier of account, determined by trading volume |
| `'maker_fee'` | decimal string | Current maker fee rate of account, determined by trading volume |
| `'taker_fee'` | decimal string | Current taker fee rate of account, determined by trading volume |
| `'account_equity'` | decimal string | Account balance + unrealized PnL + isolated margin + raw spot market value |
| `'available_to_spend'` | decimal string | Amount of account equity that is available to be used to margin for open positions and orders |
| `'available_to_withdraw'` | decimal string | Amount that is available to withdraw out from the exchange |
| `'pending_balance'` | decimal string | Amount of account balance in pending status (deposit request is successful, waiting on confirmation) |
| `'total_margin_used'` | decimal string | Amount of account equity currently being used to margin for open positions and orders |
| `'cross_mmr'` | decimal string | The maintenance margin required under the cross mode |
| `'positions_count'` | integer | Number of open positions (isolated and cross) |
| `'orders_count'` | integer | Number of open orders across all markets (excludes stop orders) |
| `'stop_orders_count'` | integer | Number of open stop orders across markets |
| `'pending_interest'` | decimal string | Accrued loan interest not yet repaid |
| `'spot_collateral'` | decimal string | Total USD value of spot assets used as collateral for unified margin |
| `'cross_account_equity'` | decimal string or null | Cross-margin equity after applying unified-margin collateral rules. `null` if not applicable |
| `'spot_market_value'` | decimal string | Raw marked-to-market value of positive spot balances before collateral haircuts |
| `'spot_balances'` | array | List of spot asset balances held by the account (see below) |
| `'updated_at'` | integer | Timestamp in milliseconds of last account info update |
**Spot Balance Fields**
| Field | Type | Description |
| -------------------------------------- | -------------- | ----------------------------------- |
| `'symbol'` | string | Spot asset symbol |
| `'amount'` | decimal string | Total amount of the spot asset held |
| `'available_to_withdraw'` | decimal string | Amount available to withdraw |
| `'pending_balance'` | decimal string | Amount pending confirmation |
| `'daily_withdraw_amount_usd'` | decimal string | USD value of withdrawals made today |
| `'effective_daily_deposit_limit_usd'` | decimal string | Daily deposit limit in USD |
| `'effective_daily_withdraw_limit_usd'` | decimal string | Daily withdrawal limit in USD |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account?account=42trU9A5...",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Account Loan Info
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-loan-info
This endpoint returns loan and collateral information for a given account under unified margin.
```http theme={null}
GET /api/v1/account/loan
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Account address | 42trU9A5... |
```http theme={null}
/api/v1/account/loan?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved account loan info
```json theme={null}
{
"success": true,
"data": {
"borrowed": "1250.500000",
"pending_interest": "3.250000",
"collateral_utilization": "0.45",
"total_interest_earned": "120.750000",
"total_interest_paid": "85.300000",
"spot_balances": [
{
"symbol": "SOL",
"amount": "10.00000000",
"ltv_ratio": "0.90",
"market_value": "1500.000000",
"collateral_value": "1350.000000"
}
],
"updated_at": 1716200000000
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| -------------------------- | -------------- | ------------------------------------------------------------------------------ |
| `'borrowed'` | decimal string | Current borrowed amount in USD |
| `'pending_interest'` | decimal string | Accrued interest not yet repaid |
| `'collateral_utilization'` | decimal string | Ratio of borrowed amount to total spot collateral capacity |
| `'total_interest_earned'` | decimal string | Total interest earned as a lender (cumulative) |
| `'total_interest_paid'` | decimal string | Total interest paid as a borrower (cumulative, returned as positive) |
| `'spot_balances'` | array | Spot balances with their effective LTV and collateral contribution (see below) |
| `'updated_at'` | integer | Timestamp in milliseconds of last data update |
**Spot Balance Fields**
| Field | Type | Description |
| -------------------- | -------------- | ------------------------------------------------------------------- |
| `'symbol'` | string | Spot asset symbol |
| `'amount'` | decimal string | Spot balance amount |
| `'ltv_ratio'` | decimal string | Effective LTV ratio used for loan collateral |
| `'market_value'` | decimal string | Raw marked-to-market USD value of this positive spot balance |
| `'collateral_value'` | decimal string | Effective collateral contribution of this asset after LTV/cap logic |
* Status 404: Account loan cache not found
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/loan",
params={"account": "42trU9A5..."},
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Account Settings
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-account-settings
This endpoint allows users to get account margin and leverage settings (if they are not at default values)
```http theme={null}
GET /api/v1/account/settings
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Account address | 42trU9A5... |
```http theme={null}
/api/v1/account/settings?account=42trU9A5...
```
#### Response
NOTE: Upon account creation, all markets have margin settings default to cross margin and leverage default to max. When querying this endpoint, all markets with default margin and leverage settings on this account will return blank.
* Status 200: Successfully retrieved account settings
```json theme={null}
{
"success": true,
"data": {
"auto_lend_disabled": null,
"margin_settings": [
{
"symbol": "WLFI",
"isolated": false,
"leverage": 5,
"created_at": 1758085929703,
"updated_at": 1758086074002
}
],
"spot_settings": [
{
"symbol": "SOL",
"unified_margin_excluded": false
}
],
"error": null,
"code": null
}
}
```
| Field | Type | Description |
|---|
"auto\_lend\_disabled" | boolean or null | Whether automatic lending is disabled for this account. null means default (enabled) |
"spot\_settings" | array | Per-asset spot settings for unified margin (see below) |
"symbol" | string | Trading pair symbol |
"isolated" | boolean | If the account is set to isolated margining for this symbol |
"leverage" | integer | Current leverage set by the user (default to max) |
"created\_at" | integer | Timestamp in milliseconds when these settings were adjusted from their default |
"updated\_at" | integer | Timestamp in milliseconds when these settings were last updated |
**Spot Settings Fields**
| Field | Type | Description |
| --------------------------- | ------- | ---------------------------------------------------------------------------------- |
| `"symbol"` | string | Spot asset symbol |
| `"unified_margin_excluded"` | boolean | If `true`, this spot asset is excluded from unified margin collateral calculations |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/settings?account=42trU9A5...",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Funding History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-funding-history
This endpoint allows users to get funding history.
```http theme={null}
GET /api/v1/funding/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"limit" | integer | optional | Maximum number of records to return default system defined limit | 100 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
```http theme={null}
/api/v1/funding/history?account=42trU9A5...&limit=20&cursor=11115hVka
```
#### Response
* Status 200: Successfully retrieved funding history
```json theme={null}
{
"success": true,
"data": [
{
"history_id": 2287920,
"symbol": "PUMP",
"side": "ask",
"amount": "39033804",
"payout": "2.617479",
"rate": "0.0000125",
"created_at": 1759222804122
},
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
|---|
"history\_id" | integer | History id of trade |
"symbol" | string | Trading pair symbol |
"side" | string | If the position resulting in the funding payment was long or short (bid or ask) |
"amount" | decimal string | Amount (in token denomination) of the position that resulted in the funding payment |
"payout" | decimal string | Funding paid (in USD) |
"rate" | decimal string | Funding rate that was used to calculate the payout |
"created\_at" | integer | Timestamp in milliseconds when the funding payment was logged |
'next\_cursor' | string | Next cursor for pagination |
'has\_more' | boolean | True if there exists a 'next\_cursor' |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/funding/history?account=42trU9A5...&limit=20&cursor=11115hVka",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Pending Spot Withdrawals
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-pending-spot-withdrawals
This endpoint returns pending spot asset withdrawals.
```http theme={null}
GET /api/v1/account/spot_asset/withdraw/pending
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
```http theme={null}
/api/v1/account/spot_asset/withdraw/pending?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved pending spot withdrawals
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "SOL",
"amount": "1.00000000",
"amount_requested": "1.00100000",
"fee_amount": "0.00100000",
"batch_nonce": 42,
"created_at": 1716200000000
}
...
]
}
```
| Field | Type | Description |
| -------------------- | -------------- | ------------------------------------------------------------ |
| `'symbol'` | string | Spot asset symbol |
| `'amount'` | decimal string | Net amount to be received after fees |
| `'amount_requested'` | decimal string | Original amount requested for withdrawal |
| `'fee_amount'` | decimal string | Fee deducted from the withdrawal |
| `'batch_nonce'` | integer | Nonce of the withdrawal batch |
| `'created_at'` | integer | Timestamp in milliseconds of when the withdrawal was created |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/spot_asset/withdraw/pending",
params={"account": "42trU9A5..."},
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Positions
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-positions
This endpoint allows users to get current positions.
```http theme={null}
GET /api/v1/positions
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Connected wallet address | 42trU9A5... |
```http theme={null}
/api/v1/positions?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved account information
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "AAVE",
"side": "ask",
"amount": "223.72",
"entry_price": "279.283134",
"margin": "0", // only shown for isolated margin
"funding": "13.159593",
"isolated": false,
"liquidation_price": null,
"created_at": 1754928414996,
"updated_at": 1759223365538
}
],
"error": null,
"code": null,
"last_order_id": 1557431179
}
```
| Field | Type | Description |
|---|
"symbol" | string | Trading pair symbol |
"side" | string | Position side: bid (long) or ask (short) |
"amount" | decimal string | Position size in the asset's base unit |
"entry\_price" | decimal string | Entry price of the position. Takes VWAP if position was opened by multiple trades executed at different prices. |
"margin" | decimal string | Amount of margin allocated to an isolated position (only shown when isolated) |
"funding" | decimal string | Funding paid by this position since open |
"isolated" | boolean | If the position is opened in isolated margin mode |
"liquidation\_price" | decimal string or null | Estimated liquidation price for the position. null if not applicable |
"created\_at" | integer | Timestamp in milliseconds when the position was opened |
"updated\_at" | integer | Timestamp in milliseconds when these settings were last updated |
"last\_order\_id" | integer | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/positions?account=42trU9A5...",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Spot Balance History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-spot-balance-history
This endpoint allows users to get spot asset balance history.
```http theme={null}
GET /api/v1/account/spot_balance/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"symbol" | string | optional | Filter by spot asset symbol | SOL |
"limit" | integer | optional | Maximum number of records to return, defaults to system defined limit | 100 |
"cursor" | string | optional | Cursor for pagination. Default to none | 1115hVka |
```http theme={null}
/api/v1/account/spot_balance/history?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved spot balance history
```json theme={null}
{
"success": true,
"data": [
{
"amount": "1.00000000",
"balance": "5.50000000",
"symbol": "SOL",
"event_type": "deposit",
"created_at": 1716200000000
}
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
| --------------- | -------------- | ---------------------------------------------------- |
| `'amount'` | decimal string | Amount change to balance after event |
| `'balance'` | decimal string | Balance after event |
| `'symbol'` | string | Spot asset symbol |
| `'event_type'` | string | Type of balance event |
| `'created_at'` | integer | Timestamp in milliseconds of when the event occurred |
| `'next_cursor'` | string | Next cursor for pagination |
| `'has_more'` | boolean | True if there exists a `'next_cursor'` |
* Status 400: Invalid request parameters
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/spot_balance/history",
params={"account": "42trU9A5..."},
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Spot Deposit History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-spot-deposit-history
This endpoint returns spot asset deposit history.
```http theme={null}
GET /api/v1/account/spot_asset/deposit/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"limit" | integer | optional | Maximum number of records to return, defaults to system defined limit | 100 |
"cursor" | string | optional | Cursor for pagination. Default to none | 1115hVka |
```http theme={null}
/api/v1/account/spot_asset/deposit/history?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved spot deposit history
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "SOL",
"amount": "1.50000000",
"transaction_id": "5xGk...",
"created_at": 1716200000000
}
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
| ------------------ | -------------- | ------------------------------------------------------ |
| `'symbol'` | string | Spot asset symbol |
| `'amount'` | decimal string | Amount deposited |
| `'transaction_id'` | string | On-chain transaction identifier |
| `'created_at'` | integer | Timestamp in milliseconds of when the deposit occurred |
| `'next_cursor'` | string | Next cursor for pagination |
| `'has_more'` | boolean | True if there exists a `'next_cursor'` |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/spot_asset/deposit/history",
params={"account": "42trU9A5..."},
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Spot Withdrawal History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-spot-withdrawal-history
This endpoint returns spot asset withdrawal history.
```http theme={null}
GET /api/v1/account/spot_asset/withdraw/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"limit" | integer | optional | Maximum number of records to return, defaults to system defined limit | 100 |
"cursor" | string | optional | Cursor for pagination. Default to none | 1115hVka |
```http theme={null}
/api/v1/account/spot_asset/withdraw/history?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved spot withdrawal history
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "SOL",
"amount": "1.00000000",
"batch_nonce": 42,
"transaction_id": "5xGk...",
"created_at": 1716200000000
}
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
| ------------------ | -------------- | --------------------------------------------------------- |
| `'symbol'` | string | Spot asset symbol |
| `'amount'` | decimal string | Amount withdrawn |
| `'batch_nonce'` | integer | Nonce of the withdrawal batch |
| `'transaction_id'` | string | On-chain transaction identifier |
| `'created_at'` | integer | Timestamp in milliseconds of when the withdrawal occurred |
| `'next_cursor'` | string | Next cursor for pagination |
| `'has_more'` | boolean | True if there exists a `'next_cursor'` |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/account/spot_asset/withdraw/history",
params={"account": "42trU9A5..."},
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Trade History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/get-trade-history
This endpoint allows users to get trade history
```http theme={null}
GET /api/v1/trades/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | optional | User's wallet address | 42trU9A5... |
"symbol" | string | optional | Market symbol to filter by | BTC |
"builder\_code" | string | optional | Only return trades with this builder code | BUILDER1 |
"start\_time" | integer | optional | Start time in milliseconds | 1625097600000 |
"end\_time" | integer | optional | End time in milliseconds | 1759215599188 |
"limit" | integer | optional | Maximum number of records to return, defaults to 100 | 100 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
```http theme={null}
/api/v1/trades/history?account=42trU9A5...&start_time=1625097600000&end_time=1759215599188
```
#### Response
* Status 200: Successfully retrieved portfolio position history
```json theme={null}
{
"success": true,
"data": [
{
"history_id": 19329801,
"order_id": 315293920,
"client_order_id": "acf...",
"symbol": "LDO",
"amount": "0.1",
"price": "1.1904",
"entry_price": "1.176247",
"fee": "0",
"pnl": "-0.001415",
"event_type": "fulfill_maker",
"side": "close_short",
"created_at": 1759215599188,
"cause": "normal"
},
...
],
"next_cursor": "11111Z5RK",
"has_more": true
}
```
| Field | Type | Description |
|---|
"history\_id" | integer | History id of trade |
"order\_id" | integer | Order id of order that resulted in the trade |
"client\_order\_id" | UUID | CLOID of order that resulted in the trade |
"symbol" | string | Trading pair symbol |
"amount" | decimal string | Amount (in token denomination) of the trade event |
"price" | decimal string | Current price of the specified symbol |
"entry\_price" | decimal string | Price at which the trade event was executed |
"fee" | decimal string | Fee paid by the trade event |
"spot\_fee" | decimal string or null | Native spot fee paid for this trade; only set for spot-buy fills |
"pnl" | decimal string | PnL generated by the trade event |
"event\_type" | string | "fulfill\_taker" if taker
"fulfill\_maker" if maker |
"side" | string | "open\_long"
"open\_short"
"close\_long"
"close\_short" |
"created\_at" | integer | Timestamp in milliseconds when the trade event occurred |
"cause" | string | "normal" regular user-initiated trading
"market\_liquidation" position was liquidated due to insufficient margin
"backstop\_liquidation" position was liquidated by backstop mechanism
"settlement" position was closed due to Auto-Deleveraging (ADL) or other settlement |
'next\_cursor' | string | Next cursor for pagination |
'has\_more' | boolean | True if there exists a 'next\_cursor' |
| Field | Type | Description |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'event_type'` | string | "fulfill\_taker" if taker
"fulfill\_maker" if maker
|
| `'side'` | string | "open\_long"
"open\_short"
"close\_long"
"close\_short"
|
| `'cause'` | string | "normal"
regular user-initiated trading
"market\_liquidation" position was liquidated due to insufficient margin
"backstop\_liquidation" position was liquidated by backstop mechanism
"settlement"
position was closed due to Auto-Deleveraging (ADL) or other settlement
|
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/trades/history?account=42trU9A5...&symbol=BTC&limit=20&cursor=11115hVka",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Request Withdrawal
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/request-withdrawal
This endpoint allows users to request withdrawal.
```http theme={null}
POST /api/v1/account/withdraw
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"amount" | string | required | Amount to withdraw in USDC | 100.50 |
"idempotency\_key" | string | optional | Full UUID string. Prevents duplicate withdrawals | 550e8400-e29b-41d4-a716-446655440000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"amount": "100.50",
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
}
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": {
"batch_nonce": 42,
"requested_amount": "100.500000",
"fee_amount": "1.000000"
}
}
```
| Field | Type | Description |
| -------------------- | -------------- | -------------------------------- |
| `'batch_nonce'` | integer | Nonce of the withdrawal batch |
| `'requested_amount'` | decimal string | Amount requested for withdrawal |
| `'fee_amount'` | decimal string | Fee deducted from the withdrawal |
* Status 400: Invalid request parameters
* Status 409: Duplicate idempotency key
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"amount": "100.50"
}
response = requests.post(
"/api/v1/account/withdraw",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Toggle Auto-Lending
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/toggle-auto-lending
This endpoint allows users to enable or disable automatic lending.
```http theme={null}
POST /api/v1/account/settings/auto_lend_disabled
```
The operation type for signing is `"set_auto_lend_disabled"`.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"disabled" | boolean or null | optional | Set to true to disable auto-lending, false to enable, or null to clear (return to default) | true |
"agent\_wallet" | string | optional | Agent wallet address | 8zFqj1Kp... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 10000 |
#### Response
* Status 200: Successfully updated auto-lending setting
```json theme={null}
{
"success": true
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
# Disable auto-lending
payload = {
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"disabled": True,
}
response = requests.post(
"/api/v1/account/settings/auto_lend_disabled",
json=payload,
headers={"Accept": "*/*"},
)
data = response.json()
```
# Update Leverage
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/update-leverage
This endpoint allows users to change their account leverage for a specific trading pair. For open positions, users can only increase the leverage setting.
```http theme={null}
POST /api/v1/account/leverage
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | ------------------- |
| `"type"` | string | `"update_leverage"` |
Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"symbol" | string | required | Trading pair symbol | BTC |
"leverage" | integer | required | New leverage value | 10 |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
```json theme={null}
{
"account": "42trU9A5...",
"symbol": "BTC",
"leverage": 10,
"timestamp": 1716200000000,
"expiry_window": 30000,
"agent_wallet": "69trU9A5...",
"signature": "5j1Vy9UqY..."
}
```
#### Response
* Status 200: Leverage updated successfully
```json theme={null}
{
"success": true
}
```
* Status 400: Invalid request parameters
```json theme={null}
{
"error": "Invalid leverage",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"leverage": 10
}
response = requests.post(
"/api/v1/account/leverage",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Update Margin Mode
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/update-margin-mode
This endpoint allows users to switch between isolated and cross margin modes for a specific trading pair. For open positions, users cannot change the margin mode.
```http theme={null}
POST /api/v1/account/margin
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | ---------------------- |
| "type" | string | `"update_margin_mode"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"symbol" | string | required | Trading pair symbol | BTC |
"is\_isolated" | boolean | required | Margin mode (true for isolated, false for cross) | false |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
```json theme={null}
{
"account": "42trU9A5...",
"symbol": "BTC",
"is_isolated": false,
"timestamp": 1716200000000,
"expiry_window": 30000,
"agent_wallet": "69trU9A5...",
"signature": "5j1Vy9Uq..."
}
```
#### Response
* Status 200: Margin mode updated successfully
```json theme={null}
{
"success": true
}
```
* Status 400: Invalid request parameters
```json theme={null}
{
"error": "Invalid margin mode",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq",
"timestamp": 1716200000000,
"symbol": "BTC",
"is_isolated": false
}
response = requests.post(
"/api/v1/account/margin",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Update Spot Settings
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/update-spot-settings
This endpoint allows users to update spot asset settings for unified margin.
```http theme={null}
POST /api/v1/account/settings/spot
```
The operation type for signing is `"update_account_spot_settings"`.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Spot asset symbol | SOL |
"unified\_margin\_excluded" | boolean | required | Whether to exclude this asset from unified margin collateral | true |
"agent\_wallet" | string | optional | Agent wallet address | 8zFqj1Kp... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 10000 |
#### Response
* Status 200: Successfully updated spot settings
```json theme={null}
{
"success": true
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"symbol": "SOL",
"unified_margin_excluded": True,
}
response = requests.post(
"/api/v1/account/settings/spot",
json=payload,
headers={"Accept": "*/*"},
)
data = response.json()
```
# Withdraw Spot Asset
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/account/withdraw-spot-asset
This endpoint allows users to withdraw a spot asset.
```http theme={null}
POST /api/v1/account/spot_asset/withdraw
```
The operation type for signing is `"withdraw_spot_asset"`.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Spot asset symbol | SOL |
"amount" | string | required | Amount to withdraw | 1.00000000 |
"idempotency\_key" | string | optional | Full UUID string. Prevents duplicate withdrawals | 550e8400-e29b-41d4-a716-446655440000 |
"agent\_wallet" | string | optional | Agent wallet address | 8zFqj1Kp... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 10000 |
#### Response
* Status 200: Successfully submitted withdrawal
```json theme={null}
{
"success": true,
"data": {
"symbol": "SOL",
"batch_nonce": 42,
"requested_amount": "1.00000000",
"fee_amount": "0.00100000"
}
}
```
| Field | Type | Description |
| -------------------- | -------------- | -------------------------------- |
| `'symbol'` | string | Spot asset symbol |
| `'batch_nonce'` | integer | Nonce of the withdrawal batch |
| `'requested_amount'` | decimal string | Amount requested for withdrawal |
| `'fee_amount'` | decimal string | Fee deducted from the withdrawal |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 409: Duplicate idempotency key
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"symbol": "SOL",
"amount": "1.00000000",
}
response = requests.post(
"/api/v1/account/spot_asset/withdraw",
json=payload,
headers={"Accept": "*/*"},
)
data = response.json()
```
# Markets
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets
This section covers details for interacting with all perpetual futures markets listed on Pacifica.
* [Get market info](/api-documentation/api/rest-api/markets/get-market-info): This endpoint allows users to get exchange information, including market specifications for all available trading pairs.
* [Get prices](/api-documentation/api/rest-api/markets/get-prices): This endpoint allows users to get price information for all symbols, including mark prices, funding rates, and market statistics.
* [Get candle data](/api-documentation/api/rest-api/markets/get-candle-data): This endpoint allows users to get historical price candles for a specific market and time interval.
* [Get mark price candle data](/api-documentation/api/rest-api/markets/get-mark-price-candle-data): This endpoint allows users to get historical mark price candles for a specific market and time interval.
* [Get orderbook](/api-documentation/api/rest-api/markets/get-orderbook): This endpoint allows users to retrieve the current orderbook (bid/ask levels) for a specified trading symbol.
* [Get recent trades](/api-documentation/api/rest-api/markets/get-recent-trades): This endpoint allows users to get recent trades for a specific market.
* [Get historical funding](/api-documentation/api/rest-api/markets/get-historical-funding): This endpoint retrieves the historical funding for a particular symbol
* [Get fee levels](/api-documentation/api/rest-api/markets/get-fee-levels): This endpoint returns all fee level tiers and their corresponding maker and taker fee rates.
* [Get loan pool](/api-documentation/api/rest-api/markets/get-loan-pool): This endpoint returns the current state of the loan pool including utilization, borrow and lend rates.
# Get Candle Data
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-candle-data
This endpoint allows users to get historical price candles for a specific market and time interval.
```http theme={null}
/api/v1/kline
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"symbol" | string | required | Trading pair symbol | BTC |
"interval" | string | required | Candlestick interval Valid values: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 1w, 1M | 1m |
"start\_time" | integer | required | Start time in milliseconds | 1716200000000 |
"end\_time" | integer | optional | End time in milliseconds, defaults to current time if not provided | 1742243220000 |
"limit" | integer | optional | Maximum number of candles to return. Capped at 4000; defaults to 4000 if not provided | 100 |
```http theme={null}
/api/v1/kline?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000
```
#### Response
* Status 200: Successfully retrieved candle data
```json theme={null}
{
"success": true,
"data": [
{
"t": 1748954160000,
"T": 1748954220000,
"s": "BTC",
"i": "1m",
"o": "105376",
"c": "105376",
"h": "105376",
"l": "105376",
"v": "0.00022",
"n": 2
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
| ----- | -------------- | ------------------------------------------------- |
| `'t'` | number | Candle start time |
| `'T'` | number | Candle end time |
| `'s'` | string | Symbol |
| `'i'` | string | Time interval of candles |
| `'o'` | decimal string | Open price |
| `'c'` | decimal string | Close price |
| `'h'` | decimal string | High price |
| `'l'` | decimal string | Low price |
| `'v'` | decimal string | Volume |
| `'n'` | number | Number of trades on Pacifica for specified symbol |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/kline?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Fee Levels
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-fee-levels
This endpoint returns all fee level tiers and their corresponding maker and taker fee rates.
```http theme={null}
GET /api/v1/info/fees
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": [
{
"level": 0,
"maker_fee_rate": "0.00020",
"taker_fee_rate": "0.00050"
},
{
"level": 1,
"maker_fee_rate": "0.00015",
"taker_fee_rate": "0.00040"
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"level" | integer | Fee tier level |
"maker\_fee\_rate" | decimal string | Maker fee rate for this tier |
"taker\_fee\_rate" | decimal string | Taker fee rate for this tier |
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/info/fees",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Historical Funding
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-historical-funding
This endpoint retrieves the historical funding for a particular symbol
```http theme={null}
GET /api/v1/funding_rate/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"symbol" | string | required | Market symbol to query | BTC |
"limit" | integer | optional | Number of records to show (default 200, max 4000) | 20 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
```http theme={null}
/api/v1/funding_rate/history?symbol=BTC&limit=20&cursor=11115hVka
```
#### Response
* Status 200: Successfully retrieved funding history
```json theme={null}
{
"success": true,
"data": [
{
"oracle_price": "117170.410304",
"bid_impact_price": "117126",
"ask_impact_price": "117142",
"funding_rate": "0.0000125",
"next_funding_rate": "0.0000125",
"created_at": 1753806934249
},
...
],
"next_cursor": "11114Lz77",
"has_more": true
}
```
| Field | Type | Description |
| --------------------- | -------------- | ------------------------------------------------------------------------------------ |
| `'oracle_price'` | decimal string | Oracle price used for [funding rate calculation](/trading-on-pacifica/funding-rates) |
| `'bid_impact_price'` | decimal string | Bid impact price at time of calculation (see funding rate docs) |
| `'ask_impact_price'` | decimal string | Ask impact price at time of calculation (see funding rate docs) |
| `'funding_rate'` | decimal string | Last settled funding rate |
| `'next_funding_rate'` | decimal string | Predicted funding rate for next settlement |
| `'created_at'` | integer | Timestamp in milliseconds |
| `'next_cursor'` | string | Next cursor for pagination |
| `'has_more'` | boolean | True if there exists a `'next_cursor'` |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/funding_rate/history?symbol=BTC",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Loan Pool
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-loan-pool
This endpoint returns the current state of the loan pool including utilization, borrow and lend rates.
```http theme={null}
GET /api/v1/loan_pool
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": {
"total_borrowed": "500000.000000",
"total_borrowable": "2000000.000000",
"utilization": "0.25",
"borrow_rate_apr": "0.08",
"borrow_rate_apy": "0.0833",
"lend_rate_apr": "0.06",
"lend_rate_apy": "0.0618",
"utilization_max": "0.85",
"auto_lender_entry_threshold": "1000.000000",
"last_interest_accrual_at": 1716200000000,
"last_interest_payout_at": 1716200000000,
"updated_at": 1716200000000
},
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"total\_borrowed" | decimal string | Total amount currently borrowed from the pool |
"total\_borrowable" | decimal string | Total amount available to borrow |
"utilization" | decimal string | Pool utilization ratio (borrowed / total) |
"borrow\_rate\_apr" | decimal string | Current annualized borrow rate |
"borrow\_rate\_apy" | decimal string | Current compounded annual borrow rate |
"lend\_rate\_apr" | decimal string | Current annualized lending rate |
"lend\_rate\_apy" | decimal string | Current compounded annual lending rate |
"utilization\_max" | decimal string | Maximum utilization cap for the pool |
"auto\_lender\_entry\_threshold" | decimal string | Minimum balance threshold to be included in auto-lending |
"last\_interest\_accrual\_at" | integer or null | Timestamp of last interest accrual (ms). null if never accrued |
"last\_interest\_payout\_at" | integer or null | Timestamp of last interest payout (ms). null if never paid out |
"updated\_at" | integer | Timestamp of last update (ms) |
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/loan_pool",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Mark Price Candle Data
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-mark-price-candle-data
This endpoint allows users to get historical mark price candles for a specific market and time interval.
```http theme={null}
/api/v1/kline/mark
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"symbol" | string | required | Trading pair symbol | BTC |
"interval" | string | required | Candlestick interval Valid values: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 1w, 1M | 1m |
"start\_time" | integer | required | Start time in milliseconds | 1716200000000 |
"end\_time" | integer | optional | End time in milliseconds, defaults to current time if not provided | 1742243220000 |
"limit" | integer | optional | Maximum number of candles to return. Capped at 4000; defaults to 4000 if not provided | 100 |
```http theme={null}
/api/v1/kline/mark?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000
```
#### Response
* Status 200: Successfully retrieved mark price candle data
```json theme={null}
{
"success": true,
"data": [
{
"t": 1764126720000,
"T": 1764126780000,
"s": "BTC",
"i": "1m",
"o": "87701",
"c": "87687.303362",
"h": "87739",
"l": "87687.303362",
"v": "0.84106",
"n": 62
},
{
"t": 1764126780000,
"T": 1764126840000,
"s": "BTC",
"i": "1m",
"o": "87684.118667",
"c": "87654",
"h": "87684.118667",
"l": "87645",
"v": "4.5997",
"n": 91
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
| ----- | -------------- | ----------------------------------------------- |
| `'t'` | number | Candle start time |
| `'T'` | number | Candle end time |
| `'s'` | string | Symbol |
| `'i'` | string | Time interval of candles |
| `'o'` | decimal string | Open price |
| `'c'` | decimal string | Close price |
| `'h'` | decimal string | High price |
| `'l'` | decimal string | Low price |
| `'v'` | decimal string | Volume (always `"0"`) |
| `'n'` | number | Number of trades on Pacifica in candle duration |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/kline/mark?symbol=BTC&interval=1m&start_time=1742243160000&end_time=1742243220000",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Market Info
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-market-info
This endpoint allows users to get exchange information, including market specifications for all available trading pairs.
```http theme={null}
GET /api/v1/info
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "ETH",
"tick_size": "0.1",
"min_tick": "0",
"max_tick": "1000000",
"lot_size": "0.0001",
"max_leverage": 50,
"isolated_only": false,
"min_order_size": "10",
"max_order_size": "5000000",
"funding_rate": "0.0000125",
"next_funding_rate": "0.0000125",
"created_at": 1748881333944,
"instrument_type": "perpetual",
"base_asset": "ETH"
},
{
"symbol": "BTC",
"tick_size": "1",
"min_tick": "0",
"max_tick": "1000000",
"lot_size": "0.00001",
"max_leverage": 50,
"isolated_only": false,
"min_order_size": "10",
"max_order_size": "5000000",
"funding_rate": "0.0000125",
"next_funding_rate": "0.0000125",
"created_at": 1748881333944,
"instrument_type": "perpetual",
"base_asset": "BTC"
},
....
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"symbol" | string | Trading pair symbol |
"tick\_size" | decimal string | Tick size. All prices are denominated as a multiple of this. |
"min\_tick" | decimal string | Minimum tick. API submitted price cannot be below this value |
"max\_tick" | decimal string | Maximum tick. API submitted price cannot be above this value |
"lot\_size" | decimal string | Lot size. All order sizes (token denominated) are denominated as a multiple of this. |
"max\_leverage" | integer | Maximum leverage allowed on this symbol when opening positions |
"isolated\_only" | boolean | If the market is set to only allow isolated positions |
"min\_order\_size" | decimal string | Minimum order size (denominated in USD) |
"max\_order\_size" | decimal string | Maximum order size (denominated in USD) |
"funding\_rate" | decimal string | Funding rate paid in the past funding epoch (hour) |
"next\_funding\_rate" | decimal string | Estimated funding rate to be paid in the next funding epoch (hour) |
"created\_at" | integer | Timestamp (milliseconds) when the market was listed on Pacifica. Markets are returned oldest first. |
"instrument\_type" | string | Instrument type for the market (e.g. perpetual) |
"base\_asset" | string | Base asset of the market |
* Status 500: Internal server error
#### Code Example (Python)
```json theme={null}
import requests
response = requests.get(
"/api/v1/info",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Orderbook
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-orderbook
This endpoint allows users to retrieve the current orderbook (bid/ask levels) for a specified trading symbol.
```http theme={null}
/api/v1/book
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"symbol" | string | required | Trading pair symbol | BTC |
"agg\_level" | integer | no | Aggregation level for price grouping. Defaults to 1 | 1 |
```
api/v1/book?symbol=BTC
```
#### Response
* Status 200: Successfully retrieved book data
```json theme={null}
{
"success": true,
"data": {
"s": "BTC",
"l": [
[
{
"p": "106504",
"a": "0.26203",
"n": 1
},
{
"p": "106498",
"a": "0.29281",
"n": 1
}
],
[
{
"p": "106559",
"a": "0.26802",
"n": 1
},
{
"p": "106564",
"a": "0.3002",
"n": 1
},
]
],
"t": 1751370536325
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| ----- | -------------- | -------------------------------------------------------------------------------------------------------- |
| `'s'` | string | Symbol |
| `'l'` | array | Two-dimensional array containing bids (index 0) and asks (index 1). Each index contains up to 10 levels. |
| `'t'` | integer | Response timestamp in milliseconds |
| `'p'` | decimal string | Price level |
| `'a'` | decimal string | Total amount at price level |
| `'n'` | integer | Number of orders at level |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"api.pacifica.fi/api/v1/book?symbol=BTC",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Prices
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-prices
This endpoint allows users to get price information for all symbols, including mark prices, funding rates, and market statistics.
```http theme={null}
GET /api/v1/info/prices
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": [
{
"funding": "0.00010529",
"mark": "1.084819",
"mid": "1.08615",
"next_funding": "0.00011096",
"open_interest": "3634796",
"oracle": "1.084524",
"symbol": "XPL",
"timestamp": 1759222967974,
"volume_24h": "20896698.0672",
"yesterday_price": "1.3412"
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"funding" | decimal string | funding rate paid in the past funding epoch (hour) |
"mark" | decimal string | Mark price, as defined above |
"mid" | decimal string | Mid price, defined as the average of the best bid and best ask price |
"next\_funding" | decimal string | estimated funding rate to be paid in the next funding epoch (hour) |
"open\_interest" | decimal string | The current open interest on this symbol (in USD) |
"oracle" | decimal string | Oracle price, as defined above |
"symbol" | string | Trading pair symbol |
"timestamp" | integer | Timestamp in Milliseconds |
"volume\_24h" | decimal string | Volume (USD) of this market in the past 24 hours |
"yesterday\_price" | decimal string | Oracle price of this market 24 hours ago (USD) |
* Status 404: No prices data available
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/info/prices",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Recent Trades
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/markets/get-recent-trades
This endpoint allows users to get recent trades for a specific market.
```http theme={null}
GET /api/v1/trades
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"symbol" | string | optional | Trading pair symbol. If omitted, returns recent trades across all markets. | BTC |
```http theme={null}
/api/v1/trades?symbol=BTC
```
#### Response
* Status 200: Successfully retrieved recent trades
```json theme={null}
{
"success": true,
"data": [
{
"event_type": "fulfill_taker",
"price": "104721",
"amount": "0.0001",
"side": "close_long",
"cause": "normal",
"created_at": 1765006315306
}
],
"error": null,
"code": null,
"last_order_id": 1557404170
}
```
| Field | Type | Description |
| -------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'event_type'` | string | "fulfill\_taker" if maker
"fulfill\_maker" if taker
|
| `'price'` | decimal string | Price in USD at which trade event has occurred |
| `'amount'` | decimal string | Amount in token denomination for which the trade has occurred. |
| `'side'` | string | "open\_long"
"open\_short"
"close\_long"
"close\_short"
|
| `'cause'` | string | "normal"
regular user-initiated trading
"market\_liquidation" position was liquidated due to insufficient margin
"backstop\_liquidation" position was liquidated by backstop mechanism
"settlement"
position was closed due to Auto-Deleveraging (ADL) or other settlement
"insolvency\_liquidation" position was closed due to account insolvency
"game\_settlement" position was settled by the prediction game
"fulfill\_rfq" trade resulted from an RFQ fill
|
| `'created_at'` | integer | Timestamp in milliseconds of trade event |
The response also includes a top-level `last_order_id` field (a sibling of `data`, `error`, and `code` — not a member of each trade object):
| Field | Type | Description |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------- |
| `'last_order_id'` | integer | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/trades?symbol=BTC",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Orders
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders
This section covers details for interacting with current and historical orders on Pacifica.
* [Create market order](/api-documentation/api/rest-api/orders/create-market-order): This endpoint allows users to create a new market order with optional take profit and stop loss levels.
* [Create limit order](/api-documentation/api/rest-api/orders/create-limit-order): This endpoint allows users to create a new limit order with optional take profit and stop loss levels.
* [Create stop order](/api-documentation/api/rest-api/orders/create-stop-order): This endpoint allows users to create stop order.
* [Create position TP/SL](/api-documentation/api/rest-api/orders/create-position-tp-sl): This endpoint allows users to set take profit and stop loss levels for an existing position.
* [Cancel order](/api-documentation/api/rest-api/orders/cancel-order): This endpoint allows users to cancel an existing order.
* [Cancel all orders](/api-documentation/api/rest-api/orders/cancel-all-orders): This endpoint allows users to cancel all orders for all/given symbol(s).
* [Cancel stop order](/api-documentation/api/rest-api/orders/cancel-stop-order): This endpoint allows users to cancel a stop order by its (CL)OID.
* [Edit order](/api-documentation/api/rest-api/orders/edit-order): This endpoint allows users to edit an existing limit order by modifying its size and/or price.
* [Batch order](/api-documentation/api/rest-api/orders/batch-order): This endpoint allows users to submit multiple order operations in a single request. Batched orders are executed in the order they are batched in, and will not be split up by other users' orders.
* [Get open orders](/api-documentation/api/rest-api/orders/get-open-orders): This endpoint allows users to get open orders on their account.
* [Get order history](/api-documentation/api/rest-api/orders/get-order-history): This endpoint allows users to get a summarized order history.
* [Get order history by ID](/api-documentation/api/rest-api/orders/get-order-history-by-id): This endpoint allows users to get order history by id.
# Batch Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/batch-order
This endpoint allows users to submit multiple order operations in a single request. Batched orders are executed in the order they are batched in, and will not be split up by other users' orders.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/batch_orders.py) provides a comprehensive example on using this endpoint
```http theme={null}
POST /api/v1/orders/batch
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
|---|
| None | - | Batch orders are not signed as a whole, but rather by its individual actions components. |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"actions" | array | required | List of order actions to perform
Each action has a "type" field and action-specific "data" | See next two rows |
"type" | string | required | Specifies type of action. This is DIFFERENT to the "type" used in signature headers | "Create"
"CreateMarket"
"Cancel"
"Edit"
"SetPositionTpsl"
"CancelStopOrder"
(case sensitive)
|
"data" | object | required | Contains signed request payloads of individual actions. Fields are identical to the corresponding standalone endpoints: create limit order, create market order, cancel order, edit order, create position TP/SL, and cancel stop order. | See code block below. Messages and corresponding fields are identical to create and cancel requests. |
```json theme={null}
{
"actions":[
{
"type":"Create",
"data":{
"account":"42trU9A5...",
"signature":"5UpRZ14Q...",
"timestamp":1749190500355,
"expiry_window":5000,
"symbol":"BTC",
"price":"100000",
"reduce_only":false,
"amount":"0.1",
"side":"bid",
"tif":"GTC",
"client_order_id":"57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e"
}
},
{
"type":"CreateMarket",
"data":{
"account":"42trU9A5...",
"signature":"3KxMn7pQ...",
"timestamp":1749190500355,
"expiry_window":5000,
"symbol":"ETH",
"amount":"1.0",
"side":"ask",
"slippage_percent":"0.5",
"reduce_only":false
}
},
{
"type":"Cancel",
"data":{
"account":"42trU9A5...",
"signature":"4NDFHyTG...",
"timestamp":1749190500355,
"expiry_window":5000,
"symbol":"BTC",
"order_id":42069
}
}
]
}
```
#### Response
* Status 200: Batch operations processed successfully
```json theme={null}
{
"success": true,
"data": {
"results": [
{
"success": true,
"order_id": 470506,
"error": null
},
{
"success": true,
"order_id": null,
"error": null
}
]
},
"error": null,
"code": null
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid batch operation parameters",
"code": 400
}
```
* Status 500: Internal server error
### Notes on Batch Ordering
#### Speed Bump (Latency Protection)
Batch orders are subject to a conditional \~200ms delay to protect liquidity providers from adverse selection:\
\
Speed bump is applied if the batch contains:
* Market orders (CreateMarket)
* Limit orders with TIF = GTC or IOC
Speed bump is NOT applied if the batch only contains:
* Add Liquidity Only orders (TIF = ALO)
* Top of Book orders (TIF = TOB)
* Cancel operations
* TP/SL operations
#### Signature Requirements
* Each action in the batch must be individually signed
* All signatures must be valid for the batch to process
#### Execution Behavior and Limits
* Maximum 10 actions per batch request
* Actions are executed atomically in the order provided
* If one action fails, subsequent actions are still attempted
# Cancel All Orders
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-all-orders
This endpoint allows users to cancel all orders for all/given symbol(s).
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/cancel_all_orders.py) provides a comprehensive example on using this endpoint
```http theme={null}
POST /api/v1/orders/cancel_all
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | --------------------- |
| `"type"` | string | `"cancel_all_orders"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"all\_symbols" | boolean | required | Whether to cancel orders for all symbols | true |
"exclude\_reduce\_only" | boolean | required | Whether to exclude reduce-only orders | false |
"symbol" | string | required (if all\_symbols is false) | Trading pair symbol | |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"all_symbols": true,
"exclude_reduce_only": false,
"symbol": "BTC",
"agent_wallet": "69trU9A5...",
"expiry_window": 30000
}
```
#### Response
* Status 200: All orders cancelled successfully
```json theme={null}
{
"cancelled_count": 5
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid parameters",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"all_symbols": True,
"exclude_reduce_only": False
}
response = requests.post(
"/api/v1/orders/cancel_all",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Cancel Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-order
This endpoint allows users to cancel an existing order.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/cancel_order.py) provides a comprehensive example on using this endpoint.
```http theme={null}
POST /api/v1/orders/cancel
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | ---------------- |
| `"type"` | string | `"cancel_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"order\_id" | integer | required (if no CLOID) | Exchange-assigned order ID | 123 |
"client\_order\_id" | Full UUID string | required (if no OID) | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"order_id": 123,
"agent_wallet": "69trU9A5...",
"expiry_window": 30000
}
```
#### Response
* Status 200: Order cancelled successfully
```json theme={null}
{
"success": true
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Order not found",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"order_id": 123
}
response = requests.post(
"/api/v1/orders/cancel",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
Cancel requests are not affected by any speedbumps.
# Cancel Stop Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/cancel-stop-order
This endpoint allows users to cancel a stop order by its (CL)OID.
```http theme={null}
POST /api/v1/orders/stop/cancel
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | --------------------- |
| `"type"` | string | `"cancel_stop_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"order\_id" | integer | required (if no CLOID) | Exchange-assigned order ID | 123 |
"client\_order\_id" | Full UUID string | required (if no OID) | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"order_id": 123,
"agent_wallet": "69trU9A5...",
"expiry_window": 30000
}
```
#### Response
* Status 200: Stop order cancelled successfully
```json theme={null}
{
"success": true
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Stop order not found",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"order_id": 123
}
response = requests.post(
"/api/v1/orders/stop/cancel",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Create Limit Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-limit-order
This endpoint allows users to create a new limit order with optional take profit and stop loss levels.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/create_order.py) provides a comprehensive example on using this endpoint.
```http theme={null}
POST /api/v1/orders/create
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | ---------------- |
| `"type"` | string | `"create_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"price" | string | required | Order price | 50000 |
"amount" | string | required | Order amount | 0.1 |
"side" | string | required | Order side (bid/ask) | bid |
"tif" | string | required | Time in force (GTC, IOC, ALO, TOB; case-insensitive) | GTC |
"reduce\_only" | boolean | required | Whether the order is reduce-only | false |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"take\_profit" | object | optional | Take profit stop order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 55000 |
"limit\_price" | string | optional | Limit price for the triggered order | 54950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | e36ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"stop\_loss" | object | optional | Stop loss order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric characters) | MYCODE |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq",
"timestamp": 1716200000000,
"symbol": "BTC",
"price": "50000",
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"reduce_only": false,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950",
"client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
"builder_code": "MYCODE"
}
```
#### Response
* Status 200: Order created successfully
```json theme={null}
{
"order_id": 12345
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid order parameters",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"price": "50000",
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"reduce_only": False,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
response = requests.post(
"/api/v1/orders/create",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
Note: In order to protect liquidity providers from adverse selection, all TIF GTC, and TIF IOC orders are subject to a \~200ms delay.
# Create Market Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-market-order
This endpoint allows users to create a new market order with optional take profit and stop loss levels.
```http theme={null}
POST /api/v1/orders/create_market
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | ----------------------- |
| `"type"` | string | `"create_market_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"amount" | string | required | Order amount | 0.1 |
"side" | string | required | Order side (bid/ask) | bid |
"slippage\_percent" | string | required | Maximum slippage tolerance in percentage, e.g. "0.5" means 0.5% max slippage | 0.5 |
"reduce\_only" | boolean | required | Whether the order is reduce-only | false |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"take\_profit" | object | optional | Take profit stop order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 55000 |
"limit\_price" | string | optional | Limit price for the triggered order | 54950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | e36ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"stop\_loss" | object | optional | Stop loss order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric characters) | MYCODE |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq",
"timestamp": 1716200000000,
"symbol": "BTC",
"amount": "0.1",
"side": "bid",
"slippage_percent": "0.5",
"reduce_only": false,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950",
"client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
"builder_code": "MYCODE"
}
```
#### Response
* Status 200: Order created successfully
```json theme={null}
{
"order_id": 12345
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid order parameters",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"amount": "0.1",
"side": "bid",
"slippage_percent": 1,
"reduce_only": False,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}
response = requests.post(
"/api/v1/orders/create_market",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
Note: In order to protect liquidity providers from adverse selection, all market orders are subject to a \~200ms delay.
# Create Position TP/SL
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-position-tp-sl
This endpoint allows users to set take profit and stop loss levels for an existing position.
```http theme={null}
POST /api/v1/positions/tpsl
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | --------------------- |
| `"type"` | string | `"set_position_tpsl"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"side" | string | required | Order side (bid/ask) | bid |
"take\_profit" | object | optional (if there is SL) | Take profit stop order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 55000 |
"limit\_price" | string | optional | Limit price for the triggered order | 54950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | e36ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"stop\_loss" | object | optional (if there is TP) | Stop loss order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount for the triggered order. If omitted, the full position size is used | 0.1 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric characters) | MYCODE |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"side": "bid",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950",
"client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price"
},
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
"builder_code": "MYCODE"
}
```
#### Response
* Status 200: Take profit and stop loss set successfully
```json theme={null}
{
"success": true
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Position not found",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"side": "bid",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950"
}
}
response = requests.post(
"/api/v1/positions/tpsl",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Create Stop Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/create-stop-order
This endpoint allows users to create stop order.
```http theme={null}
POST /api/v1/orders/stop/create
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | --------------------- |
| `"type"` | string | `"create_stop_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"side" | string | required | Order side (bid/ask) | bid |
"reduce\_only" | boolean | required | Whether the order is reduce-only | false |
"stop\_order" | object | required | Stop order configuration | See next five rows |
"stop\_price" | string | required | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type used to trigger the stop order. Defaults to last\_trade\_price. Options: mark\_price, last\_trade\_price, mid\_price | mark\_price |
"amount" | string | optional | Order amount (inside stop\_order). If omitted, the full position size is used | 0.1 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric characters) | MYCODE |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"side": "bid",
"reduce_only": true,
"stop_order": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479",
"trigger_price_type": "mark_price",
"amount": "0.1"
},
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
"builder_code": "MYCODE"
}
```
#### Response
* Status 200: Stop order created successfully
```json theme={null}
{
"order_id": 12345
}
```
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid stop order parameters",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"side": "bid",
"reduce_only": True,
"stop_order": {
"stop_price": "48000",
"limit_price": "47950",
"amount": "0.1"
}
}
response = requests.post(
"/api/v1/orders/stop/create",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
# Edit Order
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/edit-order
This endpoint allows users to edit an existing limit order by modifying its size and/or price.
```http theme={null}
POST /api/v1/orders/edit
```
#### Operation Type (for Signing)
| Header Field | Type | Content |
| ------------ | ------ | -------------- |
| `"type"` | string | `"edit_order"` |
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"symbol" | string | required | Trading pair symbol | BTC |
"price" | string | required | Order price | 50000 |
"amount" | string | optional | Order amount. If omitted, the existing order's remaining amount is kept | 0.1 |
"order\_id" | integer | required (if no CLOID) | Exchange assigned order ID | 123456789 |
"client\_order\_id" | Full UUID string | required (if no OID) | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
Note: You must provide either `order_id` OR `client_order_id` but not both.
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"price": "90000",
"amount": "0.5",
"order_id": 123456789,
"agent_wallet": "69trU9A5...",
"expiry_window": 30000
}
```
#### Response
* Status 200: Order created successfully
```json theme={null}
{
"order_id": 123498765
}
```
* Status 400: Bad request
```json theme={null}
{
"success": false,
"error": "Order not found",
"code": 400
}
```
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"symbol": "BTC",
"price": "90000",
"amount": "0.5",
"order_id": 123456789
}
response = requests.post(
"/api/v1/orders/edit",
json=payload,
headers={"Content-Type": "application/json"}
)
data = response.json()
```
**Notes:** Editing an order cancels the original and creates a new one. The new order maintains the same side, reduce-only status, and client\_order\_id (if provided), is created with TIF = ALO (Post Only), and receives a new system-assigned order\_id.
Edit order is not subject to the taker speedbump.
# Get Open Orders
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/get-open-orders
This endpoint allows users to get open orders on their account.
```http theme={null}
GET /api/v1/orders
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Account address to filter orders | 42trU9A5... |
```http theme={null}
/api/v1/orders?account=42trU9A5...
```
#### Response
* Status 200: Successfully retrieved open orders
```json theme={null}
{
"success": true,
"data": [
{
"order_id": 315979358,
"client_order_id": "add9a4b5-c7f7-4124-b57f-86982d86d479",
"symbol": "ASTER",
"side": "ask",
"price": "1.836",
"initial_amount": "85.33",
"filled_amount": "0",
"cancelled_amount": "0",
"stop_price": null,
"order_type": "limit",
"stop_parent_order_id": null,
"reduce_only": false,
"created_at": 1759224706737,
"updated_at": 1759224706737
}
],
"error": null,
"code": null,
"last_order_id": 1557370337
}
```
| Field | Type | Description |
|---|
"order\_id" | integer | Order id assigned to order |
"client\_order\_id" | UUID | CLOID of order if assigned by user |
"symbol" | string | Trading pair symbol |
"side" | string | Whether the order is a bid or an ask |
"price" | decimal string | Price set by the order |
"initial\_amount" | decimal string | Amount (in token denomination) of the order placed |
"filled\_amount" | decimal string | Amount (in token denomination) of the order placed that has been filled |
"cancelled\_amount" | decimal string | Amount (in token denomination) of the order placed that has been cancelled |
"stop\_price" | decimal string | Stop price assigned upon order creation for subsequent position if order is filled if specified by user. |
"order\_type" | string | "limit"
"market"
"stop\_limit"
"stop\_market"
"take\_profit\_limit"
"stop\_loss\_limit"
"take\_profit\_market"
"stop\_loss\_market" |
"stop\_parent\_order\_id" | integer | Order id of stop order attached to original order |
"trigger\_price\_type" | string | Price type used to trigger stop orders (mark\_price, last\_trade\_price, mid\_price); defaults to last\_trade\_price |
"reduce\_only" | boolean | If the order is reduce only |
"instrument\_type" | string | Instrument type of the market |
"created\_at" | integer | Timestamp in milliseconds when the order was created on Pacifica |
"updated\_at" | integer | Timestamp in milliseconds when the order was last modified (by a fill) |
"last\_order\_id" | integer | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/orders?account=42trU9A5...",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Order History
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/get-order-history
This endpoint allows users to get a summarized order history.
```http theme={null}
GET /api/v1/orders/history
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Account address to filter orders | 42trU9A5... |
"limit" | integer | optional | Maximum number of records to return, default to 100 | 100 |
"cursor" | string | optional | Cursor pagination to access records. Default to none | 1115hVka |
```http theme={null}
/api/v1/orders/history?account=42trU9A5...&limit=100
```
#### Response
* Status 200: Successfully retrieved order history
```json theme={null}
{
"success": true,
"data": [
{
"order_id": 315992721,
"client_order_id": "ade",
"symbol": "XPL",
"side": "ask",
"initial_price": "1.0865",
"average_filled_price": "0",
"amount": "984",
"filled_amount": "0",
"order_status": "open",
"order_type": "limit",
"stop_price": null,
"stop_parent_order_id": null,
"reduce_only": false,
"reason": null,
"created_at": 1759224893638,
"updated_at": 1759224893638
},
...
],
"next_cursor": "1111Hyd74",
"has_more": true
}
```
| Field | Type | Description |
|---|
"order\_id" | integer | Order id assigned to order |
"client\_order\_id" | UUID | CLOID of order if assigned by user |
"symbol" | string | Trading pair symbol |
"side" | string | Whether the order is a bid or an ask |
"initial\_price" | decimal string | Initial (limit) price of the order |
"average\_filled\_price" | decimal string | VWAP of price at which the order was filled at |
"amount" | decimal string | Amount (in token denomination) of the order placed |
"filled\_amount" | decimal string | Amount (in token denomination) of the order placed that was filled |
"order\_status" | string | "open"
"partially\_filled"
"filled"
"cancelled"
"rejected" |
"order\_type" | string | "limit"
"market"
"stop\_limit"
"stop\_market"
"take\_profit\_limit"
"stop\_loss\_limit"
"take\_profit\_market"
"stop\_loss\_market" |
"stop\_price" | decimal string | Stop price assigned upon order creation for subsequent position if order is filled if specified by user. |
"stop\_parent\_order\_id" | integer | Order id of stop order attached to original order |
"reduce\_only" | boolean | If the order is reduce only |
"trigger\_price\_type" | string | Price type used to trigger stop orders (mark\_price, last\_trade\_price, mid\_price); defaults to last\_trade\_price |
"reason" | string | Provides reason for an order being "cancelled" or "rejected":
"cancel"
"force\_cancel"
"expired"
"post\_only\_rejected"
"self\_trade\_prevented" |
"instrument\_type" | string | Instrument type of the market |
"created\_at" | integer | Timestamp in milliseconds when the order was created on Pacifica |
"updated\_at" | integer | Timestamp in milliseconds when any of the order was last modified |
'next\_cursor' | string | Next cursor for pagination |
'has\_more' | boolean | True if there exists a 'next\_cursor' |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/orders/history?account=42trU9A5...&limit=100",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Order History by ID
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/orders/get-order-history-by-id
This endpoint allows users to get order history by id.
```http theme={null}
GET /api/v1/orders/history_by_id
```
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"order\_id" | integer | required | Order ID to retrieve history for | 13753364 |
```http theme={null}
/api/v1/orders/history_by_id?order_id=13753364
```
#### Response
* Status 200: Successfully retrieved open orders
```json theme={null}
{
"success": true,
"data": [
{
"history_id": 641452639,
"order_id": 315992721,
"client_order_id": "ade1aa6...",
"symbol": "XPL",
"side": "ask",
"price": "1.0865",
"initial_amount": "984",
"filled_amount": "0",
"cancelled_amount": "984",
"event_type": "cancel",
"order_type": "limit",
"order_status": "cancelled",
"stop_price": null,
"stop_parent_order_id": null,
"reduce_only": false,
"created_at": 1759224895038
},
{
"history_id": 641452513,
"order_id": 315992721,
"client_order_id": "ade1aa6...",
"symbol": "XPL",
"side": "ask",
"price": "1.0865",
"initial_amount": "984",
"filled_amount": "0",
"cancelled_amount": "0",
"event_type": "make",
"order_type": "limit",
"order_status": "open",
"stop_price": null,
"stop_parent_order_id": null,
"reduce_only": false,
"created_at": 1759224893638
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"history\_id" | integer | History ID assigned to the order |
"order\_id" | integer | Order ID assigned to order |
"client\_order\_id" | UUID | CLOID of order if assigned by user |
"symbol" | string | Trading pair symbol |
"side" | string | Whether the order is a bid or an ask |
"price" | decimal string | Execution price of the order event (e.g. order creation limit price, order matching filled price, limit price at cancellation) |
"initial\_amount" | decimal string | Amount (in token denomination) of the order placed |
"filled\_amount" | decimal string | Amount (in token denomination) of the order placed that was filled |
"cancelled\_amount" | decimal string | Amount (in token denomination) of the order placed that was cancelled |
"event\_type" | string | "make"
"stop\_created"
"twap\_created"
"fulfill\_market"
"fulfill\_limit"
"adjust"
"stop\_parent\_order\_filled"
"stop\_triggered"
"stop\_upgrade"
"twap\_triggered"
"cancel"
"force\_cancel"
"expired"
"post\_only\_rejected"
"self\_trade\_prevented"
|
"order\_type" | string | "limit"
"market"
"stop\_limit"
"stop\_market"
"take\_profit\_limit"
"stop\_loss\_limit"
"take\_profit\_market"
"stop\_loss\_market" |
"order\_status" | string | "open"
"partially\_filled"
"filled"
"cancelled"
"rejected" |
"stop\_price" | decimal string | Stop price assigned upon order creation for subsequent position if order is filled if specified by user. |
"stop\_parent\_order\_id" | integer | Order id of stop order attached to original order |
"reduce\_only" | boolean | If the order is reduce only |
"trigger\_price\_type" | string | Price type used to trigger stop orders (mark\_price, last\_trade\_price, mid\_price); defaults to last\_trade\_price |
"instrument\_type" | string | Instrument type of the market |
"created\_at" | integer | Timestamp in milliseconds when the order was created on Pacifica |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/orders/history_by_id?order_id=13753364",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Spot
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/spot
Endpoints for querying spot asset information and bridge parameters.
# Get Bridge Info
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/spot/get-bridge-info
This endpoint returns bridge parameters for all spot assets, including deposit minimums, withdrawal fees, and on-chain program addresses.
```http theme={null}
GET /api/v1/spot_assets/bridge/info
```
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "SOL",
"minimum_deposit": "0.01",
"withdrawal_fee": "0.001",
"bridge_program": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
"mint": null,
"decimals": 9
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"symbol" | string | Spot asset symbol |
"minimum\_deposit" | decimal string | Minimum deposit amount |
"withdrawal\_fee" | decimal string | Fee charged on withdrawals |
"bridge\_program" | string | Solana program address for the bridge |
"mint" | string or null | Token mint address (null for native SOL) |
"decimals" | integer | Token decimal precision |
Response is cached for 1 minute.
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/spot_assets/bridge/info",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Bridge Parameters
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/spot/get-bridge-parameters
This endpoint returns bridge parameters for a single spot asset by symbol, including deposit minimums, withdrawal fees, and on-chain program addresses.
```http theme={null}
GET /api/v1/spot_assets/bridge/parameters/{symbol}
```
#### Path Parameters
| Parameter | Type | Required | Description |
|---|
symbol | string | Yes | The spot asset symbol (e.g. SOL) |
Example: `/api/v1/spot_assets/bridge/parameters/SOL`
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": {
"symbol": "SOL",
"minimum_deposit": "0.01",
"withdrawal_fee": "0.001",
"bridge_program": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
"mint": null,
"decimals": 9
},
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"symbol" | string | Spot asset symbol |
"minimum\_deposit" | decimal string | Minimum deposit amount |
"withdrawal\_fee" | decimal string | Fee charged on withdrawals |
"bridge\_program" | string | Solana program address for the bridge |
"mint" | string or null | Token mint address (null for native SOL) |
"decimals" | integer | Token decimal precision |
* Status 404: Asset not found or no active bridge for the symbol.
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
symbol = "SOL"
response = requests.get(
f"/api/v1/spot_assets/bridge/parameters/{symbol}",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Get Spot Assets
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/spot/get-spot-assets
This endpoint returns a list of all spot assets available on the exchange, including their trading parameters and collateral eligibility.
```http theme={null}
GET /api/v1/spot_assets
```
#### Query Parameters
| Parameter | Type | Required | Description |
|---|
"include\_inactive" | boolean | No | Include inactive spot assets. Defaults to false. |
"collateral\_enabled\_only" | boolean | No | Only return assets enabled as collateral. Defaults to false. |
#### Response
* Status 200: Success
```json theme={null}
{
"success": true,
"data": [
{
"symbol": "SOL",
"tick_size": "0.01",
"lot_size": "0.01",
"active": true,
"collateral_enabled": true,
"ltv_ratio": "0.80",
"created_at": 1716200000000,
"updated_at": 1716200000000
}
],
"error": null,
"code": null
}
```
| Field | Type | Description |
|---|
"symbol" | string | Spot asset symbol |
"tick\_size" | decimal string | Minimum price increment |
"lot\_size" | decimal string | Minimum quantity increment |
"active" | boolean | Whether the asset is currently active for trading |
"collateral\_enabled" | boolean | Whether the asset can be used as unified margin collateral |
"ltv\_ratio" | decimal string | Loan-to-value ratio when used as collateral (e.g. "0.80" = 80%) |
"created\_at" | integer | Timestamp in milliseconds |
"updated\_at" | integer | Timestamp in milliseconds |
Results are sorted alphabetically by symbol.
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
response = requests.get(
"/api/v1/spot_assets",
headers={"Accept": "*/*"},
)
data = response.json()
```
# Subaccounts
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/subaccounts
* [Create subaccount](/api-documentation/api/rest-api/subaccounts/create-subaccount): This endpoint allows regular accounts to create subaccounts with a secure authentication scheme. Both the main account and subaccount must sign to establish the relationship.
* [List subaccounts](/api-documentation/api/rest-api/subaccounts/list-subaccounts): Lists all subaccounts associated with a main (parent) account. Returns address, balance, and other account details for each subaccount.
* [Subaccount fund transfer](/api-documentation/api/rest-api/subaccounts/subaccount-fund-transfer): This endpoint allows transfer of funds between main and subaccounts
* [Subaccount spot transfer](/api-documentation/api/rest-api/subaccounts/subaccount-spot-transfer): This endpoint allows users to transfer spot assets between a main account and its subaccounts
# Create Subaccount
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/subaccounts/create-subaccount
This endpoint allows regular accounts to create subaccounts with a secure authentication scheme. Both the main account and subaccount must sign to establish the relationship.
The subaccount creation process follows the below steps.
1. The main account must authorize the creation of a subaccount under its control
2. The subaccount must consent to being controlled by the main account
3. The API server must verify both signatures to prevent unauthorized subaccount creation
Valid addresses must be used in order to establish main/subaccount relationships via API:
* Neither account can be a subaccount of another account.
* The subaccount address cannot have any deposit/trade history
Please refer to the [Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/create_subaccount.py) for a comprehensive guide on subaccount creation via API
```http theme={null}
POST /api/v1/account/subaccount/create
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"main\_account" | string | required | Main account wallet address | 42trU9A5... |
"subaccount" | string | required | Subaccount wallet address | 69trU9A5... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"main\_signature" | string | required | Main account signature | 5j1Vy9Uq... |
"sub\_signature" | string | required | Subaccount signature | 4k2Wx8Zq... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"main_account": "42trU9A5...",
"subaccount": "69trU9A5...",
"main_signature": "5j1Vy9Uq...",
"sub_signature": "4k2Wx8Zq...",
"timestamp": 1716200000000,
"expiry_window": 30000
}
```
#### Response
* Status 200: Subaccount created successfully
```json theme={null}
{
"success": true,
"data": null,
"error": null,
"code": null,
}
```
* Status 400: Bad request
```json theme={null}
{
"success": false,
"data": null,
"error": "Account already exists: CRTxBM...",
"code": 2
}
```
* Status 500: Internal server error
# List Subaccounts
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/subaccounts/list-subaccounts
Lists all subaccounts associated with a main (parent) account. Returns address, balance, and other account details for each subaccount.
```http theme={null}
POST /api/v1/account/subaccount/list
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Main account wallet address | 42trU9A5... |
"signature" | string | required | Main account signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42txU9As...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"expiry_window": 30000
}
```
#### Response
* Status 200: Subaccounts listed successfully
```json theme={null}
{
"success": true,
"data": {
"subaccounts": [
{
"address": "69txU9As...",
"balance": "1000.50",
"pending_balance": "0.00",
"fee_level": 1,
"fee_mode": "auto",
"created_at": 1716200000000,
"nickname": "Trading Bot"
}
]
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| ------------------- | -------------- | ------------------------------------------------------------------------------------------------------- |
| `'address'` | string | Current account balance, defined as amount of USD in account before settlement |
| `'balance'` | decimal string | Subaccount balance in USD |
| `'pending_balance'` | decimal string | Amount of subaccount balance in pending status (deposit request is successful, waiting on confirmation) |
| `'fee_level'` | integer | Current fee tier of account, determined by trading volume |
| `'fee_mode'` | string | `"auto"` by default |
| `'created_at'` | integer | Creation timestamp in milliseconds |
| `'nickname'` | string or null | Optional subaccount nickname (omitted when not set) |
* Status 400: Bad request
```json theme={null}
{
"success": false,
"data": null,
"error": "Invalid signature format",
"code": null
}
```
* Status 401: Unauthorized
```json theme={null}
{
"success": false,
"data": null,
"error": "Signature verification failed",
"code": null
}
```
# Subaccount Fund Transfer
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/subaccounts/subaccount-fund-transfer
This endpoint allows transfer of funds between main and subaccounts
Please refer to the [Python SDK](https://github.com/pacifica-fi/python-sdk/blob/main/rest/transfer_subaccount_fund.py) for a comprehensive guide on subaccount fund transfer via API
```http theme={null}
POST /api/v1/account/subaccount/transfer
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Sender account address | 42trU9A5... |
"signature" | string | required | Sender account signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"to\_account" | string | required | Recipient wallet address | 69trU9A5... |
"amount" | decimal string | required | Transfer amount (in USDC) | 420.69 |
"idempotency\_key" | string | optional | Full UUID. Prevents duplicate transfers | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
```json theme={null}
{
"account": "AwX6321...",
"signature": "65L9qPp...",
"timestamp": 1749228826313,
"expiry_window": 5000,
"to_account": "CRTxBM...",
"amount": "420.69"
}
```
#### Response
* Status 200: Transfer completed successfully
```json theme={null}
Status Code: 200
{
"success": true,
"data": {
"success": true,
"error": null
},
"error": null,
"code": null
}
```
* Status 400: Bad request
```json theme={null}
Status Code: 400
{
"success": false,
"data": null,
"error": "Insufficient balance for AwX6321: 420.69 (account value: 336.9100000000000000000000)",
"code": 5
}
```
* Status 500: Internal server error
# Subaccount Spot Transfer
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/subaccounts/subaccount-spot-transfer
This endpoint allows users to transfer spot assets between a main account and its subaccounts
Please refer to the [Python SDK](https://github.com/pacifica-fi/python-sdk) for a comprehensive guide on subaccount spot transfer via API
```http theme={null}
POST /api/v1/account/subaccount/spot_asset/transfer
```
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | User's wallet address (sender) | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"to\_account" | string | required | Destination account address | 69trU9A5... |
"symbol" | string | required | Spot asset symbol (e.g. SOL) | SOL |
"amount" | decimal string | required | Amount to transfer | 1.50000000 |
"idempotency\_key" | string | optional | Full UUID. Prevents duplicate transfers | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
The signature must be generated using the operation type `"transfer_spot_asset"`.
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"to_account": "69trU9A5...",
"symbol": "SOL",
"amount": "1.50000000",
"idempotency_key": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"agent_wallet": "69trU9A5...",
"expiry_window": 30000
}
```
The destination account must be a subaccount of the sender, or the sender must be a subaccount transferring to its parent.
#### Response
* Status 200: Transfer completed successfully
```json theme={null}
Status Code: 200
{
"success": true,
"data": {
"success": true,
"error": null
},
"error": null,
"code": null
}
```
* Status 409: Duplicate idempotency key
* Status 500: Internal server error
#### Code Example (Python)
```python theme={null}
import requests
payload = {
"account": "42trU9A5...",
"signature": "5j1Vy9Uq...",
"timestamp": 1716200000000,
"to_account": "69trU9A5...",
"symbol": "SOL",
"amount": "1.50000000",
"idempotency_key": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"agent_wallet": "69trU9A5...",
"expiry_window": 30000,
}
response = requests.post(
"/api/v1/account/subaccount/spot_asset/transfer",
headers={"Accept": "*/*", "Content-Type": "application/json"},
json=payload,
)
data = response.json()
```
# Vaults
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults
REST API endpoints for creating, funding, configuring, and listing vaults.
Pacifica's user-facing docs call these managed pools **vaults**, while the REST API namespace currently uses `/api/v1/lake/*`.
## Endpoints
* [Create vault](/api-documentation/api/rest-api/vaults/create-vault)
* [Claim vault referral code](/api-documentation/api/rest-api/vaults/claim-vault-referral-code)
* [Deposit to vault](/api-documentation/api/rest-api/vaults/deposit-to-vault)
* [Claim vault manager](/api-documentation/api/rest-api/vaults/claim-vault-manager)
* [Withdraw from vault](/api-documentation/api/rest-api/vaults/withdraw-from-vault)
* [Update vault deposit cap](/api-documentation/api/rest-api/vaults/update-vault-deposit-cap)
* [Add vault whitelist](/api-documentation/api/rest-api/vaults/add-vault-whitelist)
* [Remove vault whitelist](/api-documentation/api/rest-api/vaults/remove-vault-whitelist)
* [Add vault blacklist](/api-documentation/api/rest-api/vaults/add-vault-blacklist)
* [Remove vault blacklist](/api-documentation/api/rest-api/vaults/remove-vault-blacklist)
* [Add vault max leverage](/api-documentation/api/rest-api/vaults/add-vault-max-leverage)
* [Remove vault max leverage](/api-documentation/api/rest-api/vaults/remove-vault-max-leverage)
* [List vaults](/api-documentation/api/rest-api/vaults/list-vaults)
# Add Vault Blacklist
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/add-vault-blacklist
Add blocked symbols to a vault blacklist.
```http theme={null}
POST /api/v1/lake/add_blacklist
```
The operation type for signing is `"add_lake_blacklist"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols to add to the blacklist | \["BTC", "ETH"] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"]
}
```
#### Response
* Status 200: Blacklist updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Add Vault Max Leverage
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/add-vault-max-leverage
Add per-symbol max leverage limits for a vault.
```http theme={null}
POST /api/v1/lake/add_max_leverage
```
The operation type for signing is `"add_lake_max_leverage"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols that should receive the same max leverage cap | \["BTC", "ETH"] |
"max\_leverage" | decimal string | required | Maximum leverage to apply to every listed symbol | 10 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"],
"max_leverage": "10"
}
```
#### Response
* Status 200: Max leverage updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Add Vault Whitelist
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/add-vault-whitelist
Add tradable symbols to a vault whitelist.
```http theme={null}
POST /api/v1/lake/add_whitelist
```
The operation type for signing is `"add_lake_whitelist"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols to add to the whitelist | \["BTC", "ETH"] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"]
}
```
#### Response
* Status 200: Whitelist updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Claim Vault Manager
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/claim-vault-manager
Claim the manager role on a fresh vault.
```http theme={null}
POST /api/v1/lake/claim_manager
```
The operation type for signing is `"claim_lake_manager"`.
This endpoint is only for fresh vaults that were created without a manager.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Claimer wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"deposit\_amount" | decimal string | required | Manager's initial deposit amount | 1000.00 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"deposit_amount": "1000.00"
}
```
#### Response
* Status 200: Manager claim successful
```json theme={null}
{
"success": true,
"data": {
"shares_minted": "1000.00"
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| ----------------- | -------------- | ---------------------------------------------- |
| `'shares_minted'` | decimal string | Number of manager shares minted to the claimer |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
# Claim Vault Referral Code
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/claim-vault-referral-code
Claim a referral code for an existing vault.
```http theme={null}
POST /api/v1/lake/claim_referral_code
```
The operation type for signing is `"claim_lake_referral"`.
Only the vault creator can claim a referral code for an existing vault.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"code" | string | required | Referral code to claim | testcode |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"code": "testcode"
}
```
#### Response
* Status 200: Referral code claimed successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters or caller is not the vault creator
* Status 401: Unauthorized access
* Status 500: Internal server error
# Create Vault
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/create-vault
Create a new vault (lake) and optionally set its initial configuration and seed deposit.
```http theme={null}
POST /api/v1/lake/create
```
The operation type for signing is `"create_lake"`.
This endpoint creates a new vault and returns its generated account address. The API path uses `lake`, but this feature is referred to as `vaults` in user-facing docs.
`manager_loss_share` is currently disabled; omit it or pass `"0"`.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Signature over the sorted request payload | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"manager" | string | optional | Manager address. Omit to create a fresh vault with no manager. | 8zFqj1Kp... |
"nickname" | string | optional | Display name for the vault | BTC Basis Vault |
"deposit\_cap" | decimal string | optional | Maximum LP balance accepted by the vault | 1000000 |
"manager\_profit\_share" | decimal string | optional | Performance fee fraction in \[0,1] | 0.20 |
"manager\_loss\_share" | decimal string | optional | Temporarily disabled; only "0" is accepted | 0 |
"deposit\_min\_duration\_ms" | integer | optional | Minimum deposit lock duration in milliseconds | 86400000 |
"manager\_min\_balance\_portion" | decimal string | optional | Manager balance ratio required to claim or re-enable the vault | 0.10 |
"manager\_liquidation\_balance\_portion" | decimal string | optional | Manager balance ratio that triggers trading halt and liquidation | 0.05 |
"initial\_deposit" | decimal string | optional | Seed deposit from the creator in the same request | 1000.00 |
"withdraw\_window\_s" | integer | optional | Withdrawal cycle period in seconds | 2592000 |
"withdraw\_duration\_s" | integer | optional | Open withdrawal time per cycle in seconds | 259200 |
"referral\_code" | string | optional | Referral code to claim for the new vault | testcode |
"initial\_deposit\_address\_whitelist" | string array or null | optional | Initial deposit-address whitelist. Empty or omitted = no restriction (anyone can deposit). | \["42trU9A5..."] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"nickname": "BTC Basis Vault",
"manager_profit_share": "0.20",
"deposit_cap": "1000000",
"deposit_min_duration_ms": 86400000,
"manager_min_balance_portion": "0.10",
"manager_liquidation_balance_portion": "0.05",
"initial_deposit": "1000.00",
"withdraw_window_s": 2592000,
"withdraw_duration_s": 259200,
"referral_code": "testcode",
"expiry_window": 30000
}
```
#### Response
* Status 200: Vault created successfully
```json theme={null}
{
"success": true,
"data": {
"lake_address": "AbCdEfGh123456789...",
"referral_claimed": true
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| -------------------- | ------- | ----------------------------------------------------------- |
| `'lake_address'` | string | Generated vault account address |
| `'referral_claimed'` | boolean | Whether the optional referral code was claimed successfully |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error
# Deposit to Vault
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/deposit-to-vault
Deposit funds into a vault and receive vault shares.
```http theme={null}
POST /api/v1/lake/deposit
```
The operation type for signing is `"deposit_to_lake"`.
Use this endpoint to deposit USDC from an account into a vault. Deposits are idempotent when an `idempotency_key` is supplied.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Depositor wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"amount" | decimal string | required | Deposit amount in USDC | 1000.00 |
"idempotency\_key" | UUID string | optional | Client-generated key to prevent duplicate deposits | 550e8400-e29b-41d4-a716-446655440000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"amount": "1000.00",
"idempotency_key": "550e8400-e29b-41d4-a716-446655440000"
}
```
#### Response
* Status 200: Deposit successful
```json theme={null}
{
"success": true,
"data": {
"shares_minted": "1000.00"
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| ----------------- | -------------- | ---------------------------------------------- |
| `'shares_minted'` | decimal string | Number of vault shares minted to the depositor |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 409: Duplicate idempotency key
* Status 500: Internal server error
# List Vaults
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/list-vaults
List all vaults and optionally include the querying account's share balance.
```http theme={null}
GET /api/v1/lake/list
```
Returns all vaults ordered by creation time descending. If `account` is provided, the response also includes that account's share balance in each vault as `user_share`.
#### Query Parameters
| Field | Type | Need | Description | Example |
|---|
"account" | string | optional | Account address whose share balance should be included | 42trU9A5... |
```http theme={null}
/api/v1/lake/list?account=42trU9A5...
```
#### Response
* Status 200: List of vaults
```json theme={null}
{
"success": true,
"data": {
"lakes": [
{
"address": "AbCdEfGh123456789...",
"creator": "42trU9A5...",
"manager": "8zFqj1Kp...",
"nickname": "BTC Basis Vault",
"lp_shares": "900000.00",
"manager_shares": "100000.00",
"lp_balance": "910000.00",
"manager_balance": "115000.00",
"last_checked_equity": "1025000.00",
"high_watermark": "1025000.00",
"created_at": 1700000000000,
"referrer": "7xyReferrer...",
"user_share": "500.00",
"config": {
"deposit_cap": "1000000.00",
"manager_profit_share": "0.20",
"manager_loss_share": "0",
"deposit_min_duration_ms": 86400000,
"manager_min_balance_portion": "0.10",
"manager_liquidation_balance_portion": "0.05",
"withdraw_window_s": 2592000,
"withdraw_duration_s": 259200
}
}
]
},
"error": null,
"code": null
}
```
**Lake fields**
| Field | Type | Description |
| ----------------------- | ---------------------- | ----------------------------------------------------------------- |
| `'address'` | string | Vault account address |
| `'creator'` | string | Creator address |
| `'manager'` | string or null | Current manager address |
| `'nickname'` | string or null | Optional vault nickname |
| `'lp_shares'` | decimal string | Total LP shares outstanding |
| `'manager_shares'` | decimal string | Total manager shares outstanding |
| `'lp_balance'` | decimal string | Balance attributed to LP shares |
| `'manager_balance'` | decimal string | Balance attributed to manager shares |
| `'last_checked_equity'` | decimal string | Most recent equity snapshot used for vault accounting |
| `'high_watermark'` | decimal string | High-water mark for performance fee accounting |
| `'created_at'` | integer | Vault creation timestamp in milliseconds |
| `'referrer'` | string or null | Referrer address if a referral code was claimed |
| `'user_share'` | decimal string or null | Share balance for the queried account, when `account` is provided |
| `'config'` | object or null | Vault configuration, when present |
**Config fields**
| Field | Type | Description |
| --------------------------------------- | ---------------------- | ---------------------------------- |
| `'deposit_cap'` | decimal string or null | LP deposit cap |
| `'manager_profit_share'` | decimal string or null | Performance fee fraction |
| `'manager_loss_share'` | decimal string or null | Manager loss share setting |
| `'deposit_min_duration_ms'` | integer or null | Minimum deposit duration |
| `'manager_min_balance_portion'` | decimal string or null | Required manager balance ratio |
| `'manager_liquidation_balance_portion'` | decimal string or null | Halt/liquidation trigger ratio |
| `'withdraw_window_s'` | integer or null | Withdrawal cycle period |
| `'withdraw_duration_s'` | integer or null | Open withdrawal duration per cycle |
* Status 500: Internal server error
# Remove Vault Blacklist
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/remove-vault-blacklist
Remove blocked symbols from a vault blacklist.
```http theme={null}
POST /api/v1/lake/remove_blacklist
```
The operation type for signing is `"remove_lake_blacklist"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols to remove from the blacklist | \["BTC", "ETH"] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"]
}
```
#### Response
* Status 200: Blacklist updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Remove Vault Max Leverage
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/remove-vault-max-leverage
Remove per-symbol max leverage limits from a vault.
```http theme={null}
POST /api/v1/lake/remove_max_leverage
```
The operation type for signing is `"remove_lake_max_leverage"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols whose custom max leverage should be removed | \["BTC", "ETH"] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"]
}
```
#### Response
* Status 200: Max leverage removed successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Remove Vault Whitelist
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/remove-vault-whitelist
Remove tradable symbols from a vault whitelist.
```http theme={null}
POST /api/v1/lake/remove_whitelist
```
The operation type for signing is `"remove_lake_whitelist"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"symbols" | string array | required | Symbols to remove from the whitelist | \["BTC", "ETH"] |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"symbols": ["BTC", "ETH"]
}
```
#### Response
* Status 200: Whitelist updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Update Vault Deposit Cap
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/update-vault-deposit-cap
Update or clear the deposit cap for a vault.
```http theme={null}
POST /api/v1/lake/update_deposit_cap
```
The operation type for signing is `"update_lake_deposit_cap"`.
Only the vault creator can call this endpoint.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Creator wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"deposit\_cap" | decimal string or null | optional | New LP deposit cap. Set to null to remove the cap. | 2000000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"deposit_cap": "2000000"
}
```
#### Response
* Status 200: Deposit cap updated successfully
```json theme={null}
{
"success": true,
"data": {
"success": true
},
"error": null,
"code": null
}
```
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 403: Caller is not the vault creator
* Status 500: Internal server error
# Withdraw From Vault
Source: https://docs.pacifica.fi/api-documentation/api/rest-api/vaults/withdraw-from-vault
Redeem vault shares and withdraw funds from a vault.
```http theme={null}
POST /api/v1/lake/withdraw
```
The operation type for signing is `"withdraw_from_lake"`.
Use this endpoint to redeem shares from a vault. Withdrawals are idempotent when an `idempotency_key` is supplied.
#### Request Body
| Field | Type | Need | Description | Example |
|---|
"account" | string | required | Depositor wallet address | 42trU9A5... |
"signature" | string | required | Cryptographic signature | 5J3mBbAH... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"lake" | string | required | Vault address | AbCdEfGh123456789... |
"shares" | decimal string | required | Number of shares to redeem | 50.00 |
"idempotency\_key" | UUID string | optional | Client-generated key to prevent duplicate withdrawals | 550e8400-e29b-41d4-a716-446655440000 |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
```json theme={null}
{
"account": "42trU9A5...",
"signature": "5J3mBbAH...",
"timestamp": 1716200000000,
"lake": "AbCdEfGh123456789...",
"shares": "50.00",
"idempotency_key": "550e8400-e29b-41d4-a716-446655440000"
}
```
#### Response
* Status 200: Withdrawal successful
```json theme={null}
{
"success": true,
"data": {
"amount_withdrawn": "500.00"
},
"error": null,
"code": null
}
```
| Field | Type | Description |
| -------------------- | -------------- | ------------------------------ |
| `'amount_withdrawn'` | decimal string | USDC returned to the depositor |
* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 409: Duplicate idempotency key
* Status 500: Internal server error
# Signing
Source: https://docs.pacifica.fi/api-documentation/api/signing
Pacifica uses deterministic JSON formatting to generate Ed25519 signatures for API authentication.
All POST requests require signing, whereas GET and websocket subscriptions do not.\
\
We *strongly* recommend following the [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk) to generate signatures and submit trading requests. The following example explains the key steps in constructing valid signatures.
# API Agent Keys
Source: https://docs.pacifica.fi/api-documentation/api/signing/api-agent-keys
The signature verification process in both REST API and Websocket allows user generated API Agent Keys (also called "Agent Wallets") to sign on behalf of the original account. This is similar to the API Keys used for most leading exchanges. This way, API users can trade programmably without exposing the private key of the original wallet to the trading program.
### Generate API Agent Keys
Agent wallets can be generated on the [frontend](https://app.pacifica.fi/apikey), or using this [Python SDK example](https://github.com/pacifica-fi/python-sdk/blob/main/rest/api_agent_keys.py#L31-L79).
### Use API Agent Keys
For all POST requests, follow these steps in request construction
* Still use the original wallet's public key for `account`,
* Use API Agent Private Key to sign the message payload to generate `signature`, and
* Add `agent_wallet: [AGENT_WALLET_PUBLIC_KEY]` to the request header.
As an example, this [Python SDK program](https://github.com/pacifica-fi/python-sdk/blob/main/rest/api_agent_keys.py#L81-L135) uses API Agent Key to place a market order.
# Error Handling
Source: https://docs.pacifica.fi/api-documentation/api/signing/error-handling
An invalid signed message can result in a variety of Status 400 errors. The following illustrate error messages and common causes.
| Error Message | Potential Causes |
|---|
"Invalid signature" | - Invalid signature format (not valid base58)
- Signature bytes don't form a valid Ed25519 signature
- Malformed signature data
|
"Invalid message" | - Message has expired (timestamp + expiry\_window \< current time)
- Message cannot be serialized to JSON
- Message structure is malformed
|
"Invalid public key" | - Account address doesn't represent a valid Ed25519 public key
- Public key bytes are malformed
|
"Verification failed" | - Signature doesn't match the message content
- Wrong private key was used to sign
- Message content was modified after signing
|
While we have provided several different error message types in order to aid debugging, an incorrectly generated signed message is still relatively ambiguous when it comes to troubleshooting the root cause of the issue, making debugging more challenging.\
\
As such, the following guide and/or the [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk), when followed closely, should make signing relatively straightforward to implement.
# Hardware Wallet
Source: https://docs.pacifica.fi/api-documentation/api/signing/hardware-wallet
Pacifica supports hardware wallet signature authentication via Ed25519 [off-chain message signing](https://github.com/solana-labs/solana/blob/master/docs/src/proposals/off-chain-message-signing.md). To use hardware wallet, after constructing the [message bytes](/api-documentation/api/signing/implementation#7-convert-to-bytes-and-generate-signature), prepend it with the `\xffsolana offchain` header together with message length, version information, etc.
Then, in the [signature to send](/api-documentation/api/signing/implementation#8-build-final-request), use `hardware` as the `type` :
```
...
"signature": {
"type": "hardware",
"value": "2V4Y7Mpk...",
},
...
```
For more details, refer to [this example](https://github.com/pacifica-fi/python-sdk/blob/2b5e629eb15d86c1a229df5d1847f5000f113ec9/rest/transfer_subaccount_fund_hardware.py#L27-L47) in the Python SDK.
# Implementation
Source: https://docs.pacifica.fi/api-documentation/api/signing/implementation
The following guide provides a step-by-step breakdown of Pacifica's signing implementation
### 1. Setup and Initialization
```python theme={null}
import time
import base58
import requests
from solders.keypair import Keypair
PRIVATE_KEY = "your_private_key_here"
# Generate keypair from private key
keypair = Keypair.from_bytes(base58.b58decode(PRIVATE_KEY))
public_key = str(keypair.pubkey())
```
### 2. Choose Endpoint and Define Operation Type
For this example, we use the order creation endpoint. Refer to [Operation Types](/api-documentation/api/signing/operation-types) for a list of all types and corresponding API endpoints.
```python theme={null}
API_URL = "https://api.pacifica.fi/api/v1/orders/create"
operation_type = "create_order"
operation_data = {
"symbol": "BTC",
"price": "100000",
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"reduce_only": False,
"client_order_id": str(uuid.uuid4()),
}
```
### 3. Create Signature Header
Note that all times specified are denoted in milliseconds.\
\
The `"expiry_window"` field is optional, and defaults to 30\_000 (30 seconds) if not specified in the header.
```python theme={null}
# Get current timestamp in milliseconds
timestamp = int(time.time() * 1_000)
signature_header = {
"timestamp": timestamp,
"expiry_window": 5_000,
"type": "create_order",
}
```
### 4. Combine Header and Payload
```python theme={null}
data_to_sign = {
**signature_header,
"data": operation_data,
}
```
In the case of our example, this creates:
```python theme={null}
{
"timestamp": 1748970123456,
"expiry_window": 5000,
"type": "create_order",
"data": {
"symbol": "BTC",
"price": "100000",
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"reduce_only": False,
"client_order_id": "12345678-1234-1234-1234-123456789abc"
}
}
```
Note that data must be in same level as other headers.
### 5. Recursively Sort JSON Keys
```python theme={null}
def sort_json_keys(value):
if isinstance(value, dict):
sorted_dict = {}
for key in sorted(value.keys()):
sorted_dict[key] = sort_json_keys(value[key])
return sorted_dict
elif isinstance(value, list):
return [sort_json_keys(item) for item in value]
else:
return value
sorted_message = sort_json_keys(data_to_sign)
```
In the case of our example, this creates:
```python theme={null}
{
"data": {
"amount": "0.1",
"client_order_id": "12345678-1234-1234-1234-123456789abc",
"price": "100000",
"reduce_only": false,
"side": "bid",
"symbol": "BTC",
"tif": "GTC"
},
"expiry_window": 5000,
"timestamp": 1748970123456,
"type": "create_order"
}
```
Note that the recursive sorting alphabetically sorts \*all\* levels
### 6. Create Compact JSON
Compact JSON string with no whitespace and standardized separators
```python theme={null}
import json
compact_json = json.dumps(sorted_message, separators=(",", ":"))
```
In the case of our example, this creates:
```
{"data":{"amount":"0.1","client_order_id":"12345678-1234-1234-1234-123456789abc","price":"100000","reduce_only":false,"side":"bid","symbol":"BTC","tif":"GTC"},"expiry_window":5000,"timestamp":1748970123456,"type":"create_order"}
```
This ensures that all logically identical messages will always produce \*identical\* signatures
### 7. Convert to Bytes and Generate Signature
Messages are converted to UTF-8 bytes for signing. The signature generated is then converted to Base58 string for transmission.
```python theme={null}
# Convert to UTF-8 bytes
message_bytes = compact_json.encode("utf-8")
# Sign message bytes using your private key
signature = keypair.sign_message(message_bytes)
# Convert signature to Base58 string
signature_b58 = base58.b58encode(bytes(signature)).decode("ascii")
# Expect an output similar to:
# "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ5xHQFMJkZWE8J5VyA"
```
### 8. Build Final Request
Build the header with generated authentication info and combine with operation data (NOT the "data" wrapper!)
```python theme={null}
request_header = {
"account": public_key,
"agent_wallet": None,
"signature": signature_b58,
"timestamp": signature_header["timestamp"],
"expiry_window": signature_header["expiry_window"],
}
final_request = {
**request_header,
**operation_data, # Use the ORIGINAL create order fields
}
```
In the case of our example, the final request looks like:
```python theme={null}
{
"account": "6ETnufiec2CxVWTS4u5Wiq33Zh5Y3Qm6Pkdpi375fuxP",
"agent_wallet": null,
"signature": "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ",
"timestamp": 1748970123456,
"expiry_window": 5000,
"symbol": "BTC",
"price": "100000",
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"reduce_only": false,
"client_order_id": "12345678-1234-1234-1234-123456789abc"
}
```
# Operation Types
Source: https://docs.pacifica.fi/api-documentation/api/signing/operation-types
The following table provides the "type"s required by the signature header and their corresponding API endpoints
| Operation Type | API Endpoint |
| ---------------------------- | ------------------------------------- |
| `"create_order"` | `/api/v1/orders/create` |
| `"create_stop_order"` | `/api/v1/orders/stop/create` |
| `"cancel_order"` | `/api/v1/orders/cancel` |
| `"cancel_all_orders"` | `/api/v1/orders/cancel_all` |
| `"cancel_stop_order"` | `/api/v1/orders/stop/cancel` |
| `"update_leverage"` | `/api/v1/account/leverage` |
| `"update_margin_mode"` | `/api/v1/account/margin` |
| `"set_position_tpsl"` | `/api/v1/positions/tpsl` |
| `"withdraw"` | `/api/v1/account/withdraw` |
| `"subaccount_initiate"` | `/api/v1/account/subaccount/create` |
| `"subaccount_confirm"` | `/api/v1/account/subaccount/create` |
| `"create_market_order"` | `/api/v1/orders/create_market` |
| `"transfer_funds"` | `/api/v1/account/subaccount/transfer` |
| `"bind_agent_wallet"` | `/api/v1/agent/bind` |
| `"create_api_key"` | `/api/v1/account/api_keys/create` |
| `"revoke_api_key"` | `/api/v1/account/api_keys/revoke` |
| `"list_api_keys"` | `/api/v1/account/api_keys` |
| `"create_lake"` | `/api/v1/lake/create` |
| `"claim_lake_referral"` | `/api/v1/lake/claim_referral_code` |
| `"deposit_to_lake"` | `/api/v1/lake/deposit` |
| `"claim_lake_manager"` | `/api/v1/lake/claim_manager` |
| `"withdraw_from_lake"` | `/api/v1/lake/withdraw` |
| `"update_lake_deposit_cap"` | `/api/v1/lake/update_deposit_cap` |
| `"add_lake_whitelist"` | `/api/v1/lake/add_whitelist` |
| `"remove_lake_whitelist"` | `/api/v1/lake/remove_whitelist` |
| `"add_lake_blacklist"` | `/api/v1/lake/add_blacklist` |
| `"remove_lake_blacklist"` | `/api/v1/lake/remove_blacklist` |
| `"add_lake_max_leverage"` | `/api/v1/lake/add_max_leverage` |
| `"remove_lake_max_leverage"` | `/api/v1/lake/remove_max_leverage` |
Note: Pacifica's batch order endpoint does NOT have a corresponding operation type as all individual operations within the batch are signed independently with their own operation types.
# Tick and Lot Size
Source: https://docs.pacifica.fi/api-documentation/api/tick-and-lot-size
The following doc describes how tick and lot size, as well as rounding, are handled at an API level when Pacifica's endpoints receive requests with price and amount fields.
Both `'price'` and `'amount'` fields in order related API operations are subject to rounding, needing to be multiples of tick and lot size.\
\
Generally `tick_size` is determined by the rightmost decimal place of a symbol's current price, and prices generally have five significant figures, with the exception of assets with more than six integer places, where sig.figs = #of integer places.\
\
For example:\
\
If `'price' = 123.45`, expect `'tick_size' = 0.01`\
If `'price' = 123456`, expect `'tick_size' = 1`\
\
Generally, `lot_size*tick_size = 0.0001 or 0.00001`, based on the market.\
\
For the exact implemented `tick_size` and `lot_size` of each market, call the [market info](/api-documentation/api/rest-api/markets/get-market-info) endpoint to verify.
## Rounding
Pacifica accepts requests containing `'price'` and `'amount'` fields only when they are multiples of `tick_size` and `lot_size` respectively. Any requests with incorrectly rounded `'price'` and `'amount'` fields will return `'"Bad Request","code":400'`
For example:\
\
BTC has `"tick_size": "1"`, `"lot_size": "0.00001"`\
\
A request where `"amount": "0.000005"` will return `Status 400: Bad Request`\
A request where `"price": "100_000.5"` will return `Status 400: Bad Request`
A request where `"amount": "0.00002"` will be accepted\
A request where `"price": "100_001"` will be accepted
# Websocket
Source: https://docs.pacifica.fi/api-documentation/api/websocket
Mainnet websocket URL: [wss://ws.pacifica.fi/ws](wss://ws.pacifica.fi/ws)\
Testnet websocket URL: [wss://test-ws.pacifica.fi/ws](wss://test-ws.pacifica.fi/ws)
The API service provides a universal endpoint for websocket streams. The subscribed data will be streamed in the corresponding channel after the connection is established.
### Subscription Message
```
{
"method": "subscribe",
"params": { ... }
}
```
### Unsubscription Message
```
{
"method": "unsubscribe",
"params": { ... }
}
```
### Heartbeat and Timeout
A websocket connection will be closed if no message is sent for the past 60 seconds, or the connection has been alive for 24 hours.
To keep the connection alive without messages in 60 seconds, we can send a heartbeat message
```
{
"method": "ping"
}
```
and an alive connection will respond with
```
{
"channel": "pong"
}
```
# Subscriptions
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions
* [Prices](/api-documentation/api/websocket/subscriptions/prices): Streams all symbols' price information on Pacifica as they update
* [Orderbook](/api-documentation/api/websocket/subscriptions/orderbook): Streams book data for given symbol at a set aggregation level as they update
* [Best bid offer (BBO)](/api-documentation/api/websocket/subscriptions/best-bid-offer-bbo): Real-time updates of the best bid and ask prices and amounts for a specific symbol. Updates are sent whenever the top of book changes.
* [Trades](/api-documentation/api/websocket/subscriptions/trades): Streams all trades on the taker side as they occur in a chosen market.
* [Candle](/api-documentation/api/websocket/subscriptions/candle): Streams candle information for given symbol and candle time interval
* [Mark price candle](/api-documentation/api/websocket/subscriptions/mark-price-candle): Streams real-time mark price candlestick data for a specific market.
* [Account margin](/api-documentation/api/websocket/subscriptions/account-margin): Streams all changes made to an account's margin mode in any market.
* [Account leverage](/api-documentation/api/websocket/subscriptions/account-leverage): Streams all changes made to an account's max leverage in any market.
* [Account info](/api-documentation/api/websocket/subscriptions/account-info): Streams all changes made to an account's overall info such as equity, balance, order count, etc.
* [Account positions](/api-documentation/api/websocket/subscriptions/account-positions): Streams all changes made to an account's positions in any market. A position that has been fully closed will be streamed and return empty.
* [Account order updates](/api-documentation/api/websocket/subscriptions/account-order-updates): Streams the amount and nature of changes made to any of an account's open orders in any market.
* [Account trades](/api-documentation/api/websocket/subscriptions/account-trades): Streams all trades that take place for an account
* [Account transfers](/api-documentation/api/websocket/subscriptions/account-transfers): Streams deposit, withdrawal, and transfer events for an account.
# Account Info
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-info
Streams all changes made to an account's overall info such as equity, balance, order count, etc.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
## Leverage
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_info",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_info",
"data": {
"ae": "2000",
"as": "1500",
"aw": "1400",
"b": "2000",
"f": 1,
"mu": "500",
"cm": "400",
"oc": 10,
"pb": "0",
"pc": 2,
"sc": 2,
"sb": [
{
"s": "SOL",
"a": "1.50000000",
"lr": "0.80",
"aw": "1.00000000",
"pb": "0.00",
"dw": "250.000000",
"dd": "50000.000000",
"wd": "250000.000000"
}
],
"t": 1234567890
}
}
```
| Field | Type | Description |
|---|
'ae' | string | Account equity |
'as' | string | Available to spend |
'aw' | string | Available to withdraw |
'b' | string | Account balance |
'f' | integer | Account fee tier |
'mu' | string | Total margin used |
'cm' | string | Maintenance margin required in cross mode |
'oc' | integer | Orders count |
'pb' | string | Pending balance |
'pc' | integer | Positions count |
'sc' | integer | Stop order count |
'sb' | array | Spot asset balances (see below) |
't' | number | Timestamp in milliseconds |
**Spot Balance Fields**
| Field | Type | Description |
| ------ | ------ | -------------------------------------- |
| `'s'` | string | Spot asset symbol |
| `'a'` | string | Total amount held |
| `'lr'` | string | Loan-to-value ratio |
| `'aw'` | string | Available to withdraw |
| `'pb'` | string | Pending balance |
| `'dw'` | string | Daily withdrawal amount (USD) |
| `'dd'` | string | Effective daily deposit limit (USD) |
| `'wd'` | string | Effective daily withdrawal limit (USD) |
# Account Leverage
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-leverage
Streams all changes made to an account's max leverage in any market.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
## Leverage
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_leverage",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_leverage",
"data": {
"u": "42trU9A5...",
"s": "BTC",
"l": 12,
"t": 1234567890
}
}
```
| Field | Type | Description |
|---|
'u' | string | Account address |
's' | string | Symbol |
'l' | integer | New leverage |
't' | number | Timestamp in milliseconds |
# Account Margin
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-margin
Streams all changes made to an account's margin mode in any market.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
## Margin
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_margin",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_margin",
"data": {
"u": "42trU9A5...",
"s": "ETH",
"i": true,
"t": 1234567890
}
}
```
| Field | Type | Description |
| ----- | ------- | ------------------------------------------ |
| `'u'` | string | Account address |
| `'t'` | number | Timestamp in milliseconds |
| `'s'` | string | Symbol |
| `'i'` | boolean | New margin mode (isolated or not isolated) |
# Account Order Updates
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-order-updates
Streams the amount and nature of changes made to any of an account's open orders in any market.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_order_updates",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_order_updates",
"data": [
{
"i": 1559665358,
"I": null,
"u": "BrZp5bidJ3WUvceSq7X78bhjTfZXeezzGvGEV4hAYKTa",
"s": "BTC",
"d": "bid",
"p": "89501",
"ip": "89501",
"lp": "89501",
"a": "0.00012",
"f": "0.00012",
"oe": "fulfill_limit",
"os": "filled",
"ot": "limit",
"sp": null,
"si": null,
"tp": null,
"r": false,
"ct": 1765017049008,
"ut": 1765017219639,
"li": 1559696133
}
]
}
```
| Field | Type | Description |
|---|
'i' | integer | Order ID |
'I' | Full UUID string | Client order ID |
'u' | base58 encoded address | Account |
's' | string | Symbol |
'd' | string | Side: \[bid, ask] |
'p' | decimal string | Average filled price |
'ip' | decimal string | Initial price |
'lp' | decimal string | Last filled price |
'a' | decimal string | Original amount |
'f' | decimal string | Filled amount |
'oe' | string | Order event (see below) |
'os' | string | Order status (see below) |
'ot' | string | Order type (see below) |
'sp' | string | Stop price |
'si' | string | Stop parent order ID |
'tp' | string | Stop trigger price type: last\_trade\_price, mark\_price, or mid\_price |
'r' | bool | Reduce only |
'ct' | integer | Created at time (milliseconds) |
'ut' | integer | Updated at time (milliseconds) |
'li' | integer | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
| Field | Value | Description |
| ------ | -------------------------- | ------------------------------ |
| `'oe'` | `make` | Order placed on book |
| | `stop_created` | Stop order created |
| | `fulfill_market` | User filled by market order |
| | `fulfill_limit` | User filled others limit order |
| | `adjust` | Order modified |
| | `stop_parent_order_filled` | Parent order filled |
| | `stop_triggered` | Stop order activated |
| | `stop_upgrade` | Stop order upgraded |
| | `cancel` | User cancelled |
| | `force_cancel` | Cancelled by system |
| | `expired` | Time expired |
| | `post_only_rejected` | Cannot execute ALO |
| | `self_trade_prevented` | Cannot execute self-trade |
| `'os'` | `open` | Active on orderbook |
| | `partially_filled` | Partially filled |
| | `filled` | Completely filled |
| | `cancelled` | Cancelled |
| | `rejected` | Rejected |
| `'ot'` | `limit` | Limit |
| | `market` | Market |
| | `stop_limit` | Stop limit |
| | `stop_market` | Stop market |
| | `take_profit_limit` | Take profit (limit) |
| | `stop_loss_limit` | Stop loss (limit) |
| | `take_profit_market` | Take profit (market) |
| | `stop_loss_market` | Stop loss (market) |
# Account Positions
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-positions
Streams all changes made to an account's positions in any market. A position that has been fully closed will be streamed and return empty.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_positions",
"account": "42trU9A5..."
}
}
```
### Positions Snapshots
Upon subscription, the `account_positions` websocket immediately returns a snapshot of all current positions, then begins streaming all changes made to an account's positions in a best effort picture of current state.\
\
We recommend using `account_positions` for initialization, and `account_trades`, to construct up-to-date positions state.
### Stream
```json theme={null}
{
"channel": "subscribe",
"data": {
"source": "account_positions",
"account": "BrZp5..."
}
}
// this is the initialization snapshot
{
"channel": "account_positions",
"data": [
{
"s": "BTC",
"d": "bid",
"a": "0.00022",
"p": "87185",
"m": "0",
"f": "-0.00023989",
"i": false,
"l": null,
"t": 1764133203991
}
],
"li": 1559395580
}
// this shows the position being increased by an order filling
{
"channel": "account_positions",
"data": [
{
"s": "BTC",
"d": "bid",
"a": "0.00044",
"p": "87285.5",
"m": "0",
"f": "-0.00023989",
"i": false,
"l": "-95166.79231",
"t": 1764133656974
}
],
"li": 1559412952
}
// this shows the position being closed
{
"channel": "account_positions",
"data": [],
"li": 1559438203
}
```
| Field | Type | Description |
|---|
's' | string | Symbol |
'd' | string | Position side (bid, ask) |
'a' | decimal string | Position amount |
'p' | decimal string | Average entry price |
'm' | decimal string | Position margin |
'f' | decimal string | Position funding fee |
'i' | bool | Is position isolated? |
'l' | decimal string | Liquidation price in USD (null if not applicable) |
't' | number | Timestamp in milliseconds |
'li' | number | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
# Account Trades
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-trades
Streams all trades that take place for an account
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_trades",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_trades",
"data": [
{
"h": 80063441,
"i": 1559912767,
"I": null,
"u": "BrZp5bidJ3WUvceSq7X78bhjTfZXeezzGvGEV4hAYKTa",
"s": "BTC",
"p": "89477",
"o": "89505",
"a": "0.00036",
"te": "fulfill_taker",
"ts": "close_long",
"tc": "normal",
"f": "0.012885",
"n": "-0.022965",
"t": 1765018588190,
"li": 1559912767,
"it": 0
}
]
}
```
| Field | Type | Description |
|---|
'h' | integer | History ID |
'i' | integer | Order ID |
'I' | Full UUID string | Client order ID |
'u' | sting | Account address |
's' | string | Symbol |
'p' | decimal string | Price |
'o' | decimal string | Entry price |
'a' | decimal string | Trade amount |
'te' | string | 'fulfill\_maker' - provided liquidity
'fulfill\_taker' - took liquidity |
'ts' | string | Trade side |
'tc' | string | 'normal' - Regular trade
'market\_liquidation' - liquidated by market order
'backstop\_liquidation' - liquidated by backstop liquidator
'settlement' - ADL/settlement
'insolvency\_liquidation' - liquidated due to insolvency
'game\_settlement' - game settlement
'fulfill\_rfq' - RFQ fill |
'f' | decimal string | Trade fee |
'n' | decimal string | PnL |
't' | number | Timestamp in milliseconds |
'li' | number | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
'it' | integer | Instrument type |
# Account Transfers
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/account-transfers
Streams deposit, withdrawal, and transfer events for an account.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
## Account Transfers
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "account_transfers",
"account": "42trU9A5..."
}
}
```
### Stream
```json theme={null}
{
"channel": "account_transfers",
"data": {
"u": "42trU9A5...",
"e": "deposit",
"a": "USDC",
"am": "1000.000000",
"t": 1716200000000,
"tx": "5xGk...",
"bn": 42,
"ra": "1000.000000",
"f": "0.500000"
}
}
```
Note: the optional keys (`tx`, `s`, `r`, `bn`, `ra`, `f`) are **omitted** from the payload when they do not apply — they are not sent as `null`. Only `u`, `e`, `a`, `am`, and `t` are always present.
| Field | Type | Description |
| ------ | ------------------ | --------------------------------------------------------------------------------------------------- |
| `'u'` | string | Account address |
| `'e'` | string | Transfer event type: `deposit`, `subaccount_transfer`, `withdrawal_pending`, `withdrawal_confirmed` |
| `'a'` | string | Asset symbol |
| `'am'` | string | Transfer amount |
| `'t'` | number | Timestamp in milliseconds |
| `'tx'` | string (optional) | Transaction ID (omitted if not applicable) |
| `'s'` | string (optional) | Source address (omitted if not applicable) |
| `'r'` | string (optional) | Receiver address (omitted if not applicable) |
| `'bn'` | integer (optional) | Batch nonce for withdrawals (omitted if not applicable) |
| `'ra'` | string (optional) | Requested amount before fees (omitted if not applicable) |
| `'f'` | string (optional) | Fee amount (omitted if not applicable) |
#### Code Example (Python)
```python theme={null}
import asyncio
import json
import websockets
async def subscribe_account_transfers(account: str):
uri = "wss://"
async with websockets.connect(uri) as ws:
await ws.send(json.dumps({
"method": "subscribe",
"params": {
"source": "account_transfers",
"account": account,
},
}))
async for message in ws:
data = json.loads(message)
print(data)
asyncio.run(subscribe_account_transfers("42trU9A5..."))
```
# Best Bid Offer (BBO)
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/best-bid-offer-bbo
Real-time updates of the best bid and ask prices and amounts for a specific symbol. Updates are sent whenever the top of book changes.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "bbo",
"symbol": "BTC"
}
}
```
### Stream
```json theme={null}
{
"channel": "bbo",
"data": {
"s": "BTC",
"i": 1234567890,
"li": 1325476098,
"t": 1764133203991,
"b": "87185",
"B": "1.234",
"a": "87186",
"A": "0.567"
}
}
```
| Field | Type | Description |
| ------ | -------------- | --------------------------------- |
| `'s'` | string | Symbol |
| `'i'` | integer | Order id |
| `'li'` | integer | Last order id |
| `'t'` | integer | Timestamp in milliseconds |
| `'b'` | decimal string | Best bid price |
| `'B'` | decimal string | Best bid amount (in token amount) |
| `'a'` | decimal string | Best ask price |
| `'A'` | decimal string | Best ask amount (in token amount) |
# Candle
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/candle
Streams candle information for given symbol and candle time interval
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "candle",
"symbol": "SOL",
"interval": "1m"
}
}
```
Where `"interval"` can be `1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 1w, 1M`
### Stream
```json theme={null}
{
"channel": "candle",
"data": {
"t": 1749052260000,
"T": 1749052320000,
"s": "SOL",
"i": "1m",
"o": "157.3",
"c": "157.32",
"h": "157.32",
"l": "157.3",
"v": "1.22",
"n": 8
}
}
```
| Field | Type | Description |
| ----- | -------------- | ------------------------------- |
| `'t'` | number | Start time (milliseconds) |
| `'T'` | number | End time (milliseconds) |
| `'s'` | string | Symbol |
| `'i'` | string | Candle interval |
| `'o'` | decimal string | Open price |
| `'c'` | decimal string | Close price |
| `'h'` | decimal string | High price |
| `'l'` | decimal string | Low price |
| `'v'` | decimal string | Volume |
| `'n'` | number | Number of trades in this period |
# Mark Price Candle
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/mark-price-candle
Streams real-time mark price candlestick data for a specific market.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "mark_price_candle",
"symbol": "BTC",
"interval": "1m"
}
}
```
Where `"interval"` can be `1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 1w, 1M`
### Stream
```json theme={null}
{
"channel": "mark_price_candle",
"data": {
"t": 1748954160000,
"T": 1748954220000,
"s": "BTC",
"i": "1m",
"o": "105376.500000",
"c": "105380.250000",
"h": "105385.750000",
"l": "105372.000000",
"v": "0",
"n": 0
}
}
```
| Field | Type | Description |
| ----- | -------------- | ------------------------------- |
| `'t'` | number | Start time (milliseconds) |
| `'T'` | number | End time (milliseconds) |
| `'s'` | string | Symbol |
| `'i'` | string | Candle interval |
| `'o'` | decimal string | Open mark price |
| `'c'` | decimal string | Close mark price |
| `'h'` | decimal string | High mark price |
| `'l'` | decimal string | Low mark price |
| `'v'` | decimal string | Volume (always `"0"`) |
| `'n'` | number | Number of trades in this period |
# Orderbook
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/orderbook
Streams book data for given symbol at a set aggregation level as they update
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "book",
"symbol": "SOL",
"agg_level": 1 // Aggregation level
}
}
```
where `agg_level`can be one of `1, 10, 100, 1000, 10000`.
### Stream
```json theme={null}
{
"channel": "book",
"data": {
"l": [
[
{
"a": "37.86",
"n": 4,
"p": "157.47"
},
// ... other aggegated bid levels
],
[
{
"a": "12.7",
"n": 2,
"p": "157.49"
},
{
"a": "44.45",
"n": 3,
"p": "157.5"
},
// ... other aggregated ask levels
]
],
"s": "SOL",
"t": 1749051881187,
"li": 1559885104
}
}
```
The `book` websocket stream updates once every 250ms
| Field | Type | Description |
| ------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `'l'` | array | \[Bids, Asks] |
| `'a'` | decimal string | Total amount in aggregation level. |
| `'n'` | integer | Number of orders in aggregation level. |
| `'p'` | decimal string | - In bids array, this is highest price in aggregation level.
- In asks array, this is lowest price in aggregation level.
|
| `'s'` | string | Symbol |
| `'t'` | number | Timestamp in milliseconds |
| `'li'` | number | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
# Prices
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/prices
Streams all symbols' price information on Pacifica as they update
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "prices"
}
}
```
### Stream
```json theme={null}
{
"channel": "prices",
"data": [
{
"funding": "0.0000125",
"mark": "105473",
"mid": "105476",
"next_funding": "0.0000125",
"open_interest": "0.00524",
"oracle": "105473",
"symbol": "BTC",
"timestamp": 1749051612681,
"volume_24h": "63265.87522",
"yesterday_price": "955476"
}
// ... other symbol prices
],
}
```
| Field | Type | Description |
| ------------------- | -------------- | ------------------------- |
| `'funding'` | decimal string | Funding rate |
| `'mark'` | decimal string | Mark price |
| `'timestamp'` | number | Timestamp in milliseconds |
| `'mid'` | decimal string | Mid price |
| `'next_funding'` | decimal string | Next funding rate |
| `'open_interest'` | decimal string | Open interest amount |
| `'oracle'` | decimal string | Oracle price |
| `'symbol'` | string | Symbol |
| `'volume_24h'` | decimal string | 24 hour volume in USD |
| `'yesterday_price'` | decimal string | Previous day price |
# Trades
Source: https://docs.pacifica.fi/api-documentation/api/websocket/subscriptions/trades
Streams all trades on the taker side as they occur in a chosen market.
Refer to [Websocket](/api-documentation/api/websocket) for establishing the websocket connection.
### Params
```json theme={null}
{
"method": "subscribe",
"params": {
"source": "trades",
"symbol": "SOL"
}
}
```
### Stream
```json theme={null}
{
"channel": "trades",
"data": [
{
"h": 80062522,
"s": "BTC",
"a": "0.00001",
"p": "89471",
"d": "close_short",
"tc": "normal",
"t": 1765018379085,
"li": 1559885104,
"it": 0
}
]
}
```
| Field | Type | Description |
|---|
'h' | integer | History ID |
's' | string | Symbol |
'a' | decimal string | Amount |
'p' | decimal string | Price |
'd' | string | Trade side open\_long
open\_short
close\_long
close\_short
|
'tc' | string | Trade cause normal market\_liquidation backstop\_liquidation settlement insolvency\_liquidation game\_settlement fulfill\_rfq
|
't' | number | Timestamp in milliseconds |
'li' | number | Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift. |
'it' | integer | Instrument type |
# Trading Operations
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations
* [Create market order](/api-documentation/api/websocket/trading-operations/create-market-order): This request type allows users to place market orders through Pacifica's websocket API.
* [Create limit order](/api-documentation/api/websocket/trading-operations/create-limit-order): This request type allows users to place limit orders through Pacifica's websocket API.
* [Edit order](/api-documentation/api/websocket/trading-operations/edit-order): This request type allows users to modify existing orders (price and/or size) through websocket API in one request.
* [Batch order](/api-documentation/api/websocket/trading-operations/batch-order): This endpoint allows users to submit multiple order operations in a single websocket request.
* [Cancel order](/api-documentation/api/websocket/trading-operations/cancel-order): This request type allows users to cancel orders through Pacifica's websocket API.
* [Cancel all orders](/api-documentation/api/websocket/trading-operations/cancel-all-orders): This request type allows users to cancel all orders through Pacifica's websocket API.
# Batch Order
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/batch-order
This endpoint allows users to submit multiple order operations in a single websocket request.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/batch_orders.py) provides a comprehensive example on using this endpoint
### Request
```json theme={null}
{
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"params": {
"batch_orders": {
"actions": [
{
"type": "Create",
"data": {
"account": "42trU9A5...",
"signature": "5UpRZ14Q...",
"timestamp": 1749190500355,
"expiry_window": 5000,
"symbol": "BTC",
"price": "100000",
"reduce_only": false,
"amount": "0.1",
"side": "bid",
"tif": "GTC",
"client_order_id": "57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e"
}
},
{
"type": "CreateMarket",
"data": {
"account": "42trU9A5...",
"signature": "3KxMn7pQ...",
"timestamp": 1749190500355,
"expiry_window": 5000,
"symbol": "ETH",
"amount": "1.0",
"side": "ask",
"slippage_percent": "0.5",
"reduce_only": false
}
},
{
"type": "Cancel",
"data": {
"account": "42trU9A5...",
"signature": "4NDFHyTG...",
"timestamp": 1749190500355,
"expiry_window": 5000,
"symbol": "SOL",
"order_id": 42069
}
}
]
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 660065de-8f32-46ad-ba1e-83c93d3e3966 |
"actions" | array | required | List of order actions to perform
Each action has a "type" field and action-specific "data" | See next two rows |
"type" | string | required | Specifies type of action. This is DIFFERENT to the "type" used in signature headers | "Create"
"CreateMarket"
"Cancel"
"Edit"
"SetPositionTpsl"
"CancelStopOrder"
(case sensitive)
|
"data" | object | required | Contains signed request payloads of individual actions. Fields are identical to the corresponding standalone endpoints: create limit order, create market order, cancel order, edit order, create position TP/SL, and cancel stop order. | See code block below. Messages and corresponding fields are identical to create and cancel requests. |
#### Response
* Status 200: Batch operations processed successfully
```json theme={null}
{
"code": 200,
"data": {
"results": [
{
"success": true,
"order_id": 645953,
"error": null
},
{
"success": false,
"order_id": null,
"error": "Order not found"
}
]
},
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"t": 1749223025962,
"type": "batch_orders",
"rl": {
"r": 9980,
"q": 10000,
"t": 1000
}
}
```
Each entry in `results` corresponds positionally to an action in the request `actions` array, and has the following fields:
| Field | Type | Description |
| ------------ | --------------- | ------------------------------------------------------- |
| `'success'` | boolean | Whether the individual action succeeded |
| `'order_id'` | integer or null | Resulting order ID (null for cancels or failed actions) |
| `'error'` | string or null | Error message if the action failed, otherwise null |
The top-level frame also includes the always-present `rl` (rate-limit) object: `r` = credits remaining, `q` = quota, `t` = reset-in (ms).
* Status 400: Bad request
```json theme={null}
{
"error": "Invalid batch operation parameters",
"code": 400
}
```
* Status 500: Internal server error
### Notes on Batch Ordering
#### Speed Bump (Latency Protection)
Batch orders are subject to a conditional randomized \~200ms (190-210ms) delay to protect liquidity providers from adverse selection:\
\
Speed bump is applied if the batch contains:
* Market orders (CreateMarket)
* Limit orders with TIF = GTC or IOC
Speed bump is NOT applied if the batch only contains:
* Add Liquidity Only orders (TIF = ALO)
* Top of Book orders (TIF = TOB)
* Cancel operations
* TP/SL operations
#### Signature Requirements
* Each action in the batch must be individually signed
* All signatures must be valid for the batch to process
#### Execution Behavior and Limits
* Maximum 10 actions per batch request
* Actions are executed atomically in the order provided
* If one action fails, subsequent actions are still attempted
# Cancel All Orders
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/cancel-all-orders
This request type allows users to cancel all orders through Pacifica's websocket API.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/cancel_all_orders.py) provides a comprehensive example on using this endpoint.
### Request
```json theme={null}
{
"id": "4e9b4edb-b123-4759-9250-d19db61fabcb",
"params": {
"cancel_all_orders": {
"account": "AwX6f3...",
"signature": "2XP8fz...",
"timestamp": 1749221927343,
"expiry_window": 5000,
"all_symbols": true,
"exclude_reduce_only": false
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 1bb2b72f-f545-4938-8a38-c5cda8823675 |
"params" | object | required | Contains action type and action parameters | "cancel\_all\_orders" |
"cancel\_all\_orders" | object | required | Specifies action type and contains parameters | See examples. |
"account" | string | required | User's wallet address | 42trU9A5... |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"all\_symbols" | boolean | required | Whether to cancel orders for all symbols | true |
"exclude\_reduce\_only" | boolean | required | Whether to exclude reduce-only orders | false |
"symbol" | string | required (if "all\_symbols" is false) | Trading pair symbol | BTC |
```json theme={null}
{
"code": 200,
"data": {
"cancelled_count": 10
},
"id": "b86b4f45-49da-4191-84e2-93e141acdeab",
"t": 1749221787291,
"type": "cancel_all_orders",
"rl": {
"r": 9995,
"q": 10000,
"t": 1000
}
}
```
| Field | Type | Description |
| ------------------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer | Status code |
| `'data'` | object | Contains information about placed order |
| `'cancelled_count'` | integer | Number of orders successfully cancelled |
| `'id'` | string | Same as above request ID |
| `'t'` | integer | Timestamp in milliseconds |
| `'type'` | string | Specifies action type |
| `'rl'` | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |
On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.
# Cancel Order
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/cancel-order
This request type allows users to cancel orders through Pacifica's websocket API.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/cancel_order.py) provides a comprehensive example on using this endpoint.
### Request
```json theme={null}
{
"id": "1bb2b72f-f545-4938-8a38-c5cda8823675",
"params": {
"cancel_order": {
"account": "AwX6321...",
"signature": "4RqbgB...",
"timestamp": 1749223343149,
"expiry_window": 5000,
"symbol": "BTC",
"client_order_id": "79f948fd-7556-4066-a128-083f3ea49322"
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 1bb2b72f-f545-4938-8a38-c5cda8823675 |
"params" | object | required | Contains action type and action parameters | "cancel\_order" |
"cancel\_order" | object | required | Specifies action type and contains parameters | See examples. |
"account" | string | required | User's wallet address | 42trU9A5... |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"symbol" | string | required | Trading pair symbol | BTC |
"order\_id" | integer | required (if no CLOID) | Exchange-assigned order ID | 123 |
"client\_order\_id" | Full UUID string | required (if no OID) | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
### Response
```json theme={null}
{
"code": 200,
"data": {
"I": "79f948fd-7556-4066-a128-083f3ea49322",
"i": null,
"s": "BTC"
},
"id": "1bb2b72f-f545-4938-8a38-c5cda8823675",
"t": 1749223343610,
"type": "cancel_order",
"rl": {
"r": 9995,
"q": 10000,
"t": 1000
}
}
```
| Field | Type | Description |
| -------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer | Status code |
| `'data'` | object | Contains information about placed order |
| `'I'` | string | CLOID (if provided) |
| `'i'` | integer | Order ID |
| `'s'` | string | Symbol |
| `'id'` | string | Same as above request ID |
| `'t'` | integer | Timestamp in milliseconds |
| `'type'` | string | Specifies action type |
| `'rl'` | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |
On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.
Cancels are not subject to any speedbump.
# Create Limit Order
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-limit-order
This request type allows users to place limit orders through Pacifica's websocket API.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/create_order.py) provides a comprehensive example on using this endpoint.
### Request
```json theme={null}
{
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"params": {
"create_order": {
"account": "AwX6321...",
"signature": "5vnYpt...",
"timestamp": 1749223025396,
"expiry_window": 5000,
"symbol": "BTC",
"price": "100000.00",
"reduce_only": false,
"amount": "0.001",
"side": "bid",
"tif": "GTC",
"client_order_id": "79f948fd-7556-4066-a128-083f3ea49322",
"builder_code": "MYCODE"
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 660065de-8f32-46ad-ba1e-83c93d3e3966 |
"params" | object | required | Contains action type and action parameters | "create\_order" |
"create\_order" | object | required | Specifies action type and contains parameters | See examples. |
"account" | string | required | User's wallet address | 42trU9A5... |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"symbol" | string | required | Trading pair symbol | BTC |
"price" | string | required | Order price | 50000 |
"reduce\_only" | boolean | required | Whether the order is reduce-only | false |
"amount" | string | required | Order amount | 0.1 |
"side" | string | required | Order side (bid/ask) | bid |
"tif" | string | required | Time in force (GTC, IOC, ALO, TOB) | GTC |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric) | MYCODE |
"take\_profit" | object | optional | Take profit stop order configuration | See next three rows |
"stop\_price" | string | required (if "take\_profit" exists) | Stop trigger price | 55000 |
"limit\_price" | string | optional | Limit price for the triggered order | 54950 |
"client\_order\_id" | string | Full UUID string | Client-defined order ID for the stop order | e36ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type to trigger stop. Options: mark\_price (default), last\_trade\_price, mid\_price | mark\_price |
"stop\_loss" | object | optional | Stop loss order configuration | See next three rows |
"stop\_price" | string | required (if "stop\_loss" exists) | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | string | Full UUID string | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type to trigger stop. Options: mark\_price (default), last\_trade\_price, mid\_price | mark\_price |
### Response
```json theme={null}
{
"code": 200,
"data": {
"I": "79f948fd-7556-4066-a128-083f3ea49322",
"i": 645953,
"s": "BTC"
},
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"t": 1749223025962,
"type": "create_order",
"rl": {
"r": 9990,
"q": 10000,
"t": 1000
}
}
```
| Field | Type | Description |
| -------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer | Status code |
| `'data'` | object | Contains information about placed order |
| `'I'` | string | CLOID (if provided) |
| `'i'` | integer | Order ID |
| `'s'` | string | Symbol |
| `'id'` | string | Client-defined request ID |
| `'t'` | integer | Timestamp in milliseconds |
| `'type'` | string | Specifies action type |
| `'rl'` | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |
On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.
Note: In order to protect liquidity providers from adverse selection, all TIF GTC, and TIF IOC orders are subject to a \~200ms delay.
# Create Market Order
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-market-order
This request type allows users to place market orders through Pacifica's websocket API.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/create_order.py) provides a comprehensive example on using this endpoint.
### Request
```json theme={null}
{
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"params": {
"create_market_order": {
"account": "AwX6321...",
"signature": "5vnYpt...",
"timestamp": 1749223025396,
"expiry_window": 5000,
"symbol": "BTC",
"reduce_only": false,
"amount": "0.001",
"side": "bid",
"slippage_percent": "0.5",
"client_order_id": "79f948fd-7556-4066-a128-083f3ea49322",
"builder_code": "MYCODE"
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 660065de-8f32-46ad-ba1e-83c93d3e3966 |
"params" | object | required | Contains action type and action parameters | "create\_order" |
"create\_market\_order" | object | required | Specifies action type and contains parameters | See examples. |
"account" | string | required | User's wallet address | 42trU9A5... |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"symbol" | string | required | Trading pair symbol | BTC |
"reduce\_only" | boolean | required | Whether the order is reduce-only | false |
"amount" | string | required | Order amount | 0.1 |
"side" | string | required | Order side (bid/ask) | bid |
"slippage\_percent" | string | required | Maximum allowed slippage in percentage, e.g. "0.5" means 0.5% max slippage | 0.5 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
"builder\_code" | string | optional | Builder program code (3-16 alphanumeric) | MYCODE |
"take\_profit" | object | optional | Take profit stop order configuration | See next three rows |
"stop\_price" | string | required (if "take\_profit" exists) | Stop trigger price | 55000 |
"limit\_price" | string | optional | Limit price for the triggered order | 54950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | e36ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type to trigger stop. Options: mark\_price (default), last\_trade\_price, mid\_price | mark\_price |
"stop\_loss" | object | optional | Stop loss order configuration | See next three rows |
"stop\_price" | string | required (if "stop\_loss" exists) | Stop trigger price | 48000 |
"limit\_price" | string | optional | Limit price for the triggered order | 47950 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID for the stop order | d25ac10b-58cc-4372-a567-0e02b2c3d479 |
"trigger\_price\_type" | string | optional | Price type to trigger stop. Options: mark\_price (default), last\_trade\_price, mid\_price | mark\_price |
### Response
```json theme={null}
{
"code": 200,
"data": {
"I": "79f948fd-7556-4066-a128-083f3ea49322",
"i": 645953,
"s": "BTC"
},
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"t": 1749223025962,
"type": "create_market_order",
"rl": {
"r": 9990,
"q": 10000,
"t": 1000
}
}
```
| Field | Type | Description |
| -------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer | Status code |
| `'data'` | object | Contains information about placed order |
| `'I'` | string | CLOID (if provided) |
| `'i'` | integer | Order ID |
| `'s'` | string | Symbol |
| `'id'` | string | Client-defined request ID |
| `'t'` | integer | Timestamp in milliseconds |
| `'type'` | string | Specifies action type |
| `'rl'` | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |
On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.
Note: In order to protect liquidity providers from adverse selection, all market orders are subject to a \~200ms delay.
# Edit Order
Source: https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/edit-order
This request type allows users to modify existing orders (price and/or size) through websocket API in one request.
The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/create_order.py) provides a comprehensive example on using this endpoint.
### Request
```json theme={null}
{
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"params": {
"edit_order": {
"account": "AwX6321...",
"signature": "5vnYpt...",
"timestamp": 1749223025396,
"expiry_window": 5000,
"symbol": "BTC",
"price": "99500",
"amount": "0.002",
"order_id": 645953
}
}
}
```
| Field | Type | Need | Description | Example |
|---|
"id" | Full UUID string | required | Client-defined request ID | 660065de-8f32-46ad-ba1e-83c93d3e3966 |
"params" | object | required | Contains action type and action parameters | "edit\_order" |
"edit\_order" | object | required | Specifies action type and contains parameters | See examples. |
"account" | string | required | User's wallet address | 42trU9A5... |
"agent\_wallet" | string | optional | Agent wallet address | 69trU9A5... |
"signature" | string | required | Cryptographic signature | 5j1Vy9Uq... |
"timestamp" | integer | required | Current timestamp in milliseconds | 1716200000000 |
"expiry\_window" | integer | optional | Signature expiry in milliseconds | 30000 |
"symbol" | string | required | Trading pair symbol | BTC |
"price" | string | required | Order price | 99500 |
"amount" | string | optional | Order amount (if omitted, only the price is changed) | 0.002 |
"order\_id" | integer | optional | System-defined order ID (needed if no CLOID provided) | 645953 |
"client\_order\_id" | Full UUID string | optional | Client-defined order ID (needed if no OID provided) | f47ac10b-58cc-4372-a567-0e02b2c3d479 |
### Response
```json theme={null}
{
"code": 200,
"data": {
"I": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"i": 645954,
"s": "BTC"
},
"id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
"t": 1749223026150,
"type": "edit_order",
"rl": {
"r": 9990,
"q": 10000,
"t": 1000
}
}
```
| Field | Type | Description |
| -------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer | Status code |
| `'data'` | object | Contains information about placed order |
| `'I'` | string | CLOID (if original order contained one) |
| `'i'` | integer | New order ID |
| `'s'` | string | Symbol |
| `'id'` | string | Client-defined request ID |
| `'t'` | integer | Timestamp in milliseconds |
| `'type'` | string | Specifies action type |
| `'rl'` | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |
On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.
**Notes:** Editing an order cancels the original and creates a new one. The new order maintains the same side, reduce-only status, and client\_order\_id (if provided), is created with TIF = ALO (Post Only), and receives a new system-assigned order\_id.\
\
Edit orders are subject to the taker speedbump: when the speedbump is enabled, they are delayed by a randomized \~190-210ms regardless of whether the resulting order is a taker (accounts on the exemption whitelist are not delayed).
# Changelog
Source: https://docs.pacifica.fi/api-documentation/changelog
Changelog for Pacifica's API documentation
### 2026-06-30
**MCP**
* [MCP Server](/api-documentation/api/mcp) \[NEW]
* Added documentation for the Pacifica MCP server (`@pacifica-fi/mcp-server`), which exposes the REST API as Model Context Protocol tools
* Covers the Claude Desktop quickstart, configuration (environment variables, auth modes, security), client setup for Claude Code, OpenAI Codex, Factory, Hermes, and Crush, and the full tool reference
* Documents the on-chain [funding tools](/api-documentation/api/mcp/tools#funding) `mintUsdp` (testnet faucet) and `depositUsdp` (deposit USDC/USDP into your exchange balance), plus the `SOLANA_RPC_URL`, `PACIFICA_PROGRAM_ID`, and `PACIFICA_USDC_MINT` environment variables
### 2026-05-04
**Docs**
* [Vaults](/vaults) \[NEW]
* Added a new vaults section covering overview, depositing, managing a vault, profit and loss, and risk controls
**REST API**
* [Vaults](/api-documentation/api/rest-api/vaults) \[NEW]
* Added REST API docs for vault creation, deposits, withdrawals, manager claims, referral codes, deposit cap updates, whitelist/blacklist updates, max leverage updates, and vault listing under `/api/v1/lake/*`
* [Operation Types](/api-documentation/api/signing/operation-types) \[UPDATE]
* Added signing operation types for all documented vault endpoints
### 2026-04-23
**REST API & WS**
* [Batch order](/api-documentation/api/rest-api/orders/batch-order) \[UPDATE]
* Expanded action types: `CreateMarket`, `Edit`, `SetPositionTpsl`, `CancelStopOrder` now supported alongside `Create` and `Cancel`
* Added `builder_code` parameter to all order creation endpoints \[UPDATE]
* Supports Builder Program fee attribution (3-16 alphanumeric characters)
* Added `trigger_price_type` to all stop order and TP/SL configurations \[UPDATE]
* Options: `mark_price` (default), `last_trade_price`, `mid_price`
**REST API**
* [Get spot assets](/api-documentation/api/rest-api/spot/get-spot-assets) \[NEW]
* List all spot assets with collateral eligibility and LTV ratios
* [Get bridge info](/api-documentation/api/rest-api/spot/get-bridge-info) \[NEW]
* Retrieve bridge parameters for all spot assets (minimum deposit, withdrawal fee, mint address)
* [Get bridge parameters](/api-documentation/api/rest-api/spot/get-bridge-parameters) \[NEW]
* Retrieve bridge parameters for a single spot asset by symbol
* [Withdraw spot asset](/api-documentation/api/rest-api/account/withdraw-spot-asset) \[NEW]
* Withdraw spot assets with idempotency key support
* [Get pending spot withdrawals](/api-documentation/api/rest-api/account/get-pending-spot-withdrawals) \[NEW]
* [Get spot deposit history](/api-documentation/api/rest-api/account/get-spot-deposit-history) \[NEW]
* [Get spot withdrawal history](/api-documentation/api/rest-api/account/get-spot-withdrawal-history) \[NEW]
* [Get spot balance history](/api-documentation/api/rest-api/account/get-spot-balance-history) \[NEW]
* [Subaccount spot transfer](/api-documentation/api/rest-api/subaccounts/subaccount-spot-transfer) \[NEW]
* Transfer spot assets between main account and subaccounts
* [Update spot settings](/api-documentation/api/rest-api/account/update-spot-settings) \[NEW]
* Toggle per-asset `unified_margin_excluded` flag for unified margin collateral
* [Toggle auto-lending](/api-documentation/api/rest-api/account/toggle-auto-lending) \[NEW]
* Enable or disable automatic lending
* [Add isolated margin](/api-documentation/api/rest-api/account/add-isolated-margin) \[NEW]
* Add USDC margin to an isolated position
* [Get fee levels](/api-documentation/api/rest-api/markets/get-fee-levels) \[NEW]
* Retrieve all fee tier levels with maker/taker rates
* [Get loan pool](/api-documentation/api/rest-api/markets/get-loan-pool) \[NEW]
* Retrieve loan pool state including utilization and borrow/lend rates
* [Get account loan info](/api-documentation/api/rest-api/account/get-account-loan-info) \[NEW]
* Retrieve loan and collateral details under unified margin (borrowed amount, collateral utilization, per-asset LTV)
* [Get account info](/api-documentation/api/rest-api/account/get-account-info) \[UPDATE]
* Added `spot_collateral`, `pending_interest`, `spot_balances`, `cross_account_equity`, and `spot_market_value` fields to support unified margin with spot collateral
* [Get account settings](/api-documentation/api/rest-api/account/get-account-settings) \[UPDATE]
* Documented `auto_lend_disabled` and `spot_settings` with `unified_margin_excluded` per asset
* [Get positions](/api-documentation/api/rest-api/account/get-positions) \[UPDATE]
* Added `liquidation_price` and `amount` fields
* [Get loan pool](/api-documentation/api/rest-api/markets/get-loan-pool) \[UPDATE]
* Added `utilization_max` and `auto_lender_entry_threshold` fields
* [Create stop order](/api-documentation/api/rest-api/orders/create-stop-order) \[FIX]
* Fixed `side` parameter examples to use correct values (`bid`/`ask`)
**WebSocket**
* [Account transfers](/api-documentation/api/websocket/subscriptions/account-transfers) \[NEW]
* Real-time deposit, withdrawal, and transfer event stream
* [Account info](/api-documentation/api/websocket/subscriptions/account-info) \[UPDATE]
* Added `sb` (spot\_balances) field with per-asset collateral details
* [Account order updates](/api-documentation/api/websocket/subscriptions/account-order-updates) \[UPDATE]
* Added `tp` (trigger\_price\_type) field
* Added order types: `stop_limit`, `stop_market`, `take_profit_limit`, `stop_loss_limit`, `take_profit_market`, `stop_loss_market`
### 2026-03-11
* [Account settings](/api-documentation/api/rest-api/account/get-account-settings) REST API to include `margin_settings`, `spot_settings` and `auto_lend_disabled`, in order to support spot assets and unified margin \[UPDATE]
### 2026-02-19
* VIP Tier rate-limits increased \[UPDATE]
### 2026-02-05
* Remove `account_orders` websocket endpoint. Note that open orders snapshot can be obtained from REST API `/api/v1/orders` and real time order updates can be obtained from websocket `account_order_updates` \[UPDATE]
* Enforce main+subaccount rate limit [based on fee tier](/api-documentation/api/rate-limits#credit-quotas) for requests with API Config Keys \[NEW]
### 2026-01-24
* Update `agg_level` to `1, 10, 100, 1000, 10000` for `api/v1/book` and websocket `book` \[UPDATE]
### 2026-01-20
* Add `maker_fee` and `taker_fee` to /api/v1/account endpoint \[UPDATE]
### 2026-01-12
* Add `li` (last order id) to `bbo` websocket stream \[UPDATE]
### 2026-01-01
* Add `li` (last order id) to `orderbook` websocket stream \[UPDATE]
### 2025-12-16
**WebSocket**
* Initialization added to `account_orders` endpoint \[UPDATE]
* `account_orders` endpoint now sends snapshot of account's open orders upon subscription.
### 2025-12-06
**REST API & WS**
* Last order ID added \[NEW]
* Added field in multiple REST and WS endpoints as an exchange-wide identifier to order all exchange events
### 2025-11-19
**REST API**
* Market info endpoint updated \[UPDATE]
* Added `created_at` field to /api/v1/info response showing when each market was listed
**WEBSOCKET**
* Account positions snapshot \[UPDATE]
* account\_positions websocket endpoint now returns immediate snapshot of current positions upon subscription
* Batch orders \[NEW]
* Order batching now supported via websocket
* Best bid offer (BBO) \[NEW]
* bbo endpoint now supported via websocket
* constantly streams top of book for selected symbol
**REST API & WS**
* Edit order type added \[NEW]
* Added endpoint in REST and WS to edit price and/or size of existing orders
* Mark price candle added \[NEW]
* Added endpoint in REST and WS to show mark price candles
* Returns candle data based on mark price instead of traded prices
* Batch order speed bump optimization \[UPDATE]
* Speed bump now applied conditionally based on order types in batch
* Only applied if batch contains market orders or limit orders with TIF GTC/IOC
* Speed bump not applied if batch only contains ALO/TOB orders, cancellations, or TP/SL updates
### 2025-11-12
**GENERAL API**
* Taker latency increased. \[UPDATE]
* All market orders, TIF GTC, and TIF IOC orders are subject to a \~200ms delay
### 2025-11-10
**REST API & WS**
* [Top-of-Book (TOB)](/trading-on-pacifica/order-types) TIF order type added \[NEW]
* Useable in:
* Frontend GUI under Limit, TIF, TOB (Post Only)
* [Create limit order REST API](/api-documentation/api/rest-api/orders/create-limit-order) endpoint
* [Batch order REST API](/api-documentation/api/rest-api/orders/batch-order) endpoint
* [Create limit order websocket](/api-documentation/api/websocket/trading-operations/create-limit-order) endpoint
### 2025-11-09
**GENERAL API**
* Taker latency added. \[NEW]
* All market orders, TIF GTC, and TIF IOC orders are subject to a randomized 50-100ms delay
### 2025-10-30
**REST API**
* Cursor based pagination added for all history endpoints \[UPDATE]
* Offset pagination deprecated
### 2025-10-25
**REST API**
* [List subaccounts](/api-documentation/api/rest-api/subaccounts/list-subaccounts) \[NEW]
* Added a new endpoint to retrieve subaccount information
**WEBSOCKET**
* [Orderbook websocket](/api-documentation/api/websocket/subscriptions/orderbook) \[UPDATE]
* 'book' websocket update interval improved from 500ms to 100ms
# Audits
Source: https://docs.pacifica.fi/other/audits
[BlockSec audit report (PDF)](/images/tjfRMLcTkAHqN7rfxcos.pdf)
# Brand Assets
Source: https://docs.pacifica.fi/other/brand-assets
This section provides guidelines for using Pacifica's brand assets to ensure a consistent and professional presentation across all channels. Whether you are a partner, media outlet, or community member, please follow these guidelines when using our logos, colors, and other visual elements.
*Download high-resolution logos and vector files from our:* [*Brand Assets Repository.*](https://drive.google.com/drive/folders/1cpktvx3Ir4OZVjEiyqY3VcY3Y87_PTnb?usp=sharing)
# Contact Us
Source: https://docs.pacifica.fi/other/contact-us
We're here to help. Whether you have a question about trading, need technical support, or want to share your feedback, feel free to reach out to us through any of the channels below.
#### Community
Join our active community on Discord or Telegram to connect with fellow traders, ask questions, and stay updated on the latest news.
* [Discord](https://discord.gg/dxddmceu4C)
* [Telegram](https://t.me/PacificaTGPortalBot)
* Email: [ops@pacifica.fi](mailto:ops@pacifica.fi)
#### Socials
Follow us for the latest updates, announcements, and market insights.
* [X](https://x.com/pacifica_fi)
***
*We value your input and are committed to ensuring a smooth, secure, and transparent trading experience on Pacifica. Your questions and feedback help us improve!*
# Glossary of Terms
Source: https://docs.pacifica.fi/other/glossary-of-terms
**Auto-Deleveraging (ADL):** A last-resort mechanism that automatically reduces the profitable positions of opposing traders to help cover losses in extreme market conditions.
**Backstop Liquidation:** A process where, if orderbook liquidity is insufficient to liquidate a position via market orders, the position (and remaining collateral) is transferred to a dedicated vault that systematically closes it.\
\
**Candle:** A visual summary of the stock's price action within a period of time, displaying the opening, closing, high, and low prices. Pacifica's candlestick charts are powered by [TradingView](https://www.tradingview.com/symbols/BTCUSD/).
**Collateral:** Funds deposited into your account to secure open positions.
**Cross Margin:** A margin mode that uses your entire account balance to support all open positions, improving capital efficiency.
**Funding Rate:** A periodic fee, updated every hour, exchanged between long and short positions to keep the perpetual contract price aligned with the underlying spot market.
**Impact Price:** The average execution price calculated for a predefined notional amount from the orderbook, used to determine the Premium Index.
**Initial Margin:** The required collateral to open a position, calculated as the position size multiplied by the entry price, divided by the leverage.
**Isolated Margin:** A margin mode where each position is allocated its own specific collateral, limiting risk to that individual position.
**Liquidation:** The forced closure of a position when its margin falls below the required maintenance level.
**Maintenance Margin:** The minimum collateral that must be maintained to keep a position open, typically set at half of the initial margin.
**Maker Order:** An order that adds liquidity to the order book, such as a resting limit order.
**Oracle Price (Mark Price):** An aggregated price calculated from multiple external sources (weighted median from major centralized exchanges or TWAP from decentralized exchanges) used to determine margin requirements, funding fees, and liquidation thresholds.
**Premium Index:** A measure of the deviation between the Impact Price and the Oracle Price, used in funding rate calculations.
**Taker Order:** An order that removes liquidity by executing against existing orders in the order book.
**Time-In-Force (TIF):** The instruction that determines how long an order remains active (e.g., Good-Til-Cancelled, Immediate-or-Cancel, Add-Limit-Only).
**TWAP (Time-Weighted Average Price):** A method to calculate an average price over a specific period to mitigate the impact of market volatility on execution.
**Withdrawal Controls:** Mechanisms that restrict collateral withdrawals during periods of extreme volatility to ensure open positions remain adequately funded.
# Close Beta Guide
Source: https://docs.pacifica.fi/pacifica/close-beta-guide
[https://www.canva.com/design/DAGp110OV-w/sL4OUVxdMA\_5iul99P2c-A/edit](https://www.canva.com/design/DAGp110OV-w/sL4OUVxdMA_5iul99P2c-A/edit)
# About Us
Source: https://docs.pacifica.fi/pacifica/readme
Pacifica is the largest decentralized perpetuals exchange on Solana, expanding from a high-performance perp venue into a broader trading ecosystem.
Pacifica aims to deliver exceptional core trading performance through a seamless user experience, enhanced by AI-powered smart trading tools that make sophisticated strategies accessible to everyone. We're not just building faster infrastructure - we're reimagining how trading should feel.
Founded in January 2025, Pacifica launched mainnet after only six months in June 2025. Since launch, it has grown into one of the leading perp DEXs on Solana, processing over \$220 billion in cumulative perp volume - with approximately \$1 billion daily volume and over \$100 million in peak open interest.
Pacifica currently supports 65+ perpetual pairs spanning crypto majors, altcoins, RWAs, FX, pre-IPO, and more, with up to 50x leverage and a unified spot-and-collateral margining system. Beyond core perp trading, Pacifica now offers user-deployed Vaults, Swim (tap trading), and an AI Agent and World Monitor, creating a diversified trading ecosystem for retail users, professional traders, market makers, and builders.
From day one, Pacifica has offered CEX-standard APIs across REST and WebSocket, designed for low-latency execution and programmatic trading. We welcome market makers, HFT teams, trading communities, affiliates, and builders to scale atop Pacifica's liquidity and tech stack.
Our team brings together experience across crypto exchanges, HFT, traditional finance, and machine learning, with backgrounds spanning Binance, FTX, Coinbase, NFTperp, Jane Street, Fidelity, OpenAI, DeepMind, ByteDance, MIT, Stanford, NUS, and other leading institutions. This blend of traditional finance, crypto-native, and AI expertise positions us to solve the industry's core challenges: execution speed and quality, a seamless user experience, and intelligent automation at scale.
Pacifica has been self-funded throughout our journey. We haven't raised external capital, ensuring that all value created accrues directly to our users.
# Testnet Guide
Source: https://docs.pacifica.fi/pacifica/testnet-guide
[https://www.canva.com/design/DAGi6sRFjjo/7Vu9daOHcwah6M0A\_dwJLQ/edit?utm\_content=DAGi6sRFjjo\&utm\_campaign=designshare\&utm\_medium=link2\&utm\_source=sharebutton](https://www.canva.com/design/DAGi6sRFjjo/7Vu9daOHcwah6M0A_dwJLQ/edit?utm_content=DAGi6sRFjjo\&utm_campaign=designshare\&utm_medium=link2\&utm_source=sharebutton)
# Print
Source: https://docs.pacifica.fi/print
Print lets you earn yield while your orders wait to be filled. Instead of a limit order that sits idle until the market reaches it, a Print order pays you a daily payout for every day it waits — and still opens your position at the exact price you chose.
### How Print Works
You set a **target price** and a **direction**:
* **Print Long** — target price *below* the current market ("if BTC drops to X, I'll buy").
* **Print Short** — target price *above* the current market ("if BTC rises to X, I'll sell").
You lock a deposit as margin, pick your leverage, and the order goes live. From there you earn a payout every 24 hours while you wait. Your order isn't filled the moment the market touches your target — it's checked once at the end of each 24-hour block: if the market has reached your target by then, it fills at your target price; if not, it rolls into the next block and keeps earning.
### Print vs. Limit Orders
Like a limit order, you pick a side, a target price, and a leverage. What's different is everything about *waiting* and *filling*:
| | Limit order | Print order |
| ----------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- |
| Earn while waiting | No | Yes — a payout every 24 hours |
| When it can fill | The instant the market touches your price, any time | Only at the **end of each 24-hour block** |
| Fill price | Your limit price | Your target price |
| If the price never reaches it | Rests unchanged until you cancel | Auto-rolls to a new target at the same % distance, and keeps earning |
| Capital while waiting | Reserved, earns nothing | Locked as margin, and earns yield every cycle |
| Cancelling | Removed immediately | Resolves at the end of the current 24-hour block |
The most important difference: a limit order fills the moment price touches it. **A Print order only checks at the end of each 24-hour block.** If the market dips to your target intraday and bounces back, a limit order would have filled — a Print order does not. It only fills if the market has reached or passed your target *at the 24-hour mark*.
### In This Section
* [Placing & Managing Orders](/print/placing-and-managing-orders) — the inputs you set, and how to cancel or withdraw.
* [The 24-Hour Cycle](/print/the-24-hour-cycle) — how fills and roll-overs work.
* [Yield](/print/yield) — how your payout is calculated and what drives it.
* [Margin & Liquidation](/print/margin-and-liquidation) — leverage, liquidation price, and your maximum loss.
* [Examples](/print/examples) — worked scenarios with real numbers.
* [Specifications](/print/specifications) — limits and parameters at a glance.
* [FAQ](/print/faq) — common questions.
# Examples
Source: https://docs.pacifica.fi/print/examples
**Example 1 — A Print Long that rolls over, then fills.**
BTC is at 70,000. You place a Print Long with a **\$100 deposit**, **10× leverage**, and a **target of 69,000** (about 1.43% below market). If it fills, your position size is about **0.0145 BTC** — a \$1,000 notional (`100 × 10 ÷ 69,000`).
* **Day 1.** The order goes live and you're paid the block's yield (the exact amount depends on market conditions). Over the next 24 hours BTC dips to 69,200 intraday but never trades at or below 69,000 *at the checkpoint*. At the 24-hour mark BTC is 70,500 → **no fill**. The order rolls over to a new target the same \~1.43% below 70,500 ≈ **69,500**. The yield you earned stays in the account, and the order runs into the next block.
* **Day 2.** BTC drifts down. At the next 24-hour mark it's 69,300 — at or below your 69,500 target → **fill**. You open a \~0.0144 BTC long at exactly **69,500**, funded by your deposit plus every payout you accrued. From here it's an ordinary 10× long.
The intraday dip on Day 1 didn't fill you, you kept all the yield, and you entered at your target price rather than a random intraday level.
**Example 2 — A Print Short.**
BTC is at 70,000. You place a Print Short with a **\$200 deposit**, **5× leverage**, and a **target of 71,500** (about 2.1% above market). Position size if filled: about **0.014 BTC** (`200 × 5 ÷ 71,500`). Each 24-hour block pays you a yield. If BTC is at or above 71,500 at a checkpoint, you open a short at 71,500; otherwise the target rolls to the same \~2.1% above the new market price and you keep earning.
**Example 3 — Leverage changes both your yield and your liquidation price.**
Same Print Long (target 69,000, \$100 deposit), before any yield has accrued:
| Leverage | Position size | Notional | Liquidation price |
| -------- | ------------- | -------- | ----------------- |
| 2× | 0.0029 BTC | \$200 | \~34,500 |
| 10× | 0.0145 BTC | \$1,000 | \~62,100 |
| 20× | 0.0290 BTC | \$2,000 | \~65,550 |
Higher leverage pays more yield, but the liquidation price climbs toward your 69,000 target — at 20× the market only has to fall about 5% below your target to wipe the position. (Earned yield adds to your margin, so each cycle nudges the liquidation price a little further away.)
# FAQ
Source: https://docs.pacifica.fi/print/faq
**BTC and ETH.** Both run the same 24-hour cycle, the same 1× to 20× leverage range, and the same 0.5%–10% target distance. What differs is the global cap on how much total Print notional each market can hold: \$5,000,000 on BTC and \$2,000,000 on ETH. ETH is the newer market and starts with the smaller cap. When a market is at its cap, new Print orders in it are rejected until existing ones resolve — the other market is unaffected.
No. A Print order is only checked at the **end of each 24-hour block**. If the price touches your target intraday but isn't past it at the 24-hour mark, you don't fill — the order rolls over. This is the biggest difference from a normal limit order, which fills the instant the market touches it.
Always your **target price**, not the market price at the checkpoint. If BTC is below your long target at the 24-hour mark, you still open at the target price.
Yes to both. Yield is paid each block and is already yours: it funds your position when the order fills, or it comes back with your deposit when you cancel. The only way to lose accrued yield is liquidation.
No. The most you can lose is your deposit plus the yield it has earned — everything in the Print account, and nothing beyond it.
The rate is recalculated every cycle from current market conditions — how far your target sits from the market and how much the market is moving. Every roll-over re-prices at the new market, so your APY moves over time.
There's no in-place edit. Cancel the order — it resolves at the end of the current 24-hour block — and place a new one with the settings you want.
It becomes an ordinary leveraged position opened at your target price. From then on it follows normal perp rules: you can close it, add margin, or be liquidated like any other position.
The two numbers measure different things, and this is not an error. Your Print order's leverage (1× to 20×) is what actually sets your position's **size and margin** — those are locked in when you place the order and don't change at fill. When the order fills, the position opens in your main perps account, and the leverage shown there is your **account's leverage setting for that market** (for example, 50× is the default on both BTC and ETH). That setting governs regular perp trading in your account; it doesn't enlarge the position your Print order opened. Your size, entry price, and margin are exactly what your Print order specified — nothing bypassed the 20× cap.
Liquidation is only evaluated at a 24-hour checkpoint. If, at that point, the market has run past your liquidation price (which sits beyond your target), the order is liquidated and the margin is lost. Intraday spikes that recover before the checkpoint don't liquidate you.
A Print order — and a cancellation — always resolves at the end of the current 24-hour block, not instantly. Once it resolves, your funds return to your main trading balance and you can withdraw them.
Yes. Placing a Print order moves the deposit into that order as locked margin, and each order is its own bucket. It returns to your main balance when the order resolves.
# Margin & Liquidation
Source: https://docs.pacifica.fi/print/margin-and-liquidation
Once a Print order fills, it becomes a normal leveraged position and can be liquidated — so leverage cuts both ways. Concepts like size, margin, and liquidation price work the same as regular perp trading.
The most you can lose is everything in the Print account — **your deposit plus the yield it has earned. You can never lose more than that.**
```
max loss = deposit + yield earned
position size = deposit × leverage / target price
Long liquidation price = target − (deposit + yield) × target / (leverage × deposit)
Short liquidation price = target + (deposit + yield) × target / (leverage × deposit)
```
In practice the liquidation price sits roughly `target ÷ leverage` away from your target, on the losing side. **Higher leverage moves the liquidation price closer to your target — more yield, but more risk.**
Two things that differ from a normal position:
* **Liquidation is only checked at the 24-hour mark, not intraday.** If the mark price is beyond your liquidation price at the end of a block, the order is liquidated and the margin is lost. Intraday moves that recover before the checkpoint do not liquidate you.
* **No maintenance margin while resting.** Before a Print order fills, there's nothing to top up — the deposit is the whole risk.
# Placing & Managing Orders
Source: https://docs.pacifica.fi/print/placing-and-managing-orders
### Placing an Order
You choose:
* **Market** — BTC or ETH. Each market has its own global cap on total open Print notional (see [Specifications](/print/specifications)).
* **Direction** — Long or Short.
* **Target price** — between **0.5% and 10%** away from the current mark price.
* **Leverage** — **1× to 20×**.
* **Deposit** — your locked margin, minimum **\$10**. This is drawn from your Pacifica trading balance.
Your order's notional is set by your deposit and leverage:
```
notional = deposit × leverage
position size = notional / target price
```
There's no in-place edit once an order is live. To change your target or leverage, cancel the order and place a new one.
### Cancelling & Withdrawing
Cancelling a Print order sends an "end" request, but the order **stays active until the end of the current 24-hour block.** At that checkpoint it resolves one last time: it either fills (if the market reached your target) or returns your deposit to you. Either way, you still earn that block's payout — cancelling never forfeits yield already in progress.
When an order fills, closes, or is cancelled, your funds — the deposit plus earned yield, or the position it opened — return to your main Pacifica trading balance. Each Print order is its own margin bucket, separate from your other balances until it resolves.
# Specifications
Source: https://docs.pacifica.fi/print/specifications
Current Print limits and parameters:
| Parameter | Value |
| ------------------------- | ------------------------------------------------------- |
| Markets | BTC, ETH |
| Cycle length | 24 hours |
| Leverage | 1× to 20× |
| Target distance from mark | 0.5% (tightest) to 10% (widest) |
| Minimum deposit | \$10 |
| Fill price | Your exact target price |
| Settlement | Evaluated once per 24-hour checkpoint |
| Yield crediting | At the start of each cycle; added to your locked margin |
| Trading fee on yield | None |
Global limits are set per market:
| Market | Global position limit | Equivalent deposit limit at 20× |
| ------ | --------------------- | ------------------------------- |
| BTC | \$5,000,000 | \$250,000 |
| ETH | \$2,000,000 | \$100,000 |
A few notes:
* **Distance is measured from the mark price** at the moment you place — 0.5% is the closest you can set your target, 10% the furthest.
* **The global position limit is a cap on notional** (`deposit × leverage`) across every open Print order in that market, not a per-order limit. Once a market sits at its cap, new Print orders there are rejected until existing ones resolve.
* **ETH is new to Print** and starts with a lower cap than BTC. Caps are reviewed as each market matures.
* **Once filled, a Print position follows standard perp rules** — normal margin, mark-price liquidation, and fees apply to the position from that point on.
* These values may change.
# The 24-Hour Cycle
Source: https://docs.pacifica.fi/print/the-24-hour-cycle
Print orders run in fixed 24-hour blocks. At the end of every block, exactly one of two things happens\*:
* **Fill** — if the mark price has reached or passed your target, your order fills at the **target price** and you now hold a normal leveraged position.
* **Roll over** — if it hasn't, the order automatically renews for another 24 hours at a **new target the same % distance from the new market price**, and keeps earning.
You earn the **full payout for the block no matter which outcome occurs.**
A limit order fills the instant the market touches it; a Print order is only evaluated at these 24-hour checkpoints. An intraday move to your target that reverses before the checkpoint does **not** fill your order.
### Roll-over Example
You open a Print Long when BTC is at 70,000 with a target of 69,000 (about 1.43% below). After 24 hours BTC is at 70,500 and your order hasn't filled, so it rolls over. The new target is set to the same \~1.43% distance from 70,500 — roughly **69,500**. The yield you earned stays in the account and carries into the next block.\
\
*\*If the order is not liquidated or cancelled.*
# Yield
Source: https://docs.pacifica.fi/print/yield
Your payout is paid at the start of each cycle by the Print liquidity pool and credited straight to your order, where it stays as part of your locked margin rather than being paid out. It is shown as an annualized **APY**.
Each cycle's payout is sized from your **original deposit** and current market conditions — it isn't calculated on the yield you've already banked, so payouts don't snowball. What the banked yield *does* do is add to your margin, which nudges your liquidation price a little further from your target each cycle.
Three things push your yield up:
* **Conviction (target distance).** The closer your target is to the current market price, the higher the yield — you're more likely to fill, so the pool pays you more to wait.
* **Leverage.** More leverage means a larger position, which means a larger payout.
* **Market volatility.** The more the market is moving, the larger the payout.
No trading fee is taken out of your yield. The protocol applies an internal floor and ceiling to the rate, so the very tightest targets don't pay disproportionately.
Your APY isn't fixed. It's recalculated every cycle from current market conditions, and every roll-over re-prices at the new market — so expect it to move over time.
# Bug Bounty Program
Source: https://docs.pacifica.fi/programs/bug-bounty-program
Pacifica is committed to maintaining the highest standards of security. We invite security researchers to identify and disclose vulnerabilities in a constructive and responsible manner and help us protect our users, infrastructure, and ecosystem.
## Pacifica Bug Bounty Program Rules
1. Please submit a clear and detailed report with reproducible steps via email to [ops@pacifica.fi](mailto:ops@pacifica.fi) or open a ticket on Pacifica's [Discord](https://discord.gg/pacifica).
2. If we cannot reproduce the issue from your submission, it will not qualify for a reward.
3. Social engineering attacks (e.g., phishing) against Pacifica employees or community members are strictly prohibited.
4. Please make a good faith effort to avoid privacy violations, data loss, service degradation, or interruptions.
5. Actions that negatively impact the availability of Pacifica services (e.g., DoS/DDoS) are not allowed.
6. The bug bounty does not pay-out any attacks that directly disrupt services.
**Testnet Guidelines**
* If you wish to test asset-related features, please do so on the Pacifica testnet at [https://test-app.pacifica.fi/trade/BTC](https://test-app.pacifica.fi/trade/BTC)
* For testnet only vulnerabilities not reproducible on mainnet, bounty level will be lowered
* Not all testnet features are eligible for the program (newly deployed features known by the team to be unstable, for example)
* Reach out to the team at [ops@pacifica.fi](mailto:ops@pacifica.fi) or on [Discord](https://discord.gg/pacifica) for more on using the Pacifica testnet
***
### Bug Bounty Vulnerability Levels
| Level | Bounty |
| :------: | :----------------: |
| Critical | 10,000-25,000 USDC |
| High | 2,500-10,000 USDC |
| Medium | 500-2,500 USDC |
| Low | 500 USDC |
**How are the various levels of bugs/vulnerabilities defined?**
To ensure consistent triage and fair rewards, vulnerabilities are classified into **Critical, High, Medium, and Low** categories. The following descriptions serve as a guide, and are not exhaustive:
#### Critical Vulnerabilities
Critical issues directly compromise Pacifica's **core systems, infrastructure, or smart contracts** in ways that could result in the safety of user deposits or core systems on Pacifica being compromised.
#### High-Risk Vulnerabilities
High-risk issues compromise system integrity, sensitive data, or critical business logic, but with limited impact relative to Critical Vulnerabilities.
#### Medium-Risk Vulnerabilities
Medium-risk issues impact user accounts, degrade service, or allow targeted exploitation, but do not put the entire system or core contracts at risk.
#### Low-Risk Vulnerabilities
Low-risk issues generally require user interaction, have limited impact, or only reveal non-critical information.
***
### Submission Process
* Consolidate your findings neatly in writing that includes the following:
* A clear description of the bug/issue.
* Step-by-step instructions on reproducing the issue on our end.
* Proof-of-concept (PoC) or exploit script (if applicable).
* Send reports to: [ops@pacifica.fi](mailto:ops@pacifica.fi) (flag any such reports as \[important] or \[urgent]).
* Alternatively, reach out to the team on [Discord](http://discord.gg/pacifica) by opening a ticket.
* Include impact assessment and suggested remediation steps
* Provide screenshots, videos, or other evidence to support your findings if applicable
**Important Guidelines:**
* If the same vulnerability is reported by multiple researchers, the first complete submission will be rewarded
* Submit one vulnerability per report, unless chaining vulnerabilities is necessary to demonstrate real impact.
* Multiple vulnerabilities that stem from a single root cause will be treated as one bounty.
* Rewards are paid in USDC to the submitter's Pacifica account for responsible disclosure of bugs after assessment by the Pacifica team.
* All research must be conducted ethically and responsibly in accordance with the rules of the Pacifica bug bounty program.
***
### Prohibited Activity
**The following activities are strictly prohibited, and will result in a report becoming ineligible for the bug bounty and/or further investigation and legal action.**
* Direct testing on the Pacifica mainnet in a manner that results in/may result in service disruption or data loss. All attempts must be done on Pacifica Testnet.
* Any phishing, social engineering, or physical security attacks.
* Denial-of-Service (DoS) or large-scale DDoS attacks.
* Testing third-party apps (SSO providers, wallets, browser extensions) outside Pacifica's control.
* Violating user privacy or accessing accounts belonging to others without consent.
* Public disclosure of vulnerabilities prior to their resolution without consent or authorization.
* Threats, ransom demands, or publishing sensitive data without consent.
* Exploiting vulnerabilities for personal financial gain beyond bug bounty rewards.
***
### Eligibility
* Reports must be submitted to the Pacifica team directly via email or Discord. Others are not accepted.
* You must comply with KYC verification to be eligible for any bug bounty rewards and to be able to receive USDC payouts on Pacifica.
* You must maintain strict confidentiality about discovered vulnerabilities until authorized disclosure.
#### The Following Are NOT Eligible for the Bug Bounty Program
* UI/UX bugs without security implications.
* Reports without sufficient detail, reproducible steps, or PoC.
* Vulnerabilities requiring highly improbable user actions, unrealistic market conditions or social engineering.
* Issues in outdated browsers, plugins, or operating systems not supported by Pacifica.
* Vulnerabilities requiring physical access to user devices.
* Bugs in third-party libraries or services that don't create direct risk to Pacifica users.
* Non-security related bugs such as cosmetic issues or minor functional problems.
* Theoretical vulnerabilities without demonstrable security impact.
***
All submissions must meet program requirements to be eligible for rewards. Pacifica reserves full discretion in classifying reported issues and determining payout amounts. By submitting a report, you acknowledge that it becomes the property of Pacifica, and we may use, modify, or disclose the information as necessary to improve the security of our platform.
In return, Pacifica is committed to treating researchers with respect and fairness. We will investigate all valid reports promptly, provide clear reasoning behind our classifications, and reward based on the severity of the issue. Most importantly, we will pursue legal action against those who do not conduct research in good faith.
# Builder Program
Source: https://docs.pacifica.fi/programs/builder-program
Pacifica's builder program allows third-party developers ("builders") to earn fees for orders they send on behalf of the users. These must be **approved by the user** before they can be used on any order. Once approved, the builder may include the code in any supported order creation request. Users can revoke access at any time.
Builder codes affect only Pacifica's order fee logic and are fully verified by the API according to user approval, fee limits, and builder configuration.\
\
We're setting aside **up to a total of 10,000,000 points** to reward teams building on Pacifica's Builder Program.
**Builder Program Rewards** will be distributed based on each team's contribution to Pacifica's growth. To ensure fairness and meaningful impact within the ecosystem, an evaluation process will be conducted. Only teams that make significant contributions to Pacifica's development will be eligible to receive point rewards.
### Step 1: Request User Authorization
Request the user to authorize placing orders with your builder code by prompting them to sign an approval request containing your builder code as `builder_code` and the additional fee rate you want to charge as `max_fee_rate`.
**Important:** The user's `max_fee_rate` must be greater than or equal to your builder's `fee_rate`. If they set a lower value, orders will be rejected.
**Data to be Signed**
To approve a builder code, the user signs:
```json theme={null}
{
"timestamp": ,
"expiry_window": 5000,
"type": "approve_builder_code",
"data": {
"builder_code": "YOUR_CODE",
"max_fee_rate": "0.001"
}
}
```
After following the [signing implementation](/api-documentation/api/signing/implementation), compact and sort this payload recursively to generate the signature.
**Complete Payload (After Signing)**
```
{
"account": "6ETn....",
"agent_wallet": null,
"signature": "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ5xHQFMJkZWE8J5VyA",
"timestamp": 1748970123456,
"expiry_window": 5000,
"builder_code": "YOUR_CODE",
"max_fee_rate": "0.001"
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/account/builder_codes/approve`
**Check User Approvals (Optional)**
You can query which builder codes a user has approved:
**Endpoint:** `GET https://api.pacifica.fi/api/v1/account/builder_codes/approvals?account=6ETn....`
**Response:**
```
[
{
"builder_code": "YOUR_CODE",
"description": "Test Builder Integration",
"max_fee_rate": "0.001",
"updated_at": 1748970123456
}
]
```
**Revoke Builder Code Authorization (Optional)**
Users can revoke authorization at any time:
**Data to be Signed**
```
{
"timestamp": 1748970123456,
"expiry_window": 5000,
"type": "revoke_builder_code",
"data": {
"builder_code": "YOUR_CODE"
}
}
```
**Complete Payload (After Signing)**
```
{
"account": "6ETnufiec2CxVWTS4u5Wiq33Zh5Y3Qm6Pkdpi375fuxP",
"agent_wallet": null,
"signature": "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ5xHQFMJkZWE8J5VyA",
"timestamp": 1748970123456,
"expiry_window": 5000,
"builder_code": "YOUR_CODE"
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/account/builder_codes/revoke`
### **Step 2: Include Builder Code in Order Creation Requests**
All order creation requests may now include your builder code in the `builder_code` parameter. Update the following endpoints:
**REST API:**
* `POST /api/v1/orders/create_market`
* `POST /api/v1/orders/create`
* `POST /api/v1/orders/stop/create`
* `POST /api/v1/positions/tpsl`
**WebSocket:**
* `create_market_order`
* `create_limit_order`
* `create_stop_order`
* `set_position_tpsl`
**Example: Create Market Order with Builder Code**
**Data to be Signed**
```
{
"timestamp": 1716200000000,
"expiry_window": 30000,
"type": "create_market_order",
"data": {
"symbol": "BTC",
"amount": "0.1",
"side": "bid",
"slippage_percent": "0.5",
"reduce_only": false,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"builder_code": "YOUR_CODE"
}
}
```
**Complete Payload (After Signing)**
```
{
"account": "6ETnufiec2CxVWTS4u5Wiq33Zh5Y3Qm6Pkdpi375fuxP",
"agent_wallet": null,
"signature": "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ5xHQFMJkZWE8J5VyA",
"timestamp": 1716200000000,
"expiry_window": 30000,
"symbol": "BTC",
"amount": "0.1",
"side": "bid",
"slippage_percent": "0.5",
"reduce_only": false,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"builder_code": "YOUR_CODE"
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/orders/create_market`
**Example: Create Limit Order with Builder Code**
**Data to be Signed**
```
{
"timestamp": 1716200000000,
"expiry_window": 30000,
"type": "create_order",
"data": {
"symbol": "BTC",
"amount": "0.1",
"side": "bid",
"tick_level": 1000,
"tif": "gtc",
"reduce_only": false,
"client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"builder_code": "YOUR_CODE"
}
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/orders/create`
**Example: Set Position TP/SL with Builder Code**
**Data to be Signed**
```
{
"timestamp": 1716200000000,
"expiry_window": 30000,
"type": "set_position_tpsl",
"data": {
"symbol": "BTC",
"side": "bid",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950",
"client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479"
},
"builder_code": "YOUR_CODE"
}
}
```
**Complete Payload (After Signing)**
```
{
"account": "6ETnufiec2CxVWTS4u5Wiq33Zh5Y3Qm6Pkdpi375fuxP",
"agent_wallet": null,
"signature": "5j1Vy9UqYUF2jKD9r2Lv5AoMWHJuW5a1mqVzEhC9SJL5GqbPkGEQKpW3UZmKXr4UWrHMJ5xHQFMJkZWE8J5VyA",
"timestamp": 1716200000000,
"expiry_window": 30000,
"symbol": "BTC",
"side": "bid",
"take_profit": {
"stop_price": "55000",
"limit_price": "54950",
"client_order_id": "e36ac10b-58cc-4372-a567-0e02b2c3d479"
},
"stop_loss": {
"stop_price": "48000",
"limit_price": "47950",
"client_order_id": "d25ac10b-58cc-4372-a567-0e02b2c3d479"
},
"builder_code": "YOUR_CODE"
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/positions/tpsl`
**Note:** `builder_code` is provided only at the top level for TP/SL creation, not within individual `take_profit` or `stop_loss` objects.
### Implementation Notes
* **Signature Generation:** Follow the standard [signing implementation](/api-documentation/api/signing/implementation) for all requests
* **Builder Code Placement:** The `builder_code` must be included in the `data` object when creating the payload to be signed
* **Recursive Sorting:** All JSON keys must be recursively sorted alphabetically before creating the compact JSON string
* **Timestamps:** All times are in milliseconds
* **Expiry Window:** Defaults to 30 seconds (30,000 ms) if not specified
* **Backwards Compatibility:** The `builder_code` field is optional on all order creation endpoints
* **Validation:** Orders with builder codes will be rejected if:
* The builder code doesn't exist
* The user hasn't approved the builder code
* The user's `max_fee_rate` is less than the builder's `fee_rate`
### Update Builder Code Fee Rate
Update the fee rate for your builder code. This endpoint is for builder account owners to change the fee they charge on orders sent with their builder code.\
\
**Request User Authorization (Sign & Send)**\
Builder account owner to sign an update containing the builder code and the new fee rate.
**Data to be Signed**
```
{
"timestamp": ,
"expiry_window": 5000,
"type": "update_builder_code_fee_rate",
"data": {
"builder_code": "YOUR_CODE",
"fee_rate": "0.05"
}
}
```
**Complete Payload (After Signing)**
```
{
"account": "6ETn....",
"agent_wallet": null,
"signature": "5j1V.....",
"timestamp": 1748970123456,
"expiry_window": 5000,
"builder_code": "YOUR_CODE",
"fee_rate": "0.05"
}
```
**Endpoints:** `POST https://api.pacifica.fi/api/v1/builder/update_fee_rate`
### Referral Code Claim
Users can claim a referral code to establish a referral relationship with the code's owner.
#### How It Works
**Step 1: Request User Authorization**
Request the user to authorize claiming a referral code by prompting them to sign an approval request containing the referral code.
**Data to be Signed**
```
{
"timestamp": ,
"expiry_window": 5000,
"type": "claim_referral_code",
"data": {
"code": "YOUR_CODE"
}
}
```
After following the signing implementation, compact and sort this payload recursively to generate the signature.
**Complete Payload (After Signing)**
```
{
"account": "6ETn....",
"agent_wallet": null,
"signature": "5jHM.....",
"timestamp": 1748970123456,
"expiry_window": 5000,
"code": "YOUR_CODE"
}
```
**Endpoint:** `POST https://api.pacifica.fi/api/v1/referral/user/code/claim`
### **Useful Endpoints**
* User trade history via specific builder code: `https://api.pacifica.fi/api/v1/trades/history?account=[WALLET_ADDRESS]&builder_code=[BUILDER_CODE]`
* Builder Code Specifications: `https://api.pacifica.fi/api/v1/builder/overview?account=[WALLET_ADDRESS]`
* Builder Trade History: `https://api.pacifica.fi/api/v1/builder/trades?builder_code=[BUILDER_CODE]`
* Builder Code User Leaderboard: `https://api.pacifica.fi/api/v1/leaderboard/builder_code?builder_code=[BUILDER_CODE]`
### Error Handling
**Common Error Codes:**
* `403 Unauthorized`: User hasn't approved the builder code or `max_fee_rate` is too low
* `404 Not Found`: Builder code doesn't exist
* `400 Bad Request`: Invalid builder code format (must be alphanumeric, max 16 characters)
### Full Details and Onboarding
For more Pacifica Builder Program specs and details, as well as to onboard to the program, please reach out to us at [ops@pacifica.fi](mailto:ops@pacifica.fi), open a support ticket on our [Discord](http://discord.gg/pacifica) or text @PacificaTGPortalBot on Telegram.
# Educators Program
Source: https://docs.pacifica.fi/programs/educators-program
The **Educators Program** has been **discontinued** until further notice. We will review all submissions up to date and will share more details regarding winning submissions soon.
Thanks to everyone who has participated!\
\
Winning submissions will be announced on our Discord: [discord.gg/pacifica](https://t.co/mJbPQx0UY7)
# Market Maker Program
Source: https://docs.pacifica.fi/programs/market-maker-program
### Program Overview
The Pacifica Market Making program exists to ensure a healthy marketplace, benefitting traders with tight spreads and deep liquidity.
The program aims to foster a fair and open competitive environment, where Liquidity Providers are able to earn rewards proportional to their relative contributions to these goals.
In order to assist in liquidity provisioning, MM program participants enjoy the following:
* Zero fees on maker fills
* Greatly increased rate-limits
* Increased deposit caps
### Eligibility
All users of Pacifica Exchange are eligible to participate in the Market Making program. Opt-in is required in order to set up reporting channels and apply for zero-maker-fee grace periods while ramping up.
To qualify for rewards beyond the initial program launch assessment period, an eligible Market Maker must meet the minimum requirement of X% of the Total MakerScore for the relevant period\
\
This amount will be determined soon, and is subject to change over time based on liquidity conditions on Pacifica.
### Scoring
Participants in the Pacifica Market Making program are scored and rewarded based on the following criteria. For full details, please reach out to Pacifica Institutional (see below):
* Maker Volume
* Pairs Traded
* Quote spread and depth
* Quote uptime
### Rewards
After the Market Maker's score is calculated for each assessment period, trading rewards for the period can be received in the form of points OR cash, and makers can choose a combination of the two.
The USD pool available to be distributed each period is calculated as:\
12% of total trading fees collected from all market maker counterparties.
The Points pool to be distributed each period is 2,000,000 points (1,000,000/week)
### Additional Specs
* MM accounts earn points as per the regular points program for all non-maker activity
* MM accounts pay regular taker fees based on total trading volume.
* MM accounts and subaccounts are ineligible for participation in exchange-wide trading competitions unless otherwise specified.
* Weekly reports will be sent summarizing maker performance.
* Maker rewards will be sent during points distributions every 14 days.
### Full Details and Application
For full Pacifica Market Making Program specs and details, as well as to apply to be part of the program, please reach out to us at [ops@pacifica.fi](mailto:ops@pacifica.fi) or open a ticket at [discord.gg/pacifica](https://discord.gg/pacifica)
Note: Pacifica monitors all trading activities closely. We do not tolerate market manipulation or abusive trading activities of any kind. If we suspect a participant to be in violation, we reserve the right to modify or deny their rewards entirely. Pacifica reserves the right to modify aspects of the Market Maker Program based on changing market and liquidity conditions.
# Points Program
Source: https://docs.pacifica.fi/programs/points-program
The Pacifica Points program launched on Thursday, September 4th at 00:00 UTC. Each week:
* Snapshots are taken every Thursday at 00:00 UTC
* Distributions occur within 24 hours of each snapshot
* Weekly allocation: 10,000,000 points distributed weekly among eligible Pacifica users
Earn points by engaging in organic trading activities on Pacifica via GUI or API. Self-trading, sybil or any other manipulative activities will not earn points.
### FAQ
#### What Is the Pacifica Points Formula?
The formula is dynamic and opaque by design, updated weekly as usage evolves.
#### What Activities Earn Points?
Many activities are tracked by our points program, and attribution for different activities may happen immediately or be applied over-time over several distributions.
#### Who Knows the Details of the Points Program?
Very few Pacifica team members. Only Pacifica's community members are eligible to earn points in order to ensure fairness and prevent abuse.
#### Do People With Multiple Accounts Have an Advantage Over Me?
No. Discrete or costless actions do not yield rewards in isolation. Having 100 accounts provides no advantage over one.
#### Do Early Users Have an Advantage?
Pacifica's points program is structured to balance both early supporters and long-term contributors fairly.
#### Can I Buy Points?
No. There was no prior allocation and there is no way to purchase points. They can only be earned by trading, providing feedback, and spreading the word.
#### Can I Trade Points on Secondary Markets?
While Pacifica cannot/will not actively police this, we do not condone any such activity and strongly discourage this for security reasons.
# Referral and Affiliate Program
Source: https://docs.pacifica.fi/programs/referral-and-affiliate-program
### Referrals
Once you have generated \$10,000 in volume, you will be able to generate a referral link on [app.pacifica.fi/referral](https://app.pacifica.fi/referral), and share it with others to use in order to sign into Pacifica as your referee.
Referrers receive 10% of the points generated by their referred users.
* Referees will receive a 5% point bonus
* Fee and point rewards are automatically credited to the referrer account alongside the weekly points distribution, based on the referred users' trading activity.
* There is no application process required. Every user can generate their unique referral link directly from their account dashboard after reaching the \$10,000 volume threshold.
NOTES: Pacifica's referral portal updates once every 15 minutes. If you have recently reached the \$10,000 threshold or have recently referred friends, please wait up to 15 minutes before they appear in your portal.\
\
**How do I use a referral code?**
After creating a new wallet and joining Pacifica, navigate to the top-right corner and open the referral section. There, you'll be prompted to enter a referral code. By using a referral code during signup, your account will be linked as a referee to the user who generated that code.
**How do I create a referral link?**\
\
At the top part of the referral page ([app.pacifica.fi/referral](https://app.pacifica.fi/referral)), you will see the "Generate Referral Link" button. Once you click it, you will be prompted to enter your preferred referral name. Once you have done that, you will be able to copy and paste the link. This will allow people to join Pacifica as your referral by just clicking it.
**How do I use a referral link?**\
\
When joining Pacifica on a fresh wallet, through a referral link you will be prompted to connect your wallet, and then claim the referral code as shown below. Using a referral link to sign up to Pacifica will attach your account as a referee to the generator of the referral link. The referral will directly use up the amount of codes you have available. In order to claim a referral code you must deposit.
### Affiliates
Pacifica Affiliates receive fee share **incentives of up to 40%** from their referees. Spots in the Pacifica Affiliate program are limited, and participation is a selective process based on the Pacifica team's discretion.
The fee share an affiliate earns from referrals scales with the total volume their referred users generate, allowing affiliates to unlock higher percentages as they bring more value to the platform.
If you believe that you have a large trading community that is interested in trading on Pacifica, please open a ticket at [discord.gg/pacifica](https://discord.gg/pacifica) for additional information.
#### Exceptions to Referrals and Affiliate Rewards
Referee accounts that become part of Pacifica's market maker program will no longer provide cash reward to their referrers.
# VIP Program
Source: https://docs.pacifica.fi/programs/vip-program
Want to carry over your trading tier from other exchanges?
If you've traded on other exchanges, you can verify your past 30 day trading volume and receive the equivalent VIP fee tier on Pacifica for 30 days.
How to get started:
1. Open a support ticket on our [Discord](http://discord.gg/pacifica) or text @PacificaTGPortalBot on Telegram; let us know you want to verify your volume and join the VIP Program.
2. Our team will guide you through a verification process to prove ownership.
3. Once verified, your external trading volume will be mapped to the appropriate Pacifica VIP tier, and your VIP fee tier will be active for the following 30 days.
Notes:
* Each Pacifica account can link only one external wallet for this VIP tier match.
Enjoy your VIP benefits on Pacifica and thank you for trading with us!
# Deposit/Withdrawal
Source: https://docs.pacifica.fi/support/deposit-withdrawal
### Deposits
**Supported asset:**
* Please deposit USDC on **Solana** only
Deposits sent via any other network or token (e.g., Ethereum, Arbitrum, USDT, SOL) will not be credited.
**Minimum deposit:**
* 10 USDC
Deposits below 10 USDC will not be automatically credited. You may send additional USDC to the same address to reach the minimum.
Deposits are usually credited within minutes, but may be delayed due to:
* Solana network congestion
* RPC instability
* Temporary infrastructure load
Always verify the transaction on a Solana block explorer before contacting support.
***
### Withdrawals
Withdrawals are processed via **USDC on Solana** only.
Your Solana wallet must:
* Have a valid USDC token account
If you encounter an error, ensure there is a **non-zero amount of USDC** already in your wallet to initialize the token account, then retry.
Withdrawal delays may occur during periods of Solana network congestion.
***
### Important
We highly recommend depositing and withdrawing directly through the Pacifica front-end to avoid errors.
Before sending funds:
* Double-check the network (Solana)
* Confirm the token is USDC
* Consider sending a small test transaction for large transfers
If issues persist, contact support with your transaction signature (TXID) and relevant details.
# Mobile App Account Deletion
Source: https://docs.pacifica.fi/support/mobile-app-account-deletion
To request deletion of your Pacifica Mobile account, join the [Pacifica Discord](https://discord.com/invite/dxddmceu4C) and open a support ticket.
In your ticket, please include the wallet address associated with your account so the team can identify the correct account. Do not include private keys, seed phrases, passwords, or other sensitive wallet credentials.
After your request is reviewed, Pacifica will delete or de-identify account and personal data that is no longer needed to provide the service. Some records may be retained where required for legal, security, anti-fraud, accounting, compliance, dispute-resolution, or regulatory purposes.
On-chain wallet activity is public blockchain data and cannot be deleted by Pacifica.
For privacy, compliance, or mobile app support questions, open a support ticket in the [Pacifica Discord](https://discord.com/invite/dxddmceu4C).
# Recover Assets After Reown to Privy Migration
Source: https://docs.pacifica.fi/support/recover-assets-after-reown-to-privy-migration
Pacifica has migrated its embedded/social login flow from Reown to Privy.
If you originally used **Reown social login** to access Pacifica, your assets are still controlled by the same on-chain wallet. To regain direct control of that wallet, you need to export the wallet's private key from Reown and import it into a wallet you control.
This guide is only for **legacy Reown social login users**. If you originally connected a self-custody wallet such as Phantom, Solflare, Backpack, or Ledger, you do not need this recovery flow.
> **Important:** Never share your private key with anyone, including Pacifica support. Only export it from Reown's official site, and store it securely offline.
## Official Reown Recovery Page
Use Reown's official secure recovery page: [https://secure.reown.com/](https://secure.reown.com/)
## Video Walkthrough
[https://www.youtube.com/watch?v=sdaX-H1bgv4](https://www.youtube.com/watch?v=sdaX-H1bgv4)
## What This Process Does
The walkthrough shows how to:
1. Sign back into Reown using the same social login you used previously.
2. Export the private key for the wallet created under the old Reown flow.
3. Import that private key into a self-custodial Solana wallet.
4. Use that wallet to access, manage, or withdraw the same assets.
## Step-by-Step Summary
1. Go to Reown's secure recovery page at [https://secure.reown.com/](https://secure.reown.com/) and sign in with the same social account you previously used on Pacifica.
2. Open the wallet management flow and export the wallet's private key.
3. Store the private key securely before leaving the page.
4. Import that private key into a supported self-custodial Solana wallet.
5. Use the imported wallet to access the same on-chain assets and reconnect to Pacifica if needed.
## Need Help?
If you run into issues during this process, contact support and include:
* The social login method you originally used
* Whether you can still access that same social account
* A screenshot of any error or blocked step
# Trade Outcomes
Source: https://docs.pacifica.fi/support/trade-outcomes
Common questions about how positions are closed on Pacifica.
* [Why was I Liquidated?](/support/trade-outcomes/why-was-i-liquidated)
* [My TP/SL did not execute properly](/support/trade-outcomes/my-tp-sl-did-not-execute-properly)
# My TP/SL Did Not Execute Properly
Source: https://docs.pacifica.fi/support/trade-outcomes/my-tp-sl-did-not-execute-properly
There are several common cases of TP/SL execution that may be frequently misunderstood. Expand a question below for details.
This is normal behavior. A stop loss works very differently from a limit order.
A limit order executes only at the specified price or better.
A stop order, on the other hand, is triggered when the mark or last traded price reaches the user's specified trigger level (this can be customized on Pacifica).
During periods of volatility, orderbook prices can move past the trigger level before triggering the stop order. This is especially true when mark price is used.
This, along with natural orderbook slippage - which can be higher during periods of volatility - causes discrepancies between TP/SL prices and actual execution.
This is expected behavior across all exchanges, and it's extremely rare for a TP/SL order to execute exactly at the trigger price due to normal market movement and liquidity dynamics.
A stop-limit order works in two stages:
When the trigger price is reached, it places a limit order at the specified limit price.
That limit order will then attempt to execute at that price or better.
However, if the market falls through your limit price and doesn't recover, the limit order may remain unfilled, creating the impression that the stop-limit didn't work. In reality, it worked as intended - it just couldn't execute because the market moved past your limit.
To guarantee that your position closes once the trigger is hit, consider using a stop-market order instead of a stop-limit order. Stop-market orders prioritize execution, while stop-limits prioritize price.
Especially if using stops to prevent liquidation, we highly recommend using stop market orders to guarantee execution.
This is likely because of the mark price being used to trigger stops. Using mark price to trigger stops has the advantage of having exchange-isolated 'wicks' not trigger a user's orders.
If you would like to have TP/SL be triggered using last traded orderbook price, you can change the trigger condition of your stop orders when placing a stop order to "Last traded".
Stop-Loss and Take-Profit orders are triggered by the **mark/last/mid price**. Once triggered, a limit order is placed to try to close off your position.
**Long Positions - Stop-Loss (SL)**
If you are long and set a **trigger price of \$25** and a **limit price of \$25**, when the mark price falls below \$25 a **limit sell order at \$25** will be placed. If the market drops quickly from \$26 to \$23, your order may rest at \$25 without filling.
If instead you set a **limit price of \$22**, the order has a higher probability of filling somewhere between \$23 and \$22 during a sharp move. Lower limit prices increase fill probability but may result in worse execution.
**Long Positions - Take-Profit (TP)**
If you are long and set a **trigger price of \$32** and a **limit price of \$31.50**, when the mark price rises above \$32 a **limit sell order at \$31.50** will be placed. This protects you from selling below \$31.50 if the price quickly retraces after triggering.
**Short Positions - Stop-Loss (SL)**
If you are short and set a **trigger price of \$30** and a **limit price of \$30**, when the mark price rises above \$30 a **limit buy order at \$30** will be placed. If the market spikes rapidly from \$29 to \$33, your order may not fill.
If instead you set a **limit price of \$34**, the order has a higher probability of filling somewhere between \$33 and \$34 during fast upward moves. Higher limit prices improve fill probability but may result in worse execution.
**Short Positions - Take-Profit (TP)**
If you are short and set a **trigger price of \$20** and a **limit price of \$20.50**, when the mark price falls below \$20 a **limit buy order at \$20.50** will be placed. This ensures the order will not fill at a worse price (above \$20.50) if the market rebounds after triggering.
# Why Was I Liquidated?
Source: https://docs.pacifica.fi/support/trade-outcomes/why-was-i-liquidated
A liquidation occurs when your position moves against you and your account equity falls below the required **maintenance margin**. Expand a question below for details.
When this happens:
* Your position is automatically closed by the system
* You will see **"Market Liquidation"** in your Trade History
* The position size will be reduced to zero (or partially reduced if partial liquidation applies)
* Your available balance and margin will update accordingly
Liquidations are triggered based on mark price and maintenance margin requirements, not just last traded price.
You can read more about how liquidations work on Pacifica in [Liquidations](/trading-on-pacifica/liquidations).
This is most likely a result of cross margining.
1. When you are using cross margin, all your open positions share the same margin pool.
2. The displayed liquidation price is conditional: it typically assumes your other positions don't change materially.
3. When multiple positions move against you at the same time: losses are accumulated across multiple positions simultaneously.
4. This means shared margin was consumed faster: your total account equity drops quicker than a single-position estimate.
5. Liquidation thresholds adjusted upward in real time: as equity falls, the effective liquidation prices for each position increase.
6. Liquidation triggered at the account level: once total margin fell below requirements, liquidation occurred even if one market hadn't reached the originally displayed price.
How to prevent this:
1. Use isolated margin if you want more stable, predictable liquidation prices per position.
2. Avoid holding multiple correlated positions at high leverage on cross margin.
# Swim
Source: https://docs.pacifica.fi/swim
Swim is Pacifica's live prediction game. Watch a market price chart, tap the zones you think the price will move into, and get paid out when you're right. More pairs are coming soon.
### How Swim Works
The chart sits on top of a live grid of boxes. Each box covers a fixed price range vertically and a fixed time window horizontally, so every cell represents a specific price zone at a specific moment ahead.
Tap a box and you're predicting that price will pass through it. If it does, you collect your bet multiplied by that box's payout.
### Trading
* Pick a bet size
* Tap zones on the grid as the chart moves
* Collect `bet × multiplier` any time price enters a zone you tapped
### How Multipliers Work
Zone multipliers ladder based on distance in time and price from the current price. The further the zone, the higher the band. These numbers shift constantly as the chart moves. Nothing is locked in until the price actually reaches it. Once you tap a zone, the multiplier shown at that moment is locked in for your bet, regardless of how the grid shifts afterward.
### Balance
Swim trades draw directly from your Pacifica trading balance, the same one you use for spot and perps. No separate deposit needed, no extra steps.
### Oracle
Swim reads live orderbook prices from leading centralized and decentralized venues, and then aggregates their short term EWMA through a venue-weighted mean.
# Contract Specifications
Source: https://docs.pacifica.fi/trading-on-pacifica/contract-specifications
Pacifica's perpetual contracts let you seamlessly trade cryptocurrency assets with leverage, without the need for an expiration date. Understanding the specifications of these contracts is crucial for effective trading, risk management, and maximizing your trading potential.
Below is a summary of Pacifica's key contract details. You can explore deeper into each specification through dedicated subpages linked below.
### Pacifica Contract Specifications
| Specification | Description | Details |
| ------------------------------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Contract | Type of perpetual contract | Linear perpetual |
| Contract Size | Size per contract | 1 unit of underlying spot asset |
| IMM
(Initial Maintenance Margin) | Margin required to open a position | 1 / (user-selected leverage), dynamically increased when Open Interest sharply rises relative to liquidity |
| MM | Maintenance Margin | 50% of initial margin fraction |
| Dynamic Margin Adjustment | Margin requirement adjustments | Yes (triggered by sharp increase in open interest vs. exchange liquidity, super-linear scaling of initial margin) |
| Oracle Price | Price used for liquidation & PnL | Oracle-based (see Oracle Price) |
| Delivery / Expiration | Contract expiry | None (continuous with hourly funding payments) |
| Position Limit | Maximum allowed position size | No explicit limit per user (position size managed by dynamic margining) |
| Account Type | Margin management style | Per-wallet cross or isolated margin |
| Funding Impact Notional | Notional size impacting funding rates | 20,000 USDC (BTC, ETH); 6,000 USDC (other assets) |
| Maximum Market Order Value | Largest allowed market order | \$4M (leverage >=50), \$1M (leverage 20-50), \$500k (leverage 10-20), otherwise \$250k |
| Maximum Limit Order Value | Largest allowed limit order | 10x- maximum market order value |
### Detailed Contract Information
Explore further details for each area:
* [Market Specifications](/trading-on-pacifica/contract-specifications/market-specifications): View per-market parameters for all available markets.
* [Oracle Price](/trading-on-pacifica/contract-specifications/oracle-price-and-mark-price): Understand how Pacifica calculates the oracle-based Mark Price.
***
Use this overview as your quick-reference guide, and dive deeper into each subpage for full explanations.
# Market Specifications
Source: https://docs.pacifica.fi/trading-on-pacifica/contract-specifications/market-specifications
Per-market trading parameters for every Pacifica market
Every Pacifica market shares the same contract framework (see [Contract Specifications](/trading-on-pacifica/contract-specifications)): linear perpetuals, USDC-margined, funding paid hourly, initial margin = 1 / selected leverage, maintenance margin = 50% of initial. The parameters below are what differ per market.
**How to read this table**
* **Tick Size** — minimum price increment for orders.
* **Order Increment** — minimum quantity step, in units of the base asset.
* **Max Leverage** — highest selectable leverage; your initial margin fraction is 1 / leverage.
* **Oracle Composition** — the markets in the oracle index and their weights, labeled spot or futures. A stale venue drops out and remaining weights renormalize; composition changes as venues list or delist an asset. This column shows the oracle index only — the mark price additionally references perpetual mark prices from Binance, OKX, Bybit and Hyperliquid (crypto) or the RWA venues (equities, FX, commodities). See [Oracle Price & Mark Price](/trading-on-pacifica/contract-specifications/oracle-price-and-mark-price).
* **Listed** — date the market launched on mainnet.
**Denomination.** Binance, OKX, Bybit and Bitget source markets are quoted in **USDT** (the Binance futures index is itself a composite of USDT spot markets); Hyperliquid, trade.xyz, Lighter and Backpack markets are quoted in **USDC/USD**. Source prices enter the oracle as-is — no USDT↔USD conversion is applied.
Parameters can change as liquidity and risk conditions evolve. Live values are always available from the public API: `GET /api/v1/info`. This page is regenerated from that endpoint — last generated 2026-07-16.
### Crypto perpetuals
Standard crypto perpetuals. Oracle prices are a weighted composite of major centralized-exchange markets, refreshed every 3 seconds. kPEPE and kBONK reference 1,000× the underlying token price.
| Market | Tick Size | Order Increment | Max Leverage | Oracle Composition | Listed |
| -------- | --------- | --------------- | ------------ | ------------------------------------------------------------------------- | ---------- |
| BTC | 1 | 0.00001 | 50x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-06-02 |
| ETH | 0.1 | 0.0001 | 50x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-06-02 |
| BNB | 0.01 | 0.001 | 20x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-30 |
| DOGE | 0.00001 | 1 | 20x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-23 |
| HYPE | 0.001 | 0.01 | 20x | Binance fut. index 33% · OKX spot 33% · Bybit spot 33% | 2025-07-19 |
| SOL | 0.01 | 0.01 | 20x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-06-02 |
| XRP | 0.0001 | 0.01 | 20x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-19 |
| AAVE | 0.01 | 0.01 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-06 |
| ADA | 0.00001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-12-10 |
| ARB | 0.00001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-12-10 |
| ASTER | 0.00001 | 0.01 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-09-20 |
| AVAX | 0.001 | 0.01 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-09-18 |
| BCH | 0.01 | 0.01 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-12-03 |
| CRV | 0.0001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-15 |
| ENA | 0.00001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-27 |
| FARTCOIN | 0.0001 | 0.1 | 10x | Binance fut. index 100% | 2025-07-25 |
| JUP | 0.0001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-01-05 |
| LDO | 0.0001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-14 |
| LINK | 0.001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-08 |
| LIT | 0.0001 | 0.1 | 10x | Binance fut. index 33% · OKX spot 33% · Bybit spot 33% | 2025-12-20 |
| LTC | 0.01 | 0.01 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-13 |
| NEAR | 0.0001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-11-12 |
| PAXG | 0.1 | 0.001 | 10x | Binance spot 50% · Binance fut. index 25% · OKX spot 25% | 2025-10-21 |
| PUMP | 0.000001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-14 |
| SUI | 0.0001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-07-30 |
| TAO | 0.01 | 0.01 | 10x | Binance spot 50% · Binance fut. index 25% · OKX spot 25% | 2025-11-01 |
| TRUMP | 0.0001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-11-12 |
| UNI | 0.001 | 0.1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-15 |
| XMR | 0.01 | 0.01 | 10x | Binance fut. index 100% | 2025-12-03 |
| XPL | 0.0001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-09-25 |
| ZEC | 0.01 | 0.01 | 10x | Binance spot 50% · Binance fut. index 25% · OKX spot 25% | 2025-10-27 |
| kBONK | 0.000001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-01 |
| kPEPE | 0.000001 | 1 | 10x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-11 |
| ICP | 0.0001 | 0.1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-11-12 |
| PENGU | 0.000001 | 1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-01 |
| STRK | 0.0001 | 1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-11-11 |
| VIRTUAL | 0.0001 | 0.1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-10-30 |
| WIF | 0.00001 | 1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-01-05 |
| WLD | 0.0001 | 0.1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-12-31 |
| WLFI | 0.0001 | 1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-08-24 |
| ZK | 0.00001 | 1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-11-02 |
| ZRO | 0.0001 | 0.1 | 5x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-02-11 |
| 2Z | 0.0001 | 1 | 3x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2025-10-02 |
| CHIP | 0.0001 | 0.1 | 3x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-04-23 |
| MEGA | 0.00001 | 1 | 3x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-01-21 |
| MON | 0.00001 | 1 | 3x | Binance fut. index 50% · OKX spot 50% | 2025-10-28 |
| PIPPIN | 0.00001 | 1 | 3x | Binance fut. index 100% | 2026-01-05 |
### Special crypto pairs
**SOL-USDC** is a spot market (1x, no funding) priced off the SOL composite oracle. **BP** tracks Backpack's USDC spot market and carries reduced leverage while external liquidity develops.
| Market | Tick Size | Order Increment | Max Leverage | Oracle Composition | Listed |
| -------- | --------- | --------------- | ------------ | ------------------------------------------------------------------------- | ---------- |
| SOL-USDC | 0.01 | 0.001 | 1x | Binance spot 40% · Binance fut. index 20% · OKX spot 20% · Bybit spot 20% | 2026-04-19 |
| BP | 0.0001 | 0.1 | 3x | Backpack spot 100% | 2026-02-11 |
### Equity, FX & commodity perpetuals
Real-world-asset perpetuals trade 24/7 on Pacifica, including when the underlying market is closed. Oracle prices composite trade.xyz, Lighter and Bitget RWA markets — plus Binance where it lists the equivalent contract; funding continues to accrue hourly through weekends and market closures.
| Market | Class | Tick Size | Order Increment | Max Leverage | Oracle Composition | Listed |
| -------- | --------- | --------- | --------------- | ------------ | --------------------------------------------------------------------------------- | ---------- |
| CRCL | Equity | 0.01 | 0.001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-03-19 |
| GOOGL | Equity | 0.01 | 0.001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-02-11 |
| HOOD | Equity | 0.001 | 0.01 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-03-13 |
| MSTR | Equity | 0.001 | 0.01 | 10x | Binance fut. index 42% · trade.xyz index 42% · Lighter index 8% · Bitget index 8% | 2026-06-26 |
| NVDA | Equity | 0.01 | 0.001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2025-12-28 |
| PLTR | Equity | 0.01 | 0.001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-02-25 |
| SAMSUNG | Equity | 0.01 | 0.001 | 10x | Binance fut. index 42% · trade.xyz index 42% · Lighter index 8% · Bitget index 8% | 2026-06-03 |
| SKHYNIX | Equity | 0.1 | 0.0001 | 10x | Binance fut. index 42% · trade.xyz index 42% · Lighter index 8% · Bitget index 8% | 2026-06-03 |
| SPCX | Equity | 0.01 | 0.01 | 10x | trade.xyz index 83% · Lighter index 17% | 2026-05-20 |
| TSLA | Equity | 0.01 | 0.001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-01-15 |
| SP500 | Index | 0.1 | 0.0001 | 20x | trade.xyz index 83% · Bitget index 17% | 2026-03-19 |
| URNM | ETF | 0.001 | 0.01 | 10x | Binance fut. index 50% · trade.xyz index 50% | 2026-02-25 |
| EURUSD | FX | 0.0001 | 0.1 | 50x | trade.xyz index 83% · Lighter index 17% | 2026-02-11 |
| USDJPY | FX | 0.01 | 0.001 | 50x | trade.xyz index 83% · Lighter index 17% | 2026-01-15 |
| CL | Commodity | 0.001 | 0.01 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-01-11 |
| COPPER | Commodity | 0.0001 | 0.01 | 10x | Binance fut. index 45% · trade.xyz index 45% · Bitget index 9% | 2026-02-11 |
| NATGAS | Commodity | 0.0001 | 0.1 | 10x | Binance fut. index 42% · trade.xyz index 42% · Lighter index 8% · Bitget index 8% | 2026-02-25 |
| PLATINUM | Commodity | 0.1 | 0.0001 | 10x | trade.xyz index 100% | 2026-03-19 |
| XAG | Commodity | 0.001 | 0.01 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2025-12-30 |
| XAU | Commodity | 0.1 | 0.0001 | 10x | trade.xyz index 71% · Lighter index 14% · Bitget index 14% | 2026-02-11 |
***
Funding accrues hourly on all perpetual markets. For how prices are formed, see [Oracle Price & Mark Price](/trading-on-pacifica/contract-specifications/oracle-price-and-mark-price); for margin mechanics, see [Margin and Leverage](/trading-on-pacifica/margin-and-leverage).
# Oracle Price & Mark Price
Source: https://docs.pacifica.fi/trading-on-pacifica/contract-specifications/oracle-price-and-mark-price
Pacifica's perpetual contracts use a decentralized Oracle Price to accurately value positions and determine funding rate and is a component of Mark Price. This Oracle Price protects traders by reducing manipulation risks and ensuring market stability. Mark Price is used for liquidations, margin requirements and Unrealized PnL.
### Oracle Price Calculation
The oracle price is updated every 3 seconds and calculated as a weighted average of USDT denominated prices from major exchanges.
| CEX | Weights |
| :---------: | :-----: |
| Binance | 2 |
| OKX | 1 |
| Bybit | 1 |
| Hyperliquid | 1 |
### Uses of Oracle Price on Pacifica
The Oracle Price is crucial for several Pacifica exchange operations:
* Funding Rates: Calculations rely on the Oracle Price to maintain alignment with spot markets.
* Mark Price Calculation: Oracle price serves as a component of Mark Price to prevent market manipulation and ensure the accuracy of settlements.
### Uses of Mark Price on Pacifica
The Mark Price is the median value of:\
1\. Oracle (spot) price\
2\. The median of best bid, best ask, and last trade on Pacifica\
3\. Perpetual price from major exchanges
The Mark Price is used for:
* Liquidation Calculations: By using the median value of the 3 Mark Price components, Pacifica ensures fair and accurate liquidations.
* Margin Requirements: Both initial and maintenance margins are determined using the Mark Price.
* Unrealized PnL: Open positions are marked-to-market using the Mark Price.
### Transparency & Reliability
Pacifica provides transparent and verifiable Oracle Prices available directly through our trading interface or via API endpoints, ensuring trust and accountability.
***
For further details or technical questions, refer to our [API documentation](/api-documentation/api) or contact our support via [Contact Us](/other/contact-us).
# Pre-Markets
Source: https://docs.pacifica.fi/trading-on-pacifica/contract-specifications/pre-markets
When Pacifica lists pre-markets that are not on other major exchanges, the oracle references Pacifica's mark price instead of external sources.\
\
An EMA is also applied to prevent oracle manipulation. This, combined with Pacifica's price band mechanic (+-30% of mark price) prevents extreme manipulation of pre-market perps.\
\
Once other major venues begin listing the same market, their pricing will be added to Pacifica's oracle reference in order to further strengthen its robustness.\
\
Additionally, Pacifica exercises strict open interest caps in pre-market pairs to prevent abnormal trading activity and market manipulation.
# Deposits & Withdrawals
Source: https://docs.pacifica.fi/trading-on-pacifica/deposits-and-withdrawals
Before trading, a user connects a Solana-compatible wallet to Pacifica and funds the account with USDC. Pacifica supports Phantom, Solflare, Backpack, Ledger (via browser extension), and other WalletConnect-compatible wallets.
## USDC Deposits
Pacifica currently limits deposits to a maximum of \$250,000 account equity during Closed Beta. Additional deposits are gated on the frontend, and API deposits exceeding these amounts are held in pending.
Minimum deposit: \$10.
Fees: network gas only.
### USDC Withdrawals
Pacifica currently limits single-account withdrawals to a maximum of \$250,000 every 24 hours during Closed Beta. Additional withdrawals are gated on the frontend, and API withdrawals exceeding the limit are held in pending.
Unrealized PnL may be withdrawn from an isolated position or a cross-margin account subject to the 10% initial-margin floor. See [Margin & Leverage](/trading-on-pacifica/margin-and-leverage).
An exchange-wide withdrawal cap applies across all assets as a risk-mitigation mechanism. It is unlikely to affect normal withdrawals.
Under unified margin, USDC withdrawal is bounded by `available_to_withdraw`, which deducts any outstanding money-market borrow. An account with a negative USDC balance cannot withdraw USDC until the debt is repaid or sufficient spot is sold.
Minimum withdrawal: \$1.
Fees: \$1 per withdrawal (gas).
## Spot Asset Deposits
Spot assets are credited to the account after on-chain confirmation. Once credited, the balance is tradeable on the corresponding spot market and contributes cross-margin collateral per the asset's LTV and per-user cap. See [Spot Collateral](/trading-on-pacifica/spot-collateral).
Each supported spot asset has a per-user daily USD-notional deposit cap of \$50,000.
Minimum deposit: approximately \$10 worth of the deposited asset.
Fees: network gas only.
## Spot Asset Withdrawals
The maximum withdrawable amount for a given spot asset is:
```
available_spot_to_withdraw =
min(spot_balance,
(cross_equity_without_spot + spot_collateral_value - required_borrow
- 0.1 * total_position_value)
/ (price * ltv_ratio))
```
The constraint ensures remaining collateral covers both outstanding perpetual margin and any money-market debt after withdrawal. The 10% floor on `total_position_value` matches the constraint applied to USDC withdrawals.
Each asset has a per-user daily USD-notional withdrawal cap of \$250,000. Requests above the cap are queued for the next reset.
A time-based, exchange-wide withdrawal cap applies across USDC and spot combined.
Fees: network gas, plus a withdrawal fee of approximately \$1 worth of the withdrawn asset.
## Subaccount Spot Transfers
Spot assets can be moved between a master account and any of its direct subaccounts without an on-chain transaction. Transfers are instant and fee-free. Asset movements are subject to margin requirements.
USDC transfers between subaccounts continue to follow the existing [Subaccount Fund Transfer](/api-documentation/api/rest-api/subaccounts/subaccount-fund-transfer) rules.
# Fund Security
Source: https://docs.pacifica.fi/trading-on-pacifica/fund-security
In the high-stakes world of decentralized finance, security is the foundation upon which everything else is built. At Pacifica, our mission has always been to build the most powerful and secure perpetual DEX, one that rivals the performance of centralized exchanges without sacrificing the self-custodial ethos that makes DeFi revolutionary.
Since our mainnet launch we have processed significant volume, earning the trust of a rapidly growing community of active traders. This trust is our most valuable asset. In order to keep up with the continuously rising stakes of growth, Pacifica is transitioning to a sophisticated hot-cold hybrid security architecture with multi-signature governance.
## The Inherent Tension: Power vs. Protection
The core challenge for any high-performance perpetual DEX is managing the "withdrawal authority", the logic within a smart contract that permits the movement of user funds. To facilitate instant withdrawals, this authority must be readily accessible to the matching engine. However, concentrating this access in a single, always-online endpoint creates systemic risk.
Most perpetual DEXs operate with a unified smart contract architecture where all user funds reside in a single upgradeable contract. In these systems, the proxy contract holds user funds and delegates calls to a logic contract. If administrators can upgrade this logic, they possess the ability to modify withdrawal permissions. The contract logic is flexible, but ultimate control rests with whoever holds the admin keys. If the withdrawal authority is compromised, all funds are exposed. Subsequent effects of this are then: if the smart contract has a vulnerability, all funds are at risk, and if admin keys are stolen, the contract logic itself can be upgraded to drain user capital. There's no segmentation, no firebreak, no defense in depth.
## The Pacifica Protocol: Layered, Proactive Security
We aim to think beyond this single-point-of-failure paradigm entirely. Our new design creates a multi-layered defense system that is both resilient and non-custodial. This is the culmination of best practices implemented in a transparent, verifiable manner.
### The Hot Wallet: The Engine of Commerce
This is the operational treasury and represents only a fraction of total funds.
The hot wallet is managed by the matching engine, which can execute withdrawals up to the programmatic spending limit without additional approvals. This ensures legitimate user withdrawals remain instantaneous. If compromised through an engine key breach, smart contract exploit, or social engineering attack, an attacker can only access the limited funds in the hot wallet.
### The Cold Vault: The Fortress of Funds
The bulk of user capital resides in the cold vault, secured by a multi-signature smart contract governed by a decentralized council that is geo-distributed across multiple continents. This vault has one primary function: to replenish the hot wallet through programmatic spending limits.
We've partnered with Squads Protocol, the leading multi-signature infrastructure securing over \$10 billion in assets on Solana. Squads is the first formally verified program on Solana, meaning its code has undergone mathematical proofs of correctness beyond traditional auditing. The multi-signature requirement means multiple independent parties must approve any transaction before it executes, eliminating the single point of failure inherent in traditional single-key wallets.
Squads enables time-locked upgrade mechanisms that introduce mandatory delays between proposal and execution, giving users visibility and the ability to exit if they disagree. Role-based access control defines who can propose, approve, and execute transactions. Emergency pause functionality requires multi-party consensus. The cold vault cannot send funds to arbitrary addresses. Its logic is constrained by design, making it technically impossible for any party to redirect funds elsewhere.
### The Unbreakable Chain of Custody
The true innovation lies in the interaction between these two layers, creating a security model that provides both operational efficiency and ironclad protection.
When a user requests a withdrawal, the matching engine processes it instantly from the hot wallet. If the hot wallet balance dips below a predefined threshold, a replenishment process is automatically initiated, which requires a consensus-approved transaction from the decentralized multi-sig governing the cold vault. Multiple independent signers must review and approve the transfer, ensuring that no single party can unilaterally move funds from cold storage.
The cold vault then sends only the necessary amount to replenish the hot wallet up to its operational limit, never exceeding the predetermined cap. This creates a security guarantee: even in a worst-case scenario where our operational systems are fully compromised, where an attacker gains control of the matching engine, the AWS infrastructure, or even internal access credentials, they can only access the limited funds in the hot wallet. The majority of funds remain safe.
Using Squads' programmatic spending limit feature, we can allocate specific withdrawal budgets to the hot wallet without requiring full multi-signature approval for every routine operation. For example, the hot wallet might have a daily limit of \$5 million USDC for user withdrawals. Any attempt to exceed this limit automatically triggers multi-signature requirements. The system is self-enforcing; the blockchain itself prevents unauthorized fund movements.
### Signer-Level Separation: The Technical Advantage
Our architecture implements security at the signer level, creating distinct roles with different permissions and capabilities. The hot signer, controlled by the engine operator, can withdraw up to the Squads wallet's spending limit in a specified time duration. The cold signers, a distributed group of multi-sig members, control reserve funds and have the authority to adjust spending limits through consensus. The upgrade authority is distributed across multi-sig participants, not held by any individual or single organization.
This means any single party attempting to compromise the exchange, whether external attacker or rogue insider, can only access the limited funds in the hot wallet. The spending limit acts as a firebreak, containing potential damage and preventing catastrophic loss.
Let's examine potential attack scenarios:
| Attack Vector | Single Contract | Pacifica Hot/Cold Hybrid |
|---|
| Engine compromise | All funds exposed | Only hot wallet funds exposed |
| Smart contract exploit | All funds at risk | Only hot wallet funds at risk |
| Admin key compromise | Can upgrade to drain all funds | Requires multi-sig; spending limits enforced |
| Social engineering | Single point of failure | Multiple parties must be compromised |
| Inside threat | Unilateral access possible | Impossible without multi-party collusion |
### Uncompromising Decentralization
By vesting control of the cold vault in a decentralized multi-sig, we eliminate any single point of failure's ability to bring down the entire system. The distributed governance model ensures that even if several parties are compromised, the threshold mechanism prevents unauthorized access to the majority of funds.
### Verifiable Security Over Blind Trust
Our model allows the community to audit the key facts: the spending limit of the hot wallet and the immutable logic of the cold vault. You don't have to trust us; you can verify the security model on-chain. Every parameter, every threshold, every authorization is recorded on the blockchain and can be independently verified by anyone.
Any proposed change to withdrawal authorities or spending limits requires not only multi-signature approval but also a time-locked execution period, giving users visibility into governance decisions and the ability to withdraw their funds if they disagree.
Pacifica's bridge and cold vaults, along with all component logic can be found in the following addresses:
* USDC deposit/withdraw bridge: `72R843XwZxqWhsJceARQQTTbYtWy6Zw9et2YV4FpRHTa`
* SOL deposit/withdraw bridge: `9sSr35zwnFTuv2kZ86i55sR9dqQLTG663homexrLYgYu`
* USDC cold-vault: `5kwCMKjE3Krvs7cHfcQ9kBkGyPQphd3oJ4KnsXcpMoVc`
* SOL cold-vault: `8nFeyzTFhUXp11raJkSSvZWn9GXDjcrGq8LuzP9aKtg8`
### Built for Scale
This architecture is designed to grow with us. As our TVL expands into the hundreds of millions and even billions, the risk profile remains constant. Whether we're securing \$100 million or \$10 billion in user funds, the fundamental security guarantees remain unchanged: the hot wallet cap limits exposure, the multi-sig prevents unauthorized cold storage access, and the spending limits act as an automatic circuit breaker.
## Conclusion: Security as a First Principle
The transition to hot-cold hybrid architecture with multi-signature governance and programmatic spending limits represents more than a technical upgrade. It's a statement that we prioritize long-term security over short-term convenience, and that decentralized finance can meet the highest security standards while exceeding centralized platforms in transparency and verifiability.
As we continue scaling toward becoming the leading perpetual DEX, security architecture that protects billions in user funds lays an ironclad foundation. We build for the future.
# Funding Rates
Source: https://docs.pacifica.fi/trading-on-pacifica/funding-rates
Funding fees ensure perpetual contract prices closely track the underlying spot market. Depending on the prevailing funding rate, traders with open positions periodically pay or receive these fees:
* Positive Funding Rate: Traders holding long positions pay traders holding short positions.
* Negative Funding Rate: Traders holding short positions pay traders holding long positions.
Funding rates are updated every hour, calculated based on market conditions from the previous hour.
### Funding Rate Calculation
Pacifica calculates the funding rate using two components: the Premium Index and a fixed 8-hour Interest Rate (0.01%):
```
funding_rate = (premium_index + clamp(interest_rate - premium_index, -0.05%, 0.05%))/8
```
**Where:**
* **Premium Index** measures the deviation between the Impact Price and the Oracle Price:
```
premium_index = impact_price / oracle_price - 1
```
* **Impact Price** is determined by the average execution price for a defined Impact Notional from Pacifica's orderbook:
```
impact_price = max(impact_bid_price - oracle_price, 0)
- max(oracle_price - impact_ask_price, 0)
```
The **Impact Notional** values are:
| Asset | Impact Notional (USD) |
| :---: | :-------------------: |
| BTC | \$20,000 |
| Other | \$6,000 |
* **Clamp** of +-0.05% keeps funding static for small fluctuations in premium, allowing for a steady funding rate during relatively steady market conditions
Pacifica samples and updates the funding rate every **5 seconds** and displays a TWAP of the estimated next 1h funding rate. At the end of each **1-hour interval**, the average funding rate is taken and then applied to open positions, and the funding rate TWAP is reset.
Funding fees per hour are capped at ±4%.\
\
**Funding payments:**
* Long positions:
* Positive funding rate: Account Balance reduced (pay fee)
* Negative funding rate: Account Balance increased (receive fee)
* Short positions:
* Positive funding rate: Account Balance reduced (receive fee)
* Negative funding rate: Account Balance increased (pay fee)
### Effect on Isolated Positions and Liquidations
For isolated margin positions, funding payments are deducted from the isolated margin balance and will therefore affect the position's liquidation price. After each funding payout, Pacifica recalculates liquidation prices to reflect the adjusted margin.
# Liquidations
Source: https://docs.pacifica.fi/trading-on-pacifica/liquidations
Pacifica employs a three-tiered liquidation process to manage positions that fall below the required maintenance margin. The multi-step approach minimizes market disruption while ensuring that a trader's collateral is used effectively to cover losses.
### Liquidation Price Formula
Liquidation occurs when a user's account equity falls below the maintenance margin of open positions.
Maintenance margin is ½ the initial margin requirement on all markets, defined by `1 / max_leverage` of the market.
```
liquidation_price = [price - (side * position_margin) / position_size]
/ (1 - side / max_leverage / 2)
```
`side = 1` for long, `-1` for short. `position_margin` is `account_equity` for cross-margin positions; `price` should be the current `mark_price` if `account_equity` already reflects unrealized PnL.
### Three-Tiered Liquidation Process
1. **Market Liquidation.** When a user's account equity first falls below maintenance margin but remains above the backstop liquidation threshold (⅔ of maintenance margin), all open orders - including ones that would otherwise reduce exposure - are cancelled, and the positions are liquidated by sending market orders into the orderbook.
During a market liquidation, positions are broken into smaller chunks, each placed as an IOC order as close to backstop liquidation price as possible (to prevent immediate backstop liquidation). The chunking strategy is dynamic and based on market leverage:
```
Small positions (< $2,000 * max_leverage): 1 chunk (immediate)
Large positions (>= $2,000 * max_leverage): 5 chunks
```
`max(0.75%, maintenance_margin_ratio * 0.4)` of the value of positions liquidated in this manner is deducted by the liquidation engine. Large positions are sent with a small interval between chunks (average under 1 second). If enough of the position is closed to restore maintenance margin levels, the remainder stays with the trader as a partial liquidation.
2. **Backstop Liquidation.** If account equity falls below ⅔ of the maintenance margin, all open positions and remaining collateral are transferred to a Pacifica backstop liquidator. This prevents orderbook disruption during large market movements.
3. **Auto-Deleveraging.** If account equity falls below zero while maintaining an open position - caused by prior tiers having insufficient liquidity - Pacifica closes opposing profitable traders' positions based on risk priority to maintain overall market health.
Due to their experimental or volatile nature, the backstop liquidator does not take positions from the following markets: `URNM, GOLD, SILVER, PAXG, CL, COPPER, NATGAS, EURUSD, USDJPY, NVDA, TSLA, PLTR, SP500, GOOGL, CRCL, HOOD, MEGA, BP`.
### Spot Insolvency Deleveraging
Unified margin accounts can hold negative USDC balances backed by spot collateral. A separate deleveraging path unwinds spot positions if an account's debt exceeds its collateral or if the money market is under stress. This is separate from perpetual liquidations.
Spot deleveraging runs in two modes:
1. **Account-level.** Triggered when an individual borrower's spot collateral value is no longer sufficient to support the USDC debt and/or any perpetual initial-margin requirement.
2. **Pool-level.** Triggered when money-market `utilization >= 95%`. Deleveraging proceeds from the largest borrowers first and aims to bring utilization back down to 90%.
In both modes, the system begins liquidating spot assets on the account's behalf into the spot orderbook to repay USDC loans.
# Margin & Leverage
Source: https://docs.pacifica.fi/trading-on-pacifica/margin-and-leverage
Pacifica supports cross margin and isolated margin. Margin mode is selected per trading pair. Cross margin is the default.
Margin mode cannot be changed for a symbol with an open position. Leverage can be increased on a symbol with an open position but cannot be decreased until the position is closed.
### Cross Margin
Cross margin pools the account's USDC balance, unrealized PnL from cross perpetual positions, and LTV-adjusted spot collateral into a single equity figure that supports all cross positions.
```
account_value = usdc_balance + unrealized_pnl - pending_interest + spot_collateral_value
```
Unrealized PnL updates continuously. Isolated positions and their assigned margin are excluded. `pending_interest` is unsettled interest on any outstanding money-market borrow and is deducted from equity as soon as it accrues.
Spot holdings contribute to `account_value` according to per-asset LTV, a per-user collateral cap, and an optional hedging bonus. See [Spot Collateral](/trading-on-pacifica/spot-collateral) for the full formula.
### Isolated Margin
Isolated margin assigns a dedicated margin amount to each position. Isolated positions receive no collateral from spot holdings and are not affected by the unified margin model. Their liquidation is determined solely by the assigned isolated margin and the position's notional.
### Initial Margin
Placing an order reserves initial margin based on entry price, position size, and selected leverage.
```
initial_margin = position_size * entry_price / leverage
```
### Unrealized PnL and Withdrawable Balance
Unrealized PnL can be withdrawn from an isolated position or a cross-margin account, subject to the 10% initial-margin floor. Open spot buy orders also deduct their locked USDC from withdrawable balance:
```
withdrawable_balance = usdc_balance + unrealized_pnl - pending_interest + spot_collateral_value
- max(initial_margin_required, 0.1 * total_position_value)
- spot_buy_order_locked_usdc
```
# Money Market
Source: https://docs.pacifica.fi/trading-on-pacifica/money-market
Pacifica operates a single USDC money market shared across all cross-margin accounts
Lending and borrowing are implicit on Pacifica. Positions can be opened against spot collateral and pay no interest until negative PnL triggers a borrow.
Accounts with idle USDC above a threshold supply the pool and earn interest. Accounts who 1) hold spot collateral 2) have cross margin equity that falls below zero automatically borrow from the pool and pay interest. Only USDC is lent or borrowed; spot assets serve as collateral and are never rehypothecated.
### Lenders and Borrowers
An account is eligible to lend when all of the following hold:
* Its USDC balance is at least the minimum lender threshold (1,000 USDC).
* Its lendable capacity - USDC balance net of the 10% initial-margin floor, pending interest, and any USDC locked by spot buy orders - is also at least 1,000 USDC.
* `auto_lend_disabled` is false.
An account is a borrower when:
```
equity_without_spot = usdc_balance + unrealized_pnl_from_cross_perps - pending_interest
required_borrow = max(0, -equity_without_spot)
```
and `required_borrow > 0`. Borrowing is only permitted while spot collateral is sufficient to cover the shortfall. An account without adequate spot collateral is flagged for insolvency deleveraging. See [Liquidations](/trading-on-pacifica/liquidations#spot-insolvency-deleveraging).
### Pool Aggregates
```
total_borrowable = sum over eligible lenders of their lendable capacity
total_borrowed = sum over borrowers of required_borrow
utilization = total_borrowed / total_borrowable
```
Pool state is published via `GET /api/v1/loan_pool`.
### Utilization Thresholds
| Threshold | Utilization | Behavior |
| ------------------------ | ----------- | --------------------------------------------------------------------- |
| Optimal | 80% | Borrow APR equals the kink rate. |
| Order admission limit | > 90% | Borrowing accounts cannot place new non-reduce-only perpetual orders. |
| Pool deleveraging | ≥ 95% | Pool-level insolvency deleveraging begins. |
| Pool deleveraging target | 90% | Utilization target after pool-level deleveraging. |
### Borrow APR
Borrow APR is a piecewise function of utilization:
```
u <= 0.8: apr = MIN_BORROW_APR + (LINEAR_KINK_APR - MIN_BORROW_APR) * (u / 0.8)
u > 0.8: apr = LINEAR_KINK_APR * (EXPONENTIAL_TARGET_APR / LINEAR_KINK_APR) ^ ((u - 0.8) / 0.2)
```
Current defaults: `MIN_BORROW_APR = 1%`, `LINEAR_KINK_APR = 10.95%`, `EXPONENTIAL_TARGET_APR = 50%`. At `u = 1`, the curve reaches exactly `EXPONENTIAL_TARGET_APR`.
Lender APR is derived pro-rata from utilization:
```
lend_apr = borrow_apr * utilization
```
APR values are compounded per-second, so `APY ≈ e^APR - 1`.
### Interest Accrual and Payout
Every 60 seconds, each borrower's `pending_interest` grows by:
```
pending_interest += required_borrow * borrow_rate_per_second * 60
```
Every hour, accumulated `pending_interest` is charged to the borrower's USDC balance and distributed pro-rata across lenders' USDC balances.
### Order Admission Under Stress
When pool `utilization > 90%`, accounts carrying a borrow (`equity_without_spot < 0`) cannot place new perpetual orders unless the order is reduce-only. Spot orders are not subject to this check. Non-borrowing accounts are unaffected.
### Opt-Outs
* **Stop lending.** Set `auto_lend_disabled = true`. USDC balance remains usable for trading but is excluded from `total_borrowable` and earns no yield.
* **Exclude a spot asset from unified margin.** Set `unified_margin_excluded = true` on a (user, asset) pair. The asset remains in the account and tradeable but contributes no collateral and cannot back a borrow.
Borrowing itself cannot be disabled. An account whose `equity_without_spot` drops below zero with sufficient spot collateral will automatically open a loan.
# Order Types
Source: https://docs.pacifica.fi/trading-on-pacifica/order-types
The following order types are available on Pacifica:
* **Market:** An order that executes immediately at the best available market prices. Typically used in order to immediately enter or exit a position.
* **Limit:** An order that specifies the price at which it will be executed. Limit orders can remain active based on different time-in-force settings (see below). Typically used when execution price matters more than being filled immediately
* **Stop Market:** A market order that is placed when a price condition is met. Typically used to take profit or limit losses.
* **Stop Limit:** A limit order that is placed when a price condition is met.
**Time-In-Force:**\
All limit orders on Pacifica belong to one of the following TIF options.
* **Good-Til-Cancelled (GTC):** The order remains active on the orderbook until it is either filled or cancelled.
* **Immediate-or-Cancel (IOC):** The order attempts to match immediately at the specified price (or better). Any portion of the order that is not filled immediately is cancelled.
* **Add-Liquidity-Only (ALO):** Also known as **"Post Only,"** this order is added to the order-book only if it does not immediately match against an existing order.
* **Top-of-Book (TOB):** A special order type that allows "ALO (Post Only)" orders which cross the orderbook to be placed at the best bid/ask possible, instead of being cancelled. Best bid refers to lowest ask in orderbook minus one tick. Best ask refers to highest bid in orderbook plus one tick.
\
Note: In order to protect liquidity providers from adverse selection, all market orders, TIF GTC, and TIF IOC orders are subject to a randomized 50-100ms delay.
# Overview
Source: https://docs.pacifica.fi/trading-on-pacifica/overview
Pacifica supports perpetual and spot trading. Over thirty-five perpetual markets are currently listed, alongside a growing set of spot markets quoted in USDC.
* **Instrument types:** Perpetuals and spot (base asset vs. USDC).
* **Margin modes:** Cross margin (default; unified with spot collateral) and isolated margin. Spot is cross-only.
* **Leverage:** 3x to 50x on perpetuals, depending on market. Spot is 1x.
Detailed pages:
* [Contract Specifications](/trading-on-pacifica/contract-specifications) - perpetual contract specs and supported pairs.
* [Oracle Price & Mark Price](/trading-on-pacifica/contract-specifications/oracle-price-and-mark-price)
* [Order Types](/trading-on-pacifica/order-types)
* [Margin & Leverage](/trading-on-pacifica/margin-and-leverage)
* [Unified Margin](/trading-on-pacifica/unified-margin)
* [Spot Collateral](/trading-on-pacifica/spot-collateral)
* [Spot Trading](/trading-on-pacifica/spot-trading)
* [Money Market](/trading-on-pacifica/money-market)
* [Funding Rates](/trading-on-pacifica/funding-rates)
* [Trading Fees](/trading-on-pacifica/trading-fees)
* [Deposits & Withdrawals](/trading-on-pacifica/deposits-and-withdrawals)
* [Liquidations](/trading-on-pacifica/liquidations)
*Access to Trading on Pacifica is strictly prohibited for individuals or entities residing in, incorporated in, or operating from, but not limited to, the United States of America, Cuba, the Crimean Peninsula (including Sevastopol), Iran, Afghanistan, Syria, and North Korea (collectively, the "Restricted Jurisdictions"). Access to trading functionality from IP addresses from any Restricted Jurisdiction is programmatically restricted.*
# Self-Trade Prevention
Source: https://docs.pacifica.fi/trading-on-pacifica/self-trade-prevention
When a new order attempts to match with a resting order placed by the same account, the existing order is cancelled, and the new order proceeds as per normal.\
\
This makes sure that no trades will happen between orders from the same account.\
\
The removed order will be labelled as "Rejected" under the "Status" column in order history.
# Spot Collateral
Source: https://docs.pacifica.fi/trading-on-pacifica/spot-collateral
Each eligible spot asset contributes collateral to a cross-margin account according to four per-asset parameters. The contribution is bounded by a per-user USD cap on market value and may be boosted for the portion of the balance hedged by an opposing cross-margin short.
### Parameters
| Parameter | Description |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `collateral_enabled` | If false, the asset contributes zero collateral regardless of balance or settings. |
| `ltv_ratio` | Loan-to-value ratio, between 0 and 1. Typical values: 0.90 (BTC, ETH), 0.80 (majors). |
| `spread_divisor` | Hedging bonus multiplier applied to the hedged portion of a balance. Optional. Bonus applies only when `spread_divisor > 1`. |
| `collateral_value_limit_usd` | Per-(user, asset) cap on the asset's gross market value that is eligible for collateral. Default 10,000 USD. |
Parameter values are published via `GET /api/v1/spot_assets`. The per-user cap can be raised by admin override.
### Collateral Curve
For spot balance `B`, oracle price `P`, and hedged size `H` (the portion of `B` offset by a cross-margin short perpetual in the same underlying; isolated shorts do not count):
```
base_rate = ltv_ratio * P
bonus_rate = P * (1 - ltv_ratio) * (1 - 1 / spread_divisor) (when spread_divisor > 1, else 0)
hedged_rate = base_rate + bonus_rate
capped_units = collateral_value_limit_usd / P
hedged_units = min(H, B, capped_units)
base_units = min(B, capped_units) - hedged_units
spot_collateral_value = hedged_rate * hedged_units + base_rate * base_units
```
Units beyond `capped_units` contribute no additional collateral; they remain in the account and are fully tradeable. Because `capped_units` is defined in terms of market value, the maximum collateral a single (user, asset) pair can contribute to cross margin is `ltv_ratio * collateral_value_limit_usd` (e.g. 9,000 USD at `ltv_ratio = 0.9` and the 10,000 USD default cap).
### Hedging Bonus Example
SOL with `ltv_ratio = 0.80`, `spread_divisor = 1.05`, `P = 150`. Account holds 100 SOL spot and a 50 SOL cross-margin short perpetual. Assume the balance is below the per-user cap.
```
base_rate = 0.80 * 150 = 120
bonus_rate = 150 * (1 - 0.80) * (1 - 1/1.05) ≈ 1.4286
hedged_rate = 120 + 1.4286 ≈ 121.4286
hedged_units = 50
base_units = 50
spot_collateral_value ≈ 121.4286 * 50 + 120 * 50 ≈ 12,071.4
```
Without the hedge, the same 100 SOL would contribute `120 * 100 = 12,000`. The hedge adds roughly 71.4 USD of additional collateral.
### Spot Sell Orders
Placing a spot sell order locks the base asset against the order. Locked units are excluded from `spot_collateral_value` until the order fills or is cancelled. See [Spot Trading](/trading-on-pacifica/spot-trading#balance-locks).
### Excluding an Asset From Unified Margin
Setting `unified_margin_excluded = true` on a (user, asset) pair removes its collateral contribution. The balance remains in the account and can be bought, sold, withdrawn, or transferred normally.
# Spot Trading
Source: https://docs.pacifica.fi/trading-on-pacifica/spot-trading
Spot markets trade a base asset against USDC on Pacifica's performant orderbooks.
### Order Types
Spot markets accept Market, Limit, Stop Market, and Stop Limit orders with TIF settings GTC, IOC, ALO, and TOB. See [Order Types](/trading-on-pacifica/order-types) for more. Orders flagged `reduce_only` on a spot market are rejected.
### Fees
Spot fees are deducted from the received asset at the end of a trade.
```
buy: received_base = (usdc_spent / price) * (1 - fee_rate)
sell: received_usdc = (base_sold * price) * (1 - fee_rate)
```
Fee tiers follow the perpetual fee schedule. See [Trading Fees](/trading-on-pacifica/trading-fees).
### Balance Locks
Placing a spot order locks the relevant balance until the order fills or is cancelled.
| Side | Locked balance | Effect on cross margin |
| ---- | ---------------------- | ---------------------------------------------------------------------------- |
| Buy | `size * price` in USDC | Reduces `available_to_spend` and `available_to_withdraw` by the locked USDC. |
| Sell | `size` in base asset | Reduces `spot_collateral_value` by the locked units' LTV-adjusted value. |
# Trading Fees
Source: https://docs.pacifica.fi/trading-on-pacifica/trading-fees
Your trading volume on Pacifica determines your fee tier.\
\
Fee tiers update daily based on an account's volume over the past 30 days.\
\
All subaccounts share the same fee tier as the master account.\
Subaccount volumes count toward the master account total for fee calculations.
| Tier | 30-day Rolling Volume | Maker Fee | Taker Fee |
| ----- | --------------------- | --------- | --------- |
| 1 | 0 | 0.015% | 0.040% |
| 2 | > \$5,000,000 | 0.012% | 0.038% |
| 3 | > \$10,000,000 | 0.009% | 0.036% |
| 4 | > \$25,000,000 | 0.006% | 0.034% |
| 5 | > \$50,000,000 | 0.003% | 0.032% |
| VIP 1 | > \$100,000,000 | 0.000% | 0.030% |
| VIP 2 | > \$250,000,000 | 0.000% | 0.029% |
| VIP 3 | > \$500,000,000 | 0.000% | 0.028% |
Note:
* All volume thresholds refer to your total executed trading volume in USD equivalent.
* Fees are settled automatically for each trade upon execution.
# Unified Margin
Source: https://docs.pacifica.fi/trading-on-pacifica/unified-margin
Unified margin is a generalization of cross margin across spot and perp assets. Pacifica users' account's USDC balance, unrealized PnL, and spot holdings are margined together in a unified account.
### Account Equity
```
equity_without_spot = usdc_balance + unrealized_pnl_from_cross_perps - pending_interest
account_equity = equity_without_spot + spot_collateral_value
```
`pending_interest` is interest that has accrued on outstanding borrows but has not yet been settled against the USDC balance. It is deducted from equity the moment it accrues. See [Money Market](/trading-on-pacifica/money-market).
Spot collateral value is computed per asset using a piecewise curve based on LTV ratio, a per-user collateral cap, and an optional hedging bonus for delta-neutral positions. See [Spot Collateral](/trading-on-pacifica/spot-collateral).
### Implicit Borrowing
Pacifica's implicit borrowing mechanism allows for greater capital efficiency when spot assets are used as margin for perpetual positions. Perp positions can be opened against spot margin with no initial borrow.
The exception to this is isolated perp positions, where the entire margin required is borrowed upfront upon the position being opened.
An account is treated as a borrower whenever `equity_without_spot < 0`. The shortfall `required_borrow = max(0, -equity_without_spot)` is covered implicitly by the money market. This can happen because the USDC balance goes negative, cross perp losses exceed USDC, or accrued interest pushes equity below zero. Interest accrues on the outstanding amount from that point. No user action is required, and no explicit borrow transaction is submitted.
Implicit borrowing only proceeds if the account holds enough spot collateral to cover the borrow under effective LTV. An account without adequate spot collateral is flagged for deleveraging. See [Liquidations](/trading-on-pacifica/liquidations#spot-insolvency-deleveraging).
### Carry and Hedged Positions
Because spot and perpetual PnL are netted in a single equity figure, a long spot position paired with a short perpetual on the same underlying functions as a carry trade without requiring the user to collateralize each leg separately. The matched portion of the hedge also receives an elevated LTV rate. See [Spot Collateral](/trading-on-pacifica/spot-collateral).
### Exceptions to Unified Margin
* A spot asset can be excluded from unified margin at the account level by setting `unified_margin_excluded` (this can be done on the portfolio page). The balance remains usable for spot trading but contributes zero collateral for perpetual margining.
* Assets with `collateral_enabled = false` never contribute collateral regardless of account settings. (currently all spot assets contribute collateral)
### Subaccounts
Subaccounts are margined independently. Spot collateral and USDC held in a subaccount back only that subaccount's positions. Assets can be moved between a master account and its direct subaccounts via [subaccount spot transfers](/trading-on-pacifica/deposits-and-withdrawals#subaccount-spot-transfers).
# Vaults
Source: https://docs.pacifica.fi/vaults
A vault is a managed trading pool deployed by a Pacifica user. Depositors contribute USDC; a designated manager (vault manager) trades the pooled balance on Pacifica. Profits and losses are distributed to depositors according to the vault's configuration.
A vault is a real Pacifica trading account, and is subject to the same Margin, leverage, mark-price, and trading rules by default.
The vault's balance, however, is collectively owned by its depositors via shares. The trading actions the manager can take are additionally bounded by configurable trading constraints set at vault creation.
### Roles
| Role | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Creator** | The address that calls `create_lake` and pays the creation fee. The creator chooses the vault's configuration and can later update a small set of post-creation-mutable parameters. |
| **Manager** | The address authorized to place orders for the vault. Set at creation, or claimed afterward via `claim_lake_manager` on a manager-less vault. The manager also deposits capital and holds Manager Shares. |
| **LP / Depositor** | Any address that deposits into the vault. Receives LP Shares proportional to the vault's NAV at deposit time. |
The creator and manager may be the same address, different addresses, or - for a fresh vault - the manager seat may be left open for a third party to claim later.
### Share Classes
A vault tracks two independent share classes against the same pool of capital:
* **Manager Shares** are minted when the manager deposits and burned when the manager withdraws. They give the manager a claim on the manager-side balance and route their share of profits/losses through the manager's economics (including the performance fee on profits above the high-water mark).
* **LP Shares** are minted to any other depositor and follow the LP-side balance.
Each share class has its own `balance` and `share count`, but both classes own a single underlying account balance and a single set of positions. PnL is split between the two classes pro-rata before any per-class economics apply. See [Profit & Loss](/vaults/profit-and-loss).
### Lifecycle
1. **Create.** Creator pays the creation fee and chooses a configuration. The vault is assigned a fresh address and starts empty.
2. **Seed.** The creator may seed the vault in the same call, or the manager (if different) may deposit later. A vault with `manager_min_balance_portion` set must satisfy that floor before LP capital is accepted by the deposit cap.
3. **Operate.** The manager places orders for the vault subject to its symbol whitelist, blacklist, and per-symbol leverage caps. LPs deposit and withdraw within the configured cooldowns and withdrawal windows.
4. **Halt or wind-down.** If the manager's balance share falls below the configured liquidation portion, the engine halts trading and liquidates open positions. The manager can lift the halt by depositing back to the minimum balance portion. A vault with no remaining capital can be left dormant indefinitely.
### Per-Page Guide
* [Depositing](/vaults/depositing) - for users putting USDC into a vault. Covers share accounting, withdrawals, and what to evaluate before depositing.
* [Managing a Vault](/vaults/managing-a-vault) - for vault creators and managers. Covers configuration, mutability, and operating constraints.
* [Profit & Loss](/vaults/profit-and-loss) - how PnL is distributed between LP and Manager Shares, the performance fee, and the high-water mark.
* [Risk Controls](/vaults/risk-controls) - symbol whitelists, leverage caps, manager balance requirements, trading halt, and vault liquidation.
# Depositing Into a Vault
Source: https://docs.pacifica.fi/vaults/depositing
This page covers what a depositor (LP) needs to know before, during, and after depositing into a vault. Vault concepts and roles are described in the [Vaults overview](/vaults).
### Before Depositing
A vault is a discretionary trading pool. Depositors take on the trading risk taken by the manager, capped at their deposited capital. Pacifica does not vet, audit, or insure third-party vault managers. Treat depositing into a vault the same way you would treat sending capital to any external trader.
Before depositing, review:
* The manager address, the creator address, and any nickname. The creator can change a small set of trading parameters after creation (see [Managing a Vault → Mutability](/vaults/managing-a-vault#mutability)).
* The current symbol whitelist, blacklist, and per-symbol leverage caps. These define what the manager is permitted to trade.
* `manager_profit_share` and `deposit_min_duration_ms`. These determine your fees and your minimum lock-up.
* `withdraw_window_s` and `withdraw_duration_s` if set. These determine when withdrawals are open.
* The current balance, the current LP share count, and the current open positions. These define the NAV at which your shares will be priced.
### How Shares Are Priced on Deposit
A deposit is converted into LP shares against the vault's net asset value at the moment of deposit. The vault's NAV is the lake account's equity (USDC balance plus unrealized PnL on all open positions, marked to mark price), with the period's PnL first attributed to existing shareholders.
```
NAV_per_share_before_deposit = lp_balance / lp_shares (after accumulated PnL is credited)
shares_minted = amount / NAV_per_share_before_deposit
= amount * lp_shares / lp_balance
```
If the vault is empty for the LP class (`lp_shares == 0`), shares are minted 1:1 (1 share per 1 USDC).
The first step of a deposit is always a "ledger sync" that credits the period's profit or loss to the existing share classes. New shares are then minted at the post-sync NAV, so depositors do not capture or share in PnL that accrued before their deposit. See [Profit & Loss → Profit Attribution](/vaults/profit-and-loss#profit-attribution) for the formula.
### Deposit Constraints
| Constraint | Source | Effect |
| ----------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Minimum deposit | Constant 10 USDC. | Smaller amounts are rejected. |
| Deposit cap | Vault config `deposit_cap`. | Total LP balance after the deposit cannot exceed the cap. The manager's own deposits are not counted against the cap. |
| Available balance | Standard cross-margin check. | The depositor must have sufficient `available_to_withdraw` to cover the deposit, exactly as for any other USDC outflow. |
### Withdrawing
Withdrawals are denominated in shares. The amount returned is your proportional claim on the LP-side balance after the period's PnL has been credited.
```
NAV_per_share_at_withdraw = lp_balance / lp_shares (after ledger sync)
amount_withdrawn = shares_redeemed * NAV_per_share_at_withdraw
= shares_redeemed * lp_balance / lp_shares
```
A withdrawal is permitted only if all of the following hold:
* The depositor holds at least the requested number of shares.
* If `deposit_min_duration_ms > 0` is configured, at least that many milliseconds have elapsed since the depositor's most recent deposit. Each new deposit resets the timer for the depositor's entire share balance, not just the new shares.
* If `withdraw_window_s` and `withdraw_duration_s` are configured, the current time falls within an open window. The window check is `current_unix_time_s mod withdraw_window_s < withdraw_duration_s`, which means windows are anchored to the Unix epoch (1970-01-01 00:00:00 UTC), not to the vault's creation time. For example, with `withdraw_window_s = 86400` (1 day) and `withdraw_duration_s = 3600` (1 hour), withdrawals are open from 00:00 to 01:00 UTC every day.
* The vault has sufficient `available_to_withdraw`. This is the lake account's free balance after subtracting margin reserved for open positions and orders. If the manager has the vault fully deployed in positions, withdrawals may be partially unfilled until the manager closes or de-risks.
The redeemed amount is paid in USDC into the depositor's account immediately. The vault's high-water mark is reduced by the same dollar amount paid out, so future performance fees are charged on profit relative to the post-withdrawal balance rather than the pre-withdrawal peak. See [Profit & Loss → High-water mark](/vaults/profit-and-loss#high-water-mark) for the exact behavior under deposits and withdrawals.
### Risks
A depositor in a vault can lose up to their entire deposit. There is no Pacifica-funded backstop for vault losses beyond the standard exchange liquidation engine that protects the broader orderbook.
Specific exposures to be aware of:
* **Trading risk.** The manager's positions can lose money. Losses are taken from the LP balance pro-rata with the manager's balance. Cross-margin liquidations reduce the vault's USDC and may force a withdrawal queue if the lake account's `available_to_withdraw` drops to zero.
* **Manager risk.** The manager has discretion within the configured constraints. The creator may also widen those constraints over time (e.g., adding symbols to the whitelist). See [Managing a Vault → Mutability](/vaults/managing-a-vault#mutability).
* **Liquidity risk.** Withdrawals require the vault to have free balance. Large drawdowns or fully-deployed positions can delay withdrawals until the manager closes positions or until liquidations run.
* **Window risk.** A vault with a withdrawal window restriction is not redeemable outside the window. Plan around the configured cycle.
* **Counterparty risk.** A vault deployed by a third party is not Pacifica-operated and is not insured by Pacifica. Treat it accordingly.
### Where to Find Vault State
Vault metadata, configuration, current balances, and share counts are exposed through the standard account and vault endpoints (documented separately under API Documentation). The vault's address is a normal Pacifica account address and can also be inspected on the trading interface like any other account.
# Managing a Vault
Source: https://docs.pacifica.fi/vaults/managing-a-vault
This page covers the manager and creator side of a vault: deploying it, choosing its parameters, and operating it day-to-day. Depositor mechanics are described in [Depositing](/vaults/depositing).
### Creating a Vault
Vault creation is a single signed call. The creator provides:
* An optional `manager` address. If omitted, the vault is created as a "fresh vault" with no manager - any address can later [claim the manager seat](#claiming-a-fresh-vault).
* An optional `nickname`, for display on the vaults page. Nicknames are unique across all vaults.
* An optional [configuration](#configuration) object. If omitted, the default configuration applies (no caps, no fees, no cooldowns, no symbol restrictions).
* An optional seed deposit. If provided, the same call also performs a `deposit_to_lake` from the creator into the new vault.
A creation fee of 10 USDC is charged to the creator at vault creation. The vault is assigned a freshly-generated address and starts with zero balance, zero shares, and zero positions.
A vault may itself be designated as the manager of another vault (a "subvault"). Subvaults are limited to one level of nesting.
### Claiming a Fresh Vault
A fresh vault (created without a manager) can have its manager seat claimed by any address via a signed `claim_lake_manager` call. Claiming requires:
* An initial deposit of at least 10 USDC.
* If the vault was created with `manager_min_balance_portion` set, the post-claim manager balance ratio must satisfy `manager_balance / (manager_balance + lp_balance) >= manager_min_balance_portion`.
Once claimed, the manager seat is permanent for the lifetime of the vault.
### Configuration
A vault's behavior is governed by a `LakeConfig`. Some fields are fixed at creation; others can be updated by the creator. All fields are optional. Where a field is `None` the vault behaves as if no constraint of that kind exists.
| Field | Mutable? | Description |
| ------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `deposit_cap` | Yes (creator) | Maximum total LP balance accepted by the vault. The manager's own deposits do not count against the cap. `None` = uncapped. |
| `whitelist` | Yes (creator) | Symbols the manager is permitted to trade. `None` = all listed symbols allowed. |
| `blacklist` | Yes (creator) | Symbols the manager is blocked from trading, applied after the whitelist. A symbol in both lists is blocked. `None` = no blocked symbols. |
| `max_leverages` | Yes (creator) | Per-symbol leverage caps for orders placed by the vault. `None` = the symbol's exchange-default max leverage applies. |
| `manager_profit_share` | No | Fraction of profits above the high-water mark routed to the manager as a performance fee, in `[0, 1]`. `None` = no fee. See [Profit & Loss](/vaults/profit-and-loss). |
| `deposit_min_duration_ms` | No | Minimum time (in milliseconds) a depositor's funds must remain in the vault before they can be withdrawn. Reset on every new deposit by the same depositor. |
| `manager_min_balance_portion` | No | Minimum manager-balance ratio required to claim the manager seat and to lift a trading halt. In `[0, 1]`. |
| `manager_liquidation_balance_portion` | No | Manager-balance ratio at which the engine halts the vault and liquidates open positions. In `[0, 1]`. Must be strictly less than `manager_min_balance_portion` if both are set. |
| `withdraw_window_s` | No | Period of the withdrawal-window cycle in seconds. Must be in `[1 hour, 90 days]`. Set together with `withdraw_duration_s`. |
| `withdraw_duration_s` | No | How many seconds out of each `withdraw_window_s` period are open for withdrawals. Must be in `[1 hour, 30 days]` and strictly less than `withdraw_window_s`. |
#### Mutability
Only the creator can update mutable fields. Updates take effect immediately on the next operation.
The non-mutable fields are deliberately fixed at creation: they govern the vault's economics, withdrawal cadence, and risk thresholds.
### Operating the Vault
The vault is a real Pacifica account. The manager places orders for it through the Pacifica frontend or by using the standard order endpoints, signed by the manager's wallet or by an [agent key](/api-documentation/api/signing/api-agent-keys) bound to the manager's address.
All Pacifica trading rules apply unchanged: order types, margin model, mark price, funding, liquidation. See [Trading on Pacifica](/trading-on-pacifica/overview).
The manager is also subject to the standard exchange-wide constraints such as rate limits and individual deposit requirements for the vault account itself.
### Manager Economics
Manager Shares and LP Shares are separate share classes against the same underlying balance and positions.
* The manager's deposits and withdrawals follow the same minimum amount and the same `available_to_withdraw` constraints, and the same period-PnL ledger sync as LP deposits and withdrawals.
* `deposit_min_duration_ms` and `withdraw_window_s/duration_s` apply to manager withdrawals as well.
* When a vault is configured with `manager_min_balance_portion`, the manager must satisfy the threshold to claim the seat and to lift a trading halt. See [Risk Controls → Manager Balance Portion](/vaults/risk-controls#manager-balance-portion).
The manager's earnings come from two sources:
1. The pro-rata return on Manager Shares, identical in form to an LP's return.
2. The performance fee on profits above the high-water mark, set by `manager_profit_share`. The fee is credited to `manager_balance` and accrues to Manager Shares automatically. See [Profit & Loss → Performance fee](/vaults/profit-and-loss#performance-fee).
# Profit & Loss
Source: https://docs.pacifica.fi/vaults/profit-and-loss
A vault holds a single account balance and a single set of positions. Realized and unrealized PnL accrue to that one account, and the vault then attributes the change to its two share classes (LP and Manager) before any deposit or withdrawal touches the share count.
### Profit Attribution
If PnL over a period is positive, the manager first takes a performance fee on profits above the vault's high-water mark. The remainder is split pro-rata between LP and Manager balances by their share of the previous period's total balance.
```
fee_eligible_profit = max(current_equity - high_watermark, 0)
performance_fee = fee_eligible_profit * manager_profit_share
remaining_pnl = period_pnl - performance_fee
lp_ratio = lp_balance / (lp_balance + manager_balance)
mgr_ratio = manager_balance / (lp_balance + manager_balance)
lp_delta = remaining_pnl * lp_ratio
mgr_delta = remaining_pnl * mgr_ratio + performance_fee
high_watermark = max(high_watermark, current_equity)
```
If `manager_profit_share` is unset it defaults to zero and no performance fee is taken.
#### Performance Fee
The performance fee is charged only on equity above the previous all-time high (the "high-water mark", or HWM). If the vault has been at a loss since its last peak, no performance fee accrues until the prior peak has been recovered.
#### High-Water Mark
The HWM moves monotonically upward through trading PnL. It also tracks deposits and withdrawals so that they do not artificially trigger or skip the performance fee:
* On a deposit, the HWM increases by the deposit amount. New capital does not retroactively earn or pay performance fees on the prior peak.
* On a withdrawal, the HWM is reduced by the gross dollar amount paid out. The profit/loss of the vault is accounted for upon withdrawal with regard to calculating the HWM.
The HWM never moves down through trading. Drawdowns must be recovered before the manager earns another performance fee.
### Loss Attribution
If PnL over a period is negative, the loss is split pro-rata between LP and Manager balances.
```
loss = -period_pnl
lp_ratio = lp_balance / (lp_balance + manager_balance)
mgr_ratio = manager_balance / (lp_balance + manager_balance)
lp_delta = -loss * lp_ratio
mgr_delta = -loss * mgr_ratio
high_watermark unchanged
```
### Worked Example: Profit Period
A vault with `manager_profit_share = 0.20` starts a period at:
```
lp_balance = 800
manager_balance = 200
lp_shares = 800
manager_shares = 200
high_watermark = 1000
last_checked = 1000
```
The vault trades to a new equity of `1100`. An LP deposits.
```
period_pnl = 1100 - 1000 = +100
fee_eligible_profit = max(1100 - 1000, 0) = 100
performance_fee = 100 * 0.20 = 20
remaining_pnl = 100 - 20 = 80
lp_ratio = 0.8, mgr_ratio = 0.2
lp_delta = 80 * 0.8 = 64
mgr_delta = 80 * 0.2 + 20 = 36
lp_balance -> 864 (unchanged share count: 800)
manager_balance -> 236 (unchanged share count: 200)
high_watermark -> 1100
last_checked -> 1100
```
NAV per LP share rises from 1.00 to 1.08; NAV per Manager Share rises from 1.00 to 1.18 (the manager captured both their pro-rata profit and the 20 USDC performance fee).
### Worked Example: Loss Period
A vault starts a period at:
```
lp_balance = 800
manager_balance = 200
high_watermark = 1000
last_checked = 1000
```
The vault trades to a new equity of `900`.
```
loss = 100
lp_ratio = 0.8, mgr_ratio = 0.2
lp_delta = -80
mgr_delta = -20
lp_balance -> 720
manager_balance -> 180
high_watermark -> 1000 (unchanged)
last_checked -> 900
```
The HWM is unchanged, so the manager will not earn a performance fee until equity recovers above 1000.
# Risk Controls
Source: https://docs.pacifica.fi/vaults/risk-controls
A vault is a real Pacifica account and is subject to the same liquidation engine as any other account ([Liquidations](/trading-on-pacifica/liquidations)). On top of that, vault-specific controls bound what the manager can do, when the engine forcibly halts trading, and how the manager is required to remain aligned with depositors.
This page collects those controls in one place. The economic split during PnL events is described separately in [Profit & Loss](/vaults/profit-and-loss).
### Trading Constraints on the Manager
Every order placed on a vault is checked against the vault's trading configuration in addition to the standard exchange checks.
| Constraint | Behavior |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `whitelist` | If set, the order's symbol must be in the whitelist. If unset, all listed symbols are permitted. |
| `blacklist` | If set, the order's symbol must not be in the blacklist. The blacklist is applied after the whitelist; a symbol in both lists is blocked. |
| `max_leverages[symbol]` | If set, the order's selected leverage on that symbol must not exceed this cap. If unset, the symbol's exchange-default max leverage applies. |
| `trading_halt` | If true, all order submissions on the vault are rejected. Set automatically by the liquidation worker; cleared by manager top-up (see below). |
Constraint violations are returned as errors at order submission time and do not consume any state. They are checked uniformly for both manual orders and orders placed via an [agent key](/api-documentation/api/signing/api-agent-keys).
`whitelist`, `blacklist`, and `max_leverages` can be updated by the creator at any time. Updates take effect on the next order. There is no notice period for depositors. See [Managing a Vault → Mutability](/vaults/managing-a-vault#mutability).
### Manager Balance Portion
The manager's balance portion is the manager's share of the vault's total non-position USDC equity:
```
manager_balance_portion = manager_balance / (manager_balance + lp_balance)
```
Two thresholds in the vault config govern how this ratio is enforced:
| Threshold | Configured by | Used at |
| ------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------ |
| `manager_min_balance_portion` | Creator (immutable) | Required when claiming the manager seat on a fresh vault. Required to lift a trading halt after liquidation. |
| `manager_liquidation_balance_portion` | Creator (immutable) | When the live ratio falls below this threshold, the engine halts trading and liquidates open positions. |
`manager_liquidation_balance_portion` must be strictly less than `manager_min_balance_portion` if both are set. The gap between the two acts as a buffer: the manager has room to operate without being one bad tick away from a halt, but is required to top up past the higher threshold to resume trading.
If neither portion is configured, the engine does not auto-halt the vault on manager-balance grounds, and the LP is exposed to a manager who can in principle hold zero capital in the vault.