Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pacifica-fi/docs-migrate/llms.txt

Use this file to discover all available pages before exploring further.

The Orders endpoints cover the full order lifecycle on Pacifica: placing market and limit orders, attaching take-profit and stop-loss targets, editing and cancelling orders individually or in bulk, submitting batch operations, and querying open orders and history. All mutating endpoints (POST) require a cryptographic signature.
All POST endpoints on this page require request signing. See the Authentication guide for details on how to generate a valid signature.

POST /api/v1/orders/create_market — Create Market Order

Submits a new market order with optional take-profit and stop-loss levels.
This endpoint requires a signed request. Set the type header field to "create_market_order" when generating your signature. See Authentication.To protect liquidity providers from adverse selection, all market orders are subject to a ~200 ms delay before execution.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature over the request payload.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol, e.g. BTC.
amount
string
required
Order amount in the asset’s base unit, e.g. "0.1".
side
string
required
Order side: "bid" (long) or "ask" (short).
slippage_percent
string
required
Maximum slippage tolerance as a percentage, e.g. "0.5" means 0.5%.
reduce_only
boolean
required
Whether the order is reduce-only.
client_order_id
string
Client-defined UUID order ID, e.g. "f47ac10b-58cc-4372-a567-0e02b2c3d479".
take_profit
object
Optional take-profit stop order configuration.
stop_loss
object
Optional stop-loss order configuration (same fields as take_profit).
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
builder_code
string
Builder program code (3–16 alphanumeric characters).
{
  "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"
  },
  "expiry_window": 30000,
  "builder_code": "MYCODE"
}
Response
{
  "order_id": 12345
}
order_id
integer
Exchange-assigned ID for the newly created order.

POST /api/v1/orders/create — Create Limit Order

Submits a new limit order with optional take-profit and stop-loss levels.
This endpoint requires a signed request. Set the type header field to "create_order". See Authentication.GTC and IOC limit orders are subject to a ~200 ms taker speedbump to protect liquidity providers.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
price
string
required
Limit price, e.g. "50000".
amount
string
required
Order amount in the asset’s base unit.
side
string
required
"bid" or "ask".
tif
string
required
Time-in-force: GTC (Good Till Cancelled), IOC (Immediate or Cancel), ALO (Add Liquidity Only / Post-Only), or TOB (Top of Book).
reduce_only
boolean
required
Whether the order is reduce-only.
client_order_id
string
Client-defined UUID order ID.
take_profit
object
Optional take-profit configuration (see Create Market Order for field details).
stop_loss
object
Optional stop-loss configuration (see Create Market Order for field details).
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
builder_code
string
Builder program code (3–16 alphanumeric characters).
{
  "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",
    "trigger_price_type": "mark_price"
  },
  "stop_loss": {
    "stop_price": "48000",
    "limit_price": "47950",
    "trigger_price_type": "mark_price"
  },
  "expiry_window": 30000,
  "builder_code": "MYCODE"
}
Response
{
  "order_id": 12345
}

POST /api/v1/orders/stop/create — Create Stop Order

Creates a standalone stop or stop-limit order attached to an existing or future position.
This endpoint requires a signed request. Set the type header field to "create_stop_order". See Authentication.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
side
string
required
"bid" or "ask".
reduce_only
boolean
required
Whether the order is reduce-only.
stop_order
object
required
Stop order configuration.
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
builder_code
string
Builder program code (3–16 alphanumeric characters).
{
  "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"
  },
  "expiry_window": 30000,
  "builder_code": "MYCODE"
}
Response
{
  "order_id": 12345
}

POST /api/v1/positions/tpsl — Create Position TP/SL

Sets or replaces take-profit and stop-loss levels on an existing open position.
This endpoint requires a signed request. Set the type header field to "set_position_tpsl". See Authentication.At least one of take_profit or stop_loss must be provided.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
side
string
required
Position side: "bid" (long) or "ask" (short).
take_profit
object
Take-profit configuration (required if stop_loss is absent).
stop_loss
object
Stop-loss configuration (required if take_profit is absent).
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
builder_code
string
Builder program code (3–16 alphanumeric characters).
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "side": "bid",
  "take_profit": {
    "stop_price": "55000",
    "limit_price": "54950",
    "trigger_price_type": "mark_price"
  },
  "stop_loss": {
    "stop_price": "48000",
    "limit_price": "47950",
    "trigger_price_type": "mark_price"
  },
  "expiry_window": 30000
}
Response
{
  "success": true
}

POST /api/v1/orders/cancel — Cancel Order

Cancels a single open order by its exchange-assigned order ID or client order ID.
This endpoint requires a signed request. Set the type header field to "cancel_order". See Authentication.Cancel requests are not affected by any speedbumps.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
order_id
integer
Exchange-assigned order ID. Required if client_order_id is not provided.
client_order_id
string
Client-defined UUID order ID. Required if order_id is not provided.
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "order_id": 123,
  "expiry_window": 30000
}
Response
{
  "success": true
}

POST /api/v1/orders/cancel_all — Cancel All Orders

Cancels all open orders, either across all symbols or for a specific symbol.
This endpoint requires a signed request. Set the type header field to "cancel_all_orders". See Authentication.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
all_symbols
boolean
required
true to cancel orders across all symbols.
exclude_reduce_only
boolean
required
true to skip reduce-only orders during the bulk cancel.
symbol
string
Specific symbol to cancel orders for. Required when all_symbols is false.
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "all_symbols": true,
  "exclude_reduce_only": false,
  "expiry_window": 30000
}
Response
{
  "cancelled_count": 5
}
cancelled_count
integer
Number of orders successfully cancelled.

POST /api/v1/orders/stop/cancel — Cancel Stop Order

Cancels a stop order by its exchange-assigned ID or client order ID.
This endpoint requires a signed request. Set the type header field to "cancel_stop_order". See Authentication.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
order_id
integer
Exchange-assigned order ID. Required if client_order_id is not provided.
client_order_id
string
Client-defined UUID. Required if order_id is not provided.
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "order_id": 123,
  "expiry_window": 30000
}
Response
{
  "success": true
}

POST /api/v1/orders/edit — Edit Order

Modifies the price and/or size of an existing limit order. Editing cancels the original order and creates a new one with TIF ALO (Post-Only). The new order retains the same side and reduce-only status.
This endpoint requires a signed request. Set the type header field to "edit_order". See Authentication.Edit order is not subject to the taker speedbump. Provide either order_id or client_order_id, not both.
Request
account
string
required
User’s wallet address.
signature
string
required
Cryptographic signature.
timestamp
integer
required
Current timestamp in milliseconds.
symbol
string
required
Trading pair symbol.
price
string
required
New order price.
amount
string
required
New order amount.
order_id
integer
Exchange-assigned order ID. Required if client_order_id is not provided.
client_order_id
string
Client-defined UUID. Required if order_id is not provided.
agent_wallet
string
Agent wallet address.
expiry_window
integer
Signature expiry in milliseconds.
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "price": "90000",
  "amount": "0.5",
  "order_id": 123456789,
  "expiry_window": 30000
}
Response
{
  "order_id": 123498765
}
order_id
integer
The new exchange-assigned order ID for the edited order.

POST /api/v1/orders/batch — Batch Order

Submits up to 10 order actions atomically in a single request. Actions are executed in the order they appear and are not interleaved with other users’ orders.
Batch orders are not signed as a whole. Each individual action within the actions array must carry its own signature, timestamp, and account fields — identical to the corresponding standalone endpoint.Speedbump behaviour: The batch is delayed ~200 ms if it contains any CreateMarket actions or Create actions with TIF GTC or IOC. Batches containing only ALO/TOB orders, cancels, or TP/SL operations are not delayed.
Request
actions
array
required
Ordered list of action objects. Each action has a type string and a data object.
{
  "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
{
  "success": true,
  "data": {
    "results": [
      {
        "success": true,
        "order_id": 470506,
        "error": null
      },
      {
        "success": true
      }
    ]
  },
  "error": null,
  "code": null
}
results
array
Per-action result objects in the same order as the request.

GET /api/v1/orders — Get Open Orders

Returns all currently open orders for a given account. Request
account
string
required
Account address to filter orders.
curl "https://api.pacifica.fi/api/v1/orders?account=42trU9A5..."
Response
{
  "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
}
order_id
integer
Exchange-assigned order ID.
client_order_id
string or null
Client-defined UUID if provided at order creation.
symbol
string
Trading pair symbol.
side
string
"bid" or "ask".
price
decimal string
Order limit price.
initial_amount
decimal string
Total order size in the asset’s base unit.
filled_amount
decimal string
Amount filled so far.
cancelled_amount
decimal string
Amount cancelled.
stop_price
decimal string or null
Stop trigger price attached to the order, if any.
order_type
string
One of "limit", "market", "stop_limit", "stop_market", "take_profit_limit", "stop_loss_limit", "take_profit_market", "stop_loss_market".
stop_parent_order_id
integer or null
ID of the parent order this stop is attached to.
reduce_only
boolean
Whether the order is reduce-only.
created_at
integer
Timestamp (ms) when the order was created.
updated_at
integer
Timestamp (ms) of the last order modification.
last_order_id
integer
Exchange-wide sequential nonce for reliable event ordering.

GET /api/v1/orders/history — Get Order History

Returns a paginated summary of all historical orders for an account. Request
account
string
required
Account address.
limit
integer
Maximum number of records to return. Defaults to 100.
cursor
string
Pagination cursor. Omit to start from the most recent records.
curl "https://api.pacifica.fi/api/v1/orders/history?account=42trU9A5...&limit=100"
Response
{
  "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
}
order_id
integer
Exchange-assigned order ID.
client_order_id
string or null
Client-defined UUID if provided.
symbol
string
Trading pair symbol.
side
string
"bid" or "ask".
initial_price
decimal string
Submitted limit price.
average_filled_price
decimal string
Volume-weighted average price at which the order was filled.
amount
decimal string
Total order size in base units.
filled_amount
decimal string
Amount filled.
order_status
string
One of "open", "partially_filled", "filled", "cancelled", "rejected".
order_type
string
Order type (see Open Orders for possible values).
stop_price
decimal string or null
Stop trigger price if applicable.
stop_parent_order_id
integer or null
ID of the parent order this stop is attached to.
reduce_only
boolean
Whether the order is reduce-only.
reason
string or null
Cancellation or rejection reason: "cancel", "force_cancel", "expired", "post_only_rejected", "self_trade_prevented".
created_at
integer
Timestamp (ms) when the order was created.
updated_at
integer
Timestamp (ms) of the last modification.
next_cursor
string
Cursor for the next page.
has_more
boolean
true when additional pages exist.

GET /api/v1/orders/history_by_id — Get Order History by ID

Returns the full event history for a single order, showing every state transition including creation, fills, adjustments, and cancellation. Request
order_id
integer
required
Exchange-assigned order ID.
curl "https://api.pacifica.fi/api/v1/orders/history_by_id?order_id=13753364"
Response
{
  "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
}
history_id
integer
Unique ID for this history event.
order_id
integer
Exchange-assigned order ID.
client_order_id
string or null
Client-defined UUID if provided.
symbol
string
Trading pair symbol.
side
string
"bid" or "ask".
price
decimal string
Execution price for this event (limit price at creation, fill price at match, or limit price at cancellation).
initial_amount
decimal string
Original order size.
filled_amount
decimal string
Cumulative filled amount at the time of this event.
cancelled_amount
decimal string
Amount cancelled at the time of this event.
event_type
string
Type of order lifecycle event. Possible values: "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
Order type (see Open Orders for possible values).
order_status
string
One of "open", "partially_filled", "filled", "cancelled", "rejected".
stop_price
decimal string or null
Stop trigger price assigned to the order, if applicable.
stop_parent_order_id
integer or null
ID of the parent order this stop is attached to, if applicable.
reduce_only
boolean
Whether the order is reduce-only.
created_at
integer
Timestamp (ms) when this event was recorded.

Build docs developers (and LLMs) love