Replace Order
v1.orders.replace_order(strorder_id, OrderReplaceOrderParams**kwargs) -> OrderReplaceOrderResponse
PATCH/v1/accounts/{account_id}/orders/{order_id}
Replace Order
from clearstreet import ClearStreet
client = ClearStreet(
api_key="My API Key",
)
response = client.v1.orders.replace_order(
order_id="order_id",
account_id=0,
)
print(response){
"data": {
"account_id": 19816,
"client_order_id": "my-ref-id-20251001-001",
"created_at": "2025-10-31T13:30:00.000000000Z",
"filled_quantity": "0",
"id": "0195f6c7-4f64-7e3c-8b0a-1d8e4f5e6a7b",
"instrument_id": "d4d5d6d7-e4e5-f4f5-a4a5-a6a7a8a9aaab",
"instrument_type": "COMMON_STOCK",
"leaves_quantity": "10",
"limit_price": "49.00",
"order_type": "LIMIT",
"quantity": "10",
"side": "BUY",
"status": "PENDING_REPLACE",
"stop_price": null,
"symbol": "TSLA",
"time_in_force": "DAY",
"updated_at": "2025-10-31T14:10:00.000000000Z",
"venue": "XNAS"
},
"error": null,
"metadata": {
"request_id": "1d2e3f4a-5b6c-7d8e-9f0a-1b2c3d4e5f6a"
}
}{
"error": {
"code": 400,
"message": "Failed to parse the request body as JSON: expected `:` at line 2 column 14"
},
"metadata": {
"request_id": "633c15ef-d2e7-4f27-b905-2819455248bb"
}
}{
"error": {
"code": 403,
"message": "The caller does not have permission to execute the specified operation"
},
"metadata": {
"request_id": "5518f0c6-58ff-4b4a-81a5-701556d41206"
}
}{
"error": {
"code": 404,
"message": "Order 019c7b89-feea-7600-9e56-f15ef0557835 not found for account 100001"
},
"metadata": {
"request_id": "9e290ec2-378f-4d08-a729-0a9ab155acbf"
}
}Returns Examples
{
"data": {
"account_id": 19816,
"client_order_id": "my-ref-id-20251001-001",
"created_at": "2025-10-31T13:30:00.000000000Z",
"filled_quantity": "0",
"id": "0195f6c7-4f64-7e3c-8b0a-1d8e4f5e6a7b",
"instrument_id": "d4d5d6d7-e4e5-f4f5-a4a5-a6a7a8a9aaab",
"instrument_type": "COMMON_STOCK",
"leaves_quantity": "10",
"limit_price": "49.00",
"order_type": "LIMIT",
"quantity": "10",
"side": "BUY",
"status": "PENDING_REPLACE",
"stop_price": null,
"symbol": "TSLA",
"time_in_force": "DAY",
"updated_at": "2025-10-31T14:10:00.000000000Z",
"venue": "XNAS"
},
"error": null,
"metadata": {
"request_id": "1d2e3f4a-5b6c-7d8e-9f0a-1b2c3d4e5f6a"
}
}{
"error": {
"code": 400,
"message": "Failed to parse the request body as JSON: expected `:` at line 2 column 14"
},
"metadata": {
"request_id": "633c15ef-d2e7-4f27-b905-2819455248bb"
}
}{
"error": {
"code": 403,
"message": "The caller does not have permission to execute the specified operation"
},
"metadata": {
"request_id": "5518f0c6-58ff-4b4a-81a5-701556d41206"
}
}{
"error": {
"code": 404,
"message": "Order 019c7b89-feea-7600-9e56-f15ef0557835 not found for account 100001"
},
"metadata": {
"request_id": "9e290ec2-378f-4d08-a729-0a9ab155acbf"
}
}