Organization
Delete a trading rule
Delete a trading rule. Admin only.
Cannot delete if:
- The rule is used by any trading plans
You must first reassign or delete the trading plans that use this rule before deleting it.
Example:
curl -X DELETE "https://api.example.com/platform/v1/organization/trading-rules/{ruleId}" \
-H "X-API-Key: hp_live_your_key_here"
Error Codes:
| Code | Description |
|---|---|
RULE_NOT_FOUND | No rule exists with this ID |
RULE_NOT_IN_ORG | Rule belongs to a different organization |
RULE_IN_USE | Rule is used by trading plans or accounts — see hint in the response for how to resolve |
ADMIN_REQUIRED | Only admins can delete rules |
DELETE
/
v1
/
organization
/
trading-rules
/
{ruleId}
Delete a trading rule
curl --request DELETE \
--url https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
headers = {"Authorization": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<api-key>'}};
fetch('https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Trading rule deleted successfully",
"data": {
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Deleted Rule Name",
"deleted": true
}
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "This rule does not belong to your organization",
"code": "RULE_NOT_IN_ORG"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Trading rule not found",
"code": "RULE_NOT_FOUND"
}{
"statusCode": 409,
"error": "Conflict",
"message": "Cannot delete rule: it is used by 2 trading plan(s): 50K Challenge, 100K Challenge",
"code": "RULE_IN_USE",
"hint": "Point those plans at another rule first (PATCH /platform/v1/organization/trading-plans/{planId} with {\"tradingRuleId\": \"...\"}), then retry the delete."
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}Authorizations
BearerX-API-Key
JWT Bearer token for user session auth. Format: "Bearer {token}". Used by User and Organization endpoints.
Path Parameters
The rule ID to delete
⌘I
Delete a trading rule
curl --request DELETE \
--url https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId} \
--header 'Authorization: <api-key>'import requests
url = "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
headers = {"Authorization": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<api-key>'}};
fetch('https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Trading rule deleted successfully",
"data": {
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Deleted Rule Name",
"deleted": true
}
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "This rule does not belong to your organization",
"code": "RULE_NOT_IN_ORG"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Trading rule not found",
"code": "RULE_NOT_FOUND"
}{
"statusCode": 409,
"error": "Conflict",
"message": "Cannot delete rule: it is used by 2 trading plan(s): 50K Challenge, 100K Challenge",
"code": "RULE_IN_USE",
"hint": "Point those plans at another rule first (PATCH /platform/v1/organization/trading-plans/{planId} with {\"tradingRuleId\": \"...\"}), then retry the delete."
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}