---
title: "Prepare moving resting DeFi TP/SL orders to new trigger prices"
url: https://docs.truemarkets.co/api/gateway/prepare-modify-triggers
description: "Prepares one Hyperliquid batch modify, under the client-chosen batch id, moving each listed order to its new trigger price, and returns the single unsigned payload the client signs and posts to POST /orders/modify/{id}/execute with the same id. Reusing an id that is already prepared returns 409. Every order must be the caller's active DeFi TP/SL trigger order on the same account; each keeps the slippage bound it was placed with, scaled to its new trigger. A trigger price on the wrong side of the current price returns 400; an order that is no longer open returns 422 with code order_not_open."
---

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

# Prepare moving resting DeFi TP/SL orders to new trigger prices

Prepares one Hyperliquid batch modify, under the client-chosen batch `id`,
moving each listed order to its new trigger price, and returns the single
unsigned payload the client signs and posts to
`POST /orders/modify/{id}/execute` with the same `id`. Reusing an `id`
that is already prepared returns 409. Every order must be the caller's `active` DeFi TP/SL trigger
order on the same account; each keeps the slippage bound it was placed
with, scaled to its new trigger. A trigger price on the wrong side of the
current price returns 400; an order that is no longer open returns `422`
with code `order_not_open`.

**Rate limit:** counts against the Orders limit, 10 a second and 120 a minute (user token, per user); 100 a second and 1,200 a minute (organization api key, per organization). See [Rate limits](https://docs.truemarkets.co/developer-resources/rate-limits).

## Request

```
POST https://api.truemarkets.co/v1/gateway/orders/modify/{id}/prepare
```

### Authentication

Bearer token in `Authorization`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `TM-On-Behalf-Of` | header | string (uuid) | no | Act as one of your organization's users. The value is the `user_id` returned when the user was created; the request then reads and writes that user's account. Requires an organization token and a user your organization created: `400` for a personal token, a repeated header or a non-UUID, `403` for a user outside your organization. Not accepted on organization-scoped routes. |
| `id` | path | string (uuid) | yes | Client-chosen batch id, reused for `POST /orders/modify/{id}/execute` |

### Body

`application/json`, required

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `orders` | array of object | yes |  |
| `orders[].order_id` | string (uuid) | yes |  |
| `orders[].trigger_price` | string | yes | New trigger price, a positive decimal. |

## Responses

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

### 200

Unsigned batch payload to sign and execute

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payloads` | array of object | no | The single payload to sign for the whole batch. |
| `payloads[].digest` | string | yes | Lowercase hex SHA-256 of the `payload` bytes. A signing API that takes a pre-hashed input signs the hex-decoded digest; a library that hashes its input takes `payload` instead. Passing the hex digest to a library that hashes signs the wrong bytes. |
| `payloads[].payload` | string | yes | The exact text to sign: a Turnkey activity as JSON, including its trailing newline. Sign its UTF-8 bytes as-is with ECDSA P-256 and SHA-256; never decode, reformat or re-serialize it. |

### 400

Bad request

### 401

Unauthorized

### 403

Forbidden. On order creation this also covers an asset that is not available to trade from the country the request came from.

### 404

Not found

### 409

Conflict

### 422

Request is well-formed but cannot be processed (e.g. leverage missing or out of range for a perp order)

### 500

Internal server error
