Skip to main content

FX Status Change Webhook

Overview

The FX_STATUS_CHANGE webhook is triggered when a foreign exchange trade order updates its execution state (such as transitioning from Pending or Scheduled to Completed or Expired).

Webhook Delivery

  • HTTP Method: POST
  • Destination: Your configured server webhook endpoint
  • Content-Type: application/json

Webhook Headers

HeaderValueDescription
Content-Typeapplication/jsonRequest body media type
x-webhook-eventFX_STATUS_CHANGEIdentifier of the dispatched event type
x-webhook-timestampISO 8601 stringTimestamp when the event was dispatched

Event Payload

{
"fxOrderId": "fx_983745",
"oldStatus": "Pending",
"newStatus": "Completed",
"updatedAt": "2025-03-21T11:00:00Z"
}

Payload Fields

FieldTypeRequiredDescription
fxOrderIdstringYesUnique identifier for the foreign exchange order.
oldStatusstringYesThe preceding status of the FX order (e.g. Pending, Scheduled).
newStatusstringYesThe updated status of the FX order (e.g. Completed, Failed, Expired).
updatedAtstring (ISO Date)YesUTC timestamp when the state transition occurred.

Expected Server Response

Return an HTTP 200 OK status to acknowledge receipt:

{
"received": true
}

Implementation Examples

Node.js (Express)

const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhook', (req, res) => {
const eventType = req.headers['x-webhook-event'];
const { fxOrderId, oldStatus, newStatus, updatedAt } = req.body;

if (eventType === 'FX_STATUS_CHANGE') {
console.log(`FX Order ${fxOrderId} changed from ${oldStatus} to ${newStatus} at ${updatedAt}`);
// Handle settlement or notify client
}

res.status(200).json({ received: true });
});

app.listen(3000, () => console.log('FX Webhook listener running on port 3000'));

Python (Flask)

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def handle_webhook():
event_type = request.headers.get('x-webhook-event')
data = request.json or {}

if event_type == 'FX_STATUS_CHANGE':
fx_order_id = data.get('fxOrderId')
old_status = data.get('oldStatus')
new_status = data.get('newStatus')
updated_at = data.get('updatedAt')
print(f"FX Order {fx_order_id} is now {new_status} (previously {old_status}) at {updated_at}")

return jsonify({"received": True}), 200

if __name__ == '__main__':
app.run(port=3000)

Interactive Webhook Schema Explorer