Skip to main content

Webhooks

Send trading signals to UTM via webhooks from any source.

Overview

Webhooks allow external systems to send trading signals to UTM. This is useful for:

  • Custom trading bots
  • Third-party signal providers
  • Automated scripts
  • Any system that can make HTTP requests

Webhook URL

Send POST requests to:

https://api.universaltrademanager.com/api/v1/signals/ingest

Authentication

Include your API key in the request header:

X-API-Key: your-api-key-here

Or as a query parameter:

?apiKey=your-api-key-here
tip

Use the header method for better security. Query parameters may be logged.

Request Format

Basic Signal

POST /api/v1/signals/ingest
Content-Type: application/json
X-API-Key: your-api-key

{
"symbol": "AAPL",
"action": "openLong",
"accountId": "your-account-id",
"quantity": 100
}

Signal with Exit Rules

POST /api/v1/signals/ingest
Content-Type: application/json
X-API-Key: your-api-key

{
"symbol": "AAPL",
"action": "openLong",
"accountId": "your-account-id",
"quantity": 100,
"orderType": "LIMIT",
"limitPrice": 150.00,
"exitRules": {
"stopLoss": {
"type": "PERCENT",
"value": 2.0
},
"takeProfit": {
"type": "PERCENT",
"value": 5.0
}
}
}

Request Fields

Required Fields

FieldTypeDescription
symbolstringStock symbol (e.g., "AAPL")
actionstringSignal action (see below)
accountIdstringTarget account ID

Optional Fields

FieldTypeDefaultDescription
quantitynumber-Number of shares
quantityTypestringFIXEDHow to interpret quantity
orderTypestringMARKETOrder type
limitPricenumber-Limit price (for LIMIT orders)
stopPricenumber-Stop price (for STOP orders)
timeInForcestringDAYOrder duration
exitRulesobject-Exit rule configuration
strategyIdstring-Associated strategy
commentstring-Signal note

Signal Actions

ActionDescription
openLongOpen a long position (buy)
openShortOpen a short position (sell short)
closeLongClose a long position (sell)
closeShortClose a short position (buy to cover)
reverseToLongClose short and open long
reverseToShortClose long and open short

Quantity Types

TypeDescriptionExample
FIXEDExact number of shares100 = 100 shares
PERCENT_EQUITYPercentage of account equity10 = 10% of equity
DOLLAR_AMOUNTDollar value to invest5000 = $5,000 worth
PERCENT_POSITIONPercentage of existing position50 = half of position

Response Format

Success

{
"success": true,
"signalId": "uuid",
"status": "PENDING",
"message": "Signal received and queued for processing"
}

Error

{
"success": false,
"error": "VALIDATION_ERROR",
"message": "Invalid symbol format",
"details": [
{
"field": "symbol",
"message": "Symbol must be uppercase letters only"
}
]
}

Examples

Python

import requests

url = "https://api.universaltrademanager.com/api/v1/signals/ingest"
headers = {
"Content-Type": "application/json",
"X-API-Key": "your-api-key"
}
payload = {
"symbol": "AAPL",
"action": "openLong",
"accountId": "your-account-id",
"quantity": 100
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

cURL

curl -X POST https://api.universaltrademanager.com/api/v1/signals/ingest \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"symbol": "AAPL",
"action": "openLong",
"accountId": "your-account-id",
"quantity": 100
}'

JavaScript

const response = await fetch(
"https://api.universaltrademanager.com/api/v1/signals/ingest",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your-api-key"
},
body: JSON.stringify({
symbol: "AAPL",
action: "openLong",
accountId: "your-account-id",
quantity: 100
})
}
);

const data = await response.json();
console.log(data);

Rate Limits

Webhook requests are rate limited:

LimitWindow
100 requestsper minute

See Rate Limits for details.

Error Codes

CodeDescription
INVALID_API_KEYAPI key is missing or invalid
VALIDATION_ERRORRequest payload validation failed
ACCOUNT_NOT_FOUNDTarget account doesn't exist
MODE_MISMATCHTrading mode doesn't match account type
RATE_LIMIT_EXCEEDEDToo many requests
BROKER_ERRORBroker rejected the order

Testing

Use paper trading accounts to test your webhook integration:

  1. Create a paper trading account in UTM
  2. Get the account ID from the Accounts page
  3. Send test signals with paper mode enabled
  4. Verify signals appear in the Signals page

Best Practices

  1. Use HTTPS - Always send webhooks over HTTPS
  2. Handle errors - Check response codes and retry on failures
  3. Validate locally - Validate signal data before sending
  4. Log requests - Keep logs for debugging
  5. Use idempotency - Include unique IDs to prevent duplicates
  6. Test first - Use paper trading before live trading