# Amend (modify) order **PATCH /trading/accounts/{account_id}/orders** Modify order parameters (Price/Qty). - **Targeting:** Requires `market_id` and either `order_id` OR `client_order_id`. - **Stable Identity:** `client_order_id` is immutable and used only for targeting. - **Priority Logic:** * price change OR qty increase → priority reset (order repositioned) * qty decrease (and unchanged price) → priority preserved - **Idempotency:** Guaranteed by `Idempotency-Key`. ## Servers - Production: https://api.example.com/v1 (Production) - Sandbox: https://sandbox.api.example.com/v1 (Sandbox) ## Authentication methods - Api key auth ## Parameters ### Headers - **PRE-ACCESS-KEY** (string) Broker access key identifier. - **PRE-ACCESS-SIGNATURE** (string) Keyed BLAKE2b-256 signature (hex lowercase, 64 characters). - **PRE-ACCESS-TIMESTAMP** (string(date-time)) RFC3339 timestamp with milliseconds (e.g., 2025-10-30T06:00:34.075Z). Must be within clock_skew_tolerance (default 5m) of server time. - **Idempotency-Key** (string) Stable idempotency token reused on retries. Reuse with identical payload => 202. Reuse with different payload => 409 idempotency_key_mismatch. - **Correlation-Id** (string) Optional UUIDv7 correlation identifier (lowercase). Must match RFC4122 UUIDv7 (version nibble '7', variant 8|9|a|b). If present but invalid → 422 invalid_correlation_id (error_code). ### Path parameters - **account_id** (string) Broker-supplied account identifier; length 1..128; charset [A-Za-z0-9._~-]. ### Body: application/json (object) - **market_id** (string) Required for routing - **order_id** (string(uuid)) Target order ID (preferred) - **client_order_id** (string) Target client order ID (fallback) - **price** (object) - **qty** (object) ## Responses ### 200 Amend command accepted #### Body: application/json (object) - **order_id** (string(uuid)) Internal Order ID (if known or generated). - **client_order_id** (string) Client-supplied identifier (if provided). ### 202 Idempotent replay #### Body: application/json (object) - **order_id** (string(uuid)) Internal Order ID (if known or generated). - **client_order_id** (string) Client-supplied identifier (if provided). ### 404 Resource not found #### Body: application/json (object) - **error_code** (string) - **message** (string) - **details** (object) ### 409 Idempotency-Key reused with different payload #### Body: application/json (object) - **error_code** (string) - **message** (string) - **details** (object) ### 422 Validation / semantic error #### Body: application/json (object) - **error_code** (string) - **message** (string) - **details** (object) ### 503 Backpressure / temporary unavailability #### Body: application/json (object) - **error_code** (string) - **message** (string) - **details** (object) [Powered by Bump.sh](https://bump.sh)