πWebhook
The Webhook feature allows you to receive real-time HTTP POST notifications whenever trading events occur on your MetaCopier accounts. This enables you to build custom integrations, dashboards, alerting systems, or automated workflows.
Overview
When enabled, MetaCopier sends a JSON payload to your HTTPS endpoint whenever one of the subscribed events fires. You can configure authentication, delivery behavior, and payload content.
Supported Events
POSITION_OPENED
position.opened
A new position was opened on the account
POSITION_CLOSED
position.closed
A position was closed on the account
HISTORY_UPDATED
history.updated
The trade history was updated
Setup
Account Level
Navigate to your Account β Features
Click the + button and select Webhook
Configure the webhook settings and save
Project Level
Navigate to your Project β Webhooks panel in the sidebar
Fill in the configuration form and save
At the project level, the webhook applies to all accounts in that project. Only one webhook can be configured per project.
Configuration
General
Enable webhook
Toggle delivery on/off without losing the configuration
Endpoint URL
Your HTTPS endpoint (must start with https://)
Description
Optional label for your reference
Authentication
None
No authentication header is sent
HMAC-SHA256
A signature is computed over the payload and sent in the X-Webhook-Signature header
Bearer Token
Your token is sent as Authorization: Bearer <token>
HMAC-SHA256 Details
When HMAC-SHA256 is selected:
The signature is computed as
HMAC-SHA256(secret, payload_body)and sent hex-encoded in theX-MetaCopier-Signatureheader.If Include timestamp in signature is enabled, a
X-MetaCopier-Timestampheader is sent (value in milliseconds) and the signature is computed overtimestamp.payload_bodyfor replay protection.The secret must be at least 32 characters. You can use the Generate button to create a cryptographically secure key.
Delivery Configuration
Max retries
Number of retry attempts on failure
0β5
3
Retry delay (ms)
Initial delay between retries (exponential backoff: delay Γ 2^attempt)
500β30000
2000
Timeout (sec)
HTTP request timeout
5β60
30
Rate limit/min
Maximum deliveries per minute (0 = unlimited)
0β1000
60
Payload Options
Include position details
Include symbol, volume, prices, profit in the payload
true
Include account metadata
Include broker name and login number
false
Custom Headers
You can add up to 10 custom HTTP headers that will be included with every webhook request. This is useful for routing, API keys in downstream systems, or correlation IDs.
Reserved header names are blocked: Content-Type, Authorization, and any header starting with X-MetaCopier-.
Payload Format
All webhook payloads are sent as Content-Type: application/json with a POST request. Fields with null values are excluded from the JSON.
Example: Position Opened
Example: Position Closed
Example: History Updated
When Include position details is disabled, the position field is omitted entirely.
When Include account metadata is disabled, the accountMetadata field is omitted.
Position Fields Reference
id
string
Position ticket ID
symbol
string
Trading symbol (e.g. EURUSD)
orderType
string
Buy, Sell, BuyLimit, SellLimit, etc.
volume
number
Lot size
openPrice
number
Entry price
closePrice
number
Exit price (only on close events)
stopLoss
number
Stop loss price
takeProfit
number
Take profit price
openTime
string
ISO 8601 open timestamp
closeTime
string
ISO 8601 close timestamp (only on close events)
profit
number
Gross profit
netProfit
number
Profit after swap and commission
swap
number
Swap/rollover charges
commission
number
Trading commission
comment
string
Position comment
magicNumber
string
Magic number identifier
Headers Sent
Every webhook request includes these headers:
Content-Type
Always application/json
X-MetaCopier-Delivery-Attempt
The delivery attempt number (starts at 1)
X-MetaCopier-Timestamp
Unix timestamp in milliseconds (when HMAC with timestamp is enabled)
X-MetaCopier-Signature
HMAC-SHA256 hex signature (when HMAC auth is configured)
Authorization
Bearer <token> (when Bearer Token auth is configured)
Custom headers
Any custom headers you configured
Client-Side Implementation
Below are examples showing how to receive and verify webhook requests on your server.
C#
Java
TypeScript
Python
Go
Best Practices
Always verify signatures - Never trust incoming webhooks without validating the HMAC signature.
Check timestamp freshness - Reject requests with timestamps older than 5 minutes to prevent replay attacks.
Respond quickly - Return a
200 OKas soon as possible. Process the event asynchronously if your logic is slow.Handle retries idempotently - The same event may be delivered multiple times. Use the position
idandtimestampto deduplicate.Use HTTPS - MetaCopier only delivers webhooks to
https://endpoints.Monitor failures - If your endpoint returns errors consistently, check your server logs and ensure the endpoint is accessible.
Troubleshooting
Not receiving webhooks
Ensure the webhook is enabled and your endpoint returns 200
Signature verification fails
Check that your secret matches exactly and you're using UTF-8 encoding
Stale timestamp errors
Ensure your server clock is synchronized (NTP)
Rate limited
Increase the Rate limit/min setting or optimize your endpoint speed
Last updated