---
title: "Modify order"
url: https://docs.truemarkets.co/api/institutional/modify-orders-cefi
description: "Modify an existing active order request."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Modify order

Modify an existing active order request.

## Request

```
PATCH https://api.truex.co/v1/cefi/orders
```

### Authentication

Bearer token in `Authorization`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-truex-auth-timestamp` | header | string | yes | Timestamp when request was made in seconds since epoch. Must be no older than 15 seconds and no more than 1 second in the future. It guards against replayed requests. |

### Body

`application/json`, required

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no | The internal order ID of the order to be modified. This is the id that was set by the exchange and should be a purely numeric string. |
| `external_id` | string | no | The external ID for the order to be modified set by the client. Must be in one of the following formats: * **UUID** version 4 in its human readable form, with hypens, and in lowercase. * **ASCII** character string of up to 18 characters containing only the unreserved URL characters: letters (a–z, A–Z), digits (0–9), hyphen (-), underscore (\_), period (.), and tilde (~). |
| `info` | object | yes |  |
| `info.msg_id` | string | no | ID of last message to act upon the order. |
| `info.parent_id` | string | no | ID of the application creating the order, may be zero. |
| `info.client_id` | string | yes | The client ID the modification will be entered on behalf of. |
| `info.prev_modify` | string | no | ID of previous modify to act upon the order. |
| `info.new_qty` | string | yes | The new amount of base asset the order is requesting to tranasct. |
| `info.new_price` | string | yes | The new highest or lowest price the order will buy or sell, respectively, at. Only required for LIMIT orders. |
| `info.new_type` | string, one of `MARKET` | no | `LIMIT` orders may be converted to `MARKET` orders. The new `MARKET` order will immediately execute against the resting side of the order book providing there is available liquidity on the contra side of the request. |

## Responses

Every error status returns the same body, described in [Errors](https://docs.truemarkets.co/developer-resources/errors.md).

### 200

Successful operation.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no |  |
| `status` | string, one of `INITIALIZED`, `NEW_PENDING`, `REJECTED`, `ACTIVE`, `FILLED`, `CANCEL_PENDING`, `CANCELED`, `MODIFY_PENDING` | no | The current status of the order. * **INITIALIZED** Order has been created, but not sent yet. * **NEW_PENDING** Order has been sent, but not confirmed by the exchange or downstream process. * **REJECTED** An order setting or market condition prevents the order from getting processed. * **ACTIVE** The order was accepted by the system and open to trading (order and market conditions permitting). * **FILLED** The entire order traded. * **CANCEL_PENDING** Indicates a cancel request was received and being processed. * **CANCELED** The order was canceled from a cancel request, order conditions, or market conditions. * **MODIFY_PENDING** Indicates a modification request was received and being processed. |
| `order_info` | object | no |  |
| `order_info.msg_id` | string | no | ID of last message to act upon the order. |
| `order_info.parent_id` | string | no | ID of the application creating the order, may be zero. |
| `order_info.client_id` | string | yes | The client ID the order will be entered on behalf of. |
| `order_info.instrument_id` | string | yes | The ID of the instrument the order will transact in. |
| `order_info.qty` | string | yes | The amount of base asset the order is requesting to tranasct, or of quote asset when the `QUOTE_QTY` flag is set. |
| `order_info.price` | string | yes | The highest or lowest price the order will buy or sell, respectively, at. Only required for LIMIT orders; optional on MARKET orders as a worst-price cap. |
| `order_info.flags` | array of string, one of `USE_AGGRESSIVE_PRICING`, `QUOTE_QTY` | no | General order flags that can be combined and used together. * **USE_AGGRESIVE_PRICING** Applicable to market orders only. When enabled, the exchange calculates a price for the market order that is more aggressive than the current best bid or offer. This is useful when prioritizing liquidity capture over minimizing price slippage. * **QUOTE_QTY** Applicable to market orders only. `qty` is an amount of the quote asset, e.g. buy 10 PYUSD of BTC. The exchange converts it to a base quantity against the current book at entry, using only liquidity within the price band (and within `price` when one is supplied); when that liquidity falls short the order is sized to what is available rather than rejected, and it is rejected only when none is available. A buy never spends more than `qty`. Accepted and reported orders carry the converted base `qty`. |
| `order_info.side` | string, one of `BUY`, `SELL` | yes | Side of order, can be `BUY` or `SELL` * **BUY** Provide trader's quote asset to acquire the base asset. * **SELL** Provide trader's base asset to acquire the quote asset. |
| `order_info.type` | string, one of `LIMIT`, `MARKET`, `NOTIONAL_LIMIT` | yes | Type of order, can be `LIMIT`, `MARKET`, or the deprecated `NOTIONAL_LIMIT`. * **LIMIT** A specified limit price sets the maximum amount in quote currency units that the order will exchange to acquire the base currency. * **MARKET** The order uses the CeFi exchange market price at time of order entry plus/minus (for buy/sell respectively) the max price allowed by the price band risk limits for the instrument. * **NOTIONAL_LIMIT** *Deprecated — use `MARKET` with the `QUOTE_QTY` flag.* The quote amount is sent in `price` and `qty` must be zero. The exchange accepts it as `MARKET` + `QUOTE_QTY`, so the order is reported with that type and flag. |
| `order_info.tif` | string, one of `GTC`, `IOC` | no | The "Time In Force" (TIF) of an order indicates how long the order will remain active before being canceled, can be `GTC`, `IOC`. * **GTC** (Good-Till-Cancel) Order remains active for up to 30 days from the time of entry. * **IOC** (Immediate-Or-Cancel) Order will execute as much of the order as possible up to the requested price, provided there are existing orders that match or improve upon the price. An `IOC` order will cancel any unfilled quantity back to the requestor. If no matching orders are found, the `IOC` order will be canceled immediately. If the TIF is omitted, the order will default to `GTC`. |
| `order_info.exec_inst_flags` | array of string, one of `ALO`, `AON` | no | Execution specific instructions that can be combined and used together. * **ALO** Ensures the order adds liquidity to the market rather than removing it. When this flag is enabled, the order will only be placed if it would not immediately execute against the current best bid or offer. If the order would otherwise result in an immediate match, it will be canceled or adjusted based on the exchange's rules. * **AON** Requests that the order either fully executes or cancel back to user with nothing done. All or none (AON) is only valid on market orders. |
| `order_info.hold_fee_bps` | string | no | The rate used to hold fee asset against the order, in basis points of notional. This is not necessarily the fee charge associated with the order. May be supplied on a new order to hold at a higher rate than the exchange's own fee; omit it (or send "0") to hold at the exchange rate for the client's fee tiers. A rate below the exchange fee is rejected. Replaces `hold_fee_rate`, which was a decimal fraction. |
| `order_info.hold_fee_rate` | string | no | Deprecated: `hold_fee_bps` as a decimal fraction of notional. Returned for one release, then removed. Ignored on a new order; send `hold_fee_bps` instead. |
| `order_info.stp` | string, one of `INVALID`, `NONE`, `CANCEL_AGGRESSIVE`, `CANCEL_BOTH` | no | Order level self trade protection instruction. * **INVALID** Order level self trade protections are in an invalid state and may result in order rejection. * **NONE** No self trade protections are enabled for this order. * **CANCEL_AGGRESSIVE** This order will be canceled in the result of a self trade. * **CANCEL_BOTH** This order and the resting order will both be canceled in the result of a self trade. |
| `modify_info` | object | no |  |
| `modify_info.msg_id` | string | no | ID of last message to act upon the order. |
| `modify_info.parent_id` | string | no | ID of the application creating the order, may be zero. |
| `modify_info.client_id` | string | yes | The client ID the modification will be entered on behalf of. |
| `modify_info.prev_modify` | string | no | ID of previous modify to act upon the order. |
| `modify_info.new_qty` | string | yes | The new amount of base asset the order is requesting to tranasct. |
| `modify_info.new_price` | string | yes | The new highest or lowest price the order will buy or sell, respectively, at. Only required for LIMIT orders. |
| `modify_info.new_type` | string, one of `MARKET` | no | `LIMIT` orders may be converted to `MARKET` orders. The new `MARKET` order will immediately execute against the resting side of the order book providing there is available liquidity on the contra side of the request. |
| `external_id` | string | no | A unique identifier created by the client. Must be in one of the following formats: * **UUID** version 4 in its human readable form, with hypens, and in lowercase. * **ASCII** character string of up to 18 characters containing only the unreserved URL characters: letters (a–z, A–Z), digits (0–9), hyphen (-), underscore (\_), period (.), and tilde (~). |
| `ref_external_id` | string | no | A unique identifier created by the client. Must be in one of the following formats: * **UUID** version 4 in its human readable form, with hypens, and in lowercase. * **ASCII** character string of up to 18 characters containing only the unreserved URL characters: letters (a–z, A–Z), digits (0–9), hyphen (-), underscore (\_), period (.), and tilde (~). |
| `pending_qty` | string | no | Order quantity that has been acknowledge by the exchange but is not yet trading. |
| `leaves_qty` | string | no | Order quantity that is currently active in the market. |
| `executed_qty` | string | no | Amount of quantity currently executed. |
| `executed_vwap` | string | no | Volume weighted average price calculation for all executions on the order. |

### 400

Bad request.

### 401

Unauthorized.

### 403

Forbidden.

### 404

Not found.

### 408

Request timeout.

### 415

Unsupported media type.

### 500

Internal server error.

### 503

Service unavailable.
