Update OTC Order Rule by ID
Changes an existing OTC order rule. Fields you leave out keep their current values, with one exception: token_id is always written, so leaving it out (or sending null) turns the rule into a node-wide rule. Send the rule's token_id again to keep it limited to that token. The rule's node (and, for a token-limited rule, the token's node) must be inside your API key's node subtree. How rules are applied is described on Create OTC Order Rule.
When rule_type changes, the thresholds that do not belong to the new type are cleared before the body's thresholds are applied: switching to 2 (percent) clears above_amount / below_amount, switching to 3 (absolute) clears above_percent / below_percent, and switching to 1 (unconditional) clears all four.
Required permission: otc-order-rule:upsert
Request
PUT /v2/admin/otc-order-rules/{rule_id}
Parameters
| Name | Type | In | Description |
|---|---|---|---|
rule_id | string | path | Required. Rule ID (24-character hex) |
Headers
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Content-Type | Required. application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
token_id | string or null | No | Token the rule is limited to. Always written: omit or send null for a node-wide rule |
node_id | string | No | Moves the rule to this node |
name | string | No | Rule name |
side | integer | No | 1 both, 2 buy, 3 sell |
rule_type | integer | No | 1 unconditional, 2 percent, 3 absolute |
status | integer | No | 1 inactive, 2 active |
match_action | integer | No | 1 accept, 2 reject. 0 is stored as 1 |
above_percent | string | No | Percent rule: highest accepted price, as a percentage above the token's price. "0" to "100", at most one decimal |
below_percent | string | No | Percent rule: lowest accepted price, as a percentage below the token's price. "0" to "100", at most one decimal |
above_amount | string | No | Absolute rule: highest accepted price, as an amount above the token's price (decimal string) |
below_amount | string | No | Absolute rule: lowest accepted price, as an amount below the token's price (decimal string) |
min_offer_quantity | integer | No | Smallest matching offer quantity |
max_offer_quantity | integer | No | Largest matching offer quantity |
priority | integer | No | Lower values are tried first |
valid_from | string | No | Start of the validity window (RFC 3339) |
valid_until | string | No | End of the validity window (RFC 3339) |
consume_on_match | boolean | No | Stored with the rule; not used when offers are evaluated at present |
A threshold, quantity bound or validity date cannot be cleared by sending null; leaving it out keeps it. Percentages and amounts are decimal strings; see Amounts and Percentages.
Example
curl --request PUT \
--url '{{baseUrl}}/v2/admin/otc-order-rules/6910a6ab5f635dd4dc251581' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"token_id": "6909ddb65b25a8f90960506a",
"priority": 3,
"above_percent": "11",
"below_percent": "23"
}'
Response
{
"id": "6910a6ab5f635dd4dc251581",
"node_id": "6901350deb7ed8c1c38de4e9",
"token_id": "6909ddb65b25a8f90960506a",
"side": 1,
"rule_type": 2,
"match_action": 1,
"above_percent": "11",
"below_percent": "23",
"min_offer_quantity": 1,
"max_offer_quantity": 4,
"consume_on_match": false,
"priority": 3,
"status": 2,
"valid_from": "2025-11-12T01:04:12Z",
"valid_until": "2025-11-19T01:04:24Z",
"name": "Example Rule",
"created_by": "000000000000000000000000",
"created_at": "2025-11-09T14:35:23.19Z",
"updated_at": "2025-11-10T09:04:47.951Z",
"is_api": true
}
Response Fields
The updated rule, with the same fields as a row of List OTC Order Rules.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10015 | Validation failed — see details. Also returned when no rule has this ID (rule not found), and for a malformed percentage or amount |
| 400 | 10016 | rule_id is not a 24-character hex ID |
| 400 | 10001 (domain 2) | The rule's node was not found |
| 400 | 10001 (domain 5) | The rule's token was not found |
| 403 | 10005 (domain 2) | The rule's node, or its token's node, is outside your API key's node subtree |
| 500 | 10000 | Unexpected server error |
See Errors for the error format and common codes.