ADVANCED

Webhooks

Webhooks

TradeLayer can send webhooks to your platform for important events like filled orders, liquidations, or challenge completion.

Configure Webhook Endpoint

POST /webhooks (admin)

1{
2  "url": "https://myplatform.com/tradelayer/webhook",
3  "secret": "my_webhook_secret",
4  "events": [
5    "order.filled",
6    "position.liquidated",
7    "challenge.completed"
8  ]
9}

Webhook Payload Example: Order Filled

1{
2  "event": "order.filled",
3  "created_at": 1700483075000,
4  "signature": "hmac_sha256(payload, secret)",
5  "data": {
6    "user_id": "tl_user_9e8127",
7    "external_user_id": "user_12345",
8    "order_id": "tl_ord_8192837",
9    "symbol": "BTCUSDT",
10    "side": "BUY",
11    "filled_size": "0.01",
12    "avg_fill_price": "92000.0",
13    "realized_pnl": "0.00"
14  }
15}

Server Response

Your server should respond:

1HTTP/1.1 200 OK