Skip to main content

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​

NameTypeInDescription
rule_idstringpathRequired. Rule ID (24-character hex)

Headers​

NameDescription
AuthorizationRequired. Bearer <access_token>
Content-TypeRequired. application/json

Body​

FieldTypeRequiredDescription
token_idstring or nullNoToken the rule is limited to. Always written: omit or send null for a node-wide rule
node_idstringNoMoves the rule to this node
namestringNoRule name
sideintegerNo1 both, 2 buy, 3 sell
rule_typeintegerNo1 unconditional, 2 percent, 3 absolute
statusintegerNo1 inactive, 2 active
match_actionintegerNo1 accept, 2 reject. 0 is stored as 1
above_percentstringNoPercent rule: highest accepted price, as a percentage above the token's price. "0" to "100", at most one decimal
below_percentstringNoPercent rule: lowest accepted price, as a percentage below the token's price. "0" to "100", at most one decimal
above_amountstringNoAbsolute rule: highest accepted price, as an amount above the token's price (decimal string)
below_amountstringNoAbsolute rule: lowest accepted price, as an amount below the token's price (decimal string)
min_offer_quantityintegerNoSmallest matching offer quantity
max_offer_quantityintegerNoLargest matching offer quantity
priorityintegerNoLower values are tried first
valid_fromstringNoStart of the validity window (RFC 3339)
valid_untilstringNoEnd of the validity window (RFC 3339)
consume_on_matchbooleanNoStored 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​

StatusCodeDescription
40010015Validation failed — see details. Also returned when no rule has this ID (rule not found), and for a malformed percentage or amount
40010016rule_id is not a 24-character hex ID
40010001 (domain 2)The rule's node was not found
40010001 (domain 5)The rule's token was not found
40310005 (domain 2)The rule's node, or its token's node, is outside your API key's node subtree
50010000Unexpected server error

See Errors for the error format and common codes.