---
title: "Update Isolated Margin"
method: PATCH
path: "/v1/trade/margin"
---

# Update Isolated Margin

`PATCH /v1/trade/margin`

Adjust the signed collateral allocation for an existing isolated position.
Use a positive amount to add margin and a negative amount to remove it.
A removal may include unrealized isolated profit, but the resulting
isolated position equity (allocation + unrealized PnL - settled funding)
must remain at or above the position's current required initial margin.

Both additions and removals are rejected while the account is in cross
liquidation or the target isolated position is in isolated liquidation.
An isolated liquidation on another instrument does not block this request.

Cancel-only mode does not gate margin adjustments.

Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).
Gateway signature validation rejects a stale or future-skewed timestamp as
`invalid signature`. A request that passes gateway validation can still fail
sequencer freshness revalidation with
`invalid_margin_signature_timestamp`. Reusing the exact signed request
rejects with `signature_already_used`.

## Request body

- MarginRequest
  - `op` OpUpdateMargin, required
    - `type` 'updateMargin', required
    - `args` object, required
      - `iid` integer, required — Instrument ID
      - `amt` string, required — Signed isolated-margin adjustment in the instrument quote asset. Positive values add allocation; negative values remove it.
  - `sig` string, required — Signature in hex format
  - `salt` integer, required — Salt
  - `ts` integer, required — Request timestamp. Unix milliseconds for most operations; Unix seconds for withdrawals (must match the on-chain EIP-712 struct verified against block.timestamp).

## Response `200`

Generic response.

- union
  - GenericAccepted
    - `status` 'ok', required
  - GenericRejected
    - `status` 'err', required
    - `error` string, required — Error identifier. For domain rejections and transport errors (`401`/`404`/`429`/`500`) this is a stable, machine-readable snake_case identifier that is part of the API contract and safe to branch on, e.g. `insufficient_margin`, `insufficient_balance`, `order_not_found`, `reduce_only_invalid`, `price_outside_bounds`, `position_not_found`, `invalid_margin_mode`, `invalid_margin_amount`, `margin_below_required_initial`, `account_liquidating`, `unauthorized`, `not_found`. For `400` it is a human-readable validation detail whose wording may change. See the Error handling guide for the domain identifiers. (Post-only / Fill-or-Kill outcomes are order statuses such as `post_only_rejected`, not rejections.)

## Other responses

- `400` — Bad request — the request was malformed or failed validation (bad query parameters, unparseable body, invalid signature, or a domain pre-check). The `error` field is a human-readable validation detail.
- `422` — Sequenced domain rejection. Stable errors include `position_not_found`, `invalid_margin_mode`, `invalid_margin_amount`, `insufficient_margin`, `account_liquidating`, `margin_below_required_initial`, and `signature_already_used`. `invalid_margin_signature_timestamp` specifically indicates that sequencer freshness revalidation rejected a request that passed gateway validation.
- `429` — Too Many Requests. `error` distinguishes the limit that was hit: `ip_rate_limited` (per-IP token bucket), `action_rate_limited` (per-account action rate), or `open_orders_limit` (resting open-order cap).
- `500` — Internal server error or timeout. The outcome may be indeterminate if the request was sequenced but its Risk decision did not reach the gateway before the timeout. Before retrying, refresh the position using `GET /v1/account/portfolio`.

---

[API](https://skmtc.net/polymarket/apis/polymarket-perps-http-api.md) · [All operations](https://skmtc.net/polymarket/apis/polymarket-perps-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/polymarket/polymarket-perps-http-api/versions/e17c4709273e/schema)
