Webhooks
Register Webhook
Register a new webhook endpoint to receive stock token events
POST
/
stocks
/
api
/
webhooks
/
register
curl -X POST "https://api.trusset.org/stocks/api/webhooks/register" \
-H "Content-Type: application/json" \
-H "X-API-Key: trusset_abc123xy_secret..." \
-d '{
"name": "Settlement System",
"webhookUrl": "https://api.example.com/webhooks/trusset"
}'
const response = await fetch(
'https://api.trusset.org/stocks/api/webhooks/register',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'trusset_abc123xy_secret...'
},
body: JSON.stringify({
name: 'Settlement System',
webhookUrl: 'https://api.example.com/webhooks/trusset'
})
}
);
const { data } = await response.json();
// Store data.apiKey and data.webhookSecret securely
{
"success": true,
"data": {
"id": "wh_abc123",
"name": "Settlement System",
"apiKey": "whk_live_...",
"webhookSecret": "whs_live_...",
"webhookUrl": "https://api.example.com/webhooks/trusset"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"error": {
"code": "INVALID_URL",
"message": "webhookUrl must use HTTPS"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
Registers a new webhook partner for the authenticated instance. Returns an API key and webhook secret used to authenticate incoming webhook deliveries. The webhook URL must use HTTPS.
Request Body
string
required
Display name for this webhook integration. Maximum 100 characters.
string
required
HTTPS URL where events will be delivered.
Response Fields
boolean
Request status.
object
The
apiKey and webhookSecret are only returned once at registration time. Store them securely.curl -X POST "https://api.trusset.org/stocks/api/webhooks/register" \
-H "Content-Type: application/json" \
-H "X-API-Key: trusset_abc123xy_secret..." \
-d '{
"name": "Settlement System",
"webhookUrl": "https://api.example.com/webhooks/trusset"
}'
const response = await fetch(
'https://api.trusset.org/stocks/api/webhooks/register',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'trusset_abc123xy_secret...'
},
body: JSON.stringify({
name: 'Settlement System',
webhookUrl: 'https://api.example.com/webhooks/trusset'
})
}
);
const { data } = await response.json();
// Store data.apiKey and data.webhookSecret securely
{
"success": true,
"data": {
"id": "wh_abc123",
"name": "Settlement System",
"apiKey": "whk_live_...",
"webhookSecret": "whs_live_...",
"webhookUrl": "https://api.example.com/webhooks/trusset"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"error": {
"code": "INVALID_URL",
"message": "webhookUrl must use HTTPS"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
⌘I
curl -X POST "https://api.trusset.org/stocks/api/webhooks/register" \
-H "Content-Type: application/json" \
-H "X-API-Key: trusset_abc123xy_secret..." \
-d '{
"name": "Settlement System",
"webhookUrl": "https://api.example.com/webhooks/trusset"
}'
const response = await fetch(
'https://api.trusset.org/stocks/api/webhooks/register',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'trusset_abc123xy_secret...'
},
body: JSON.stringify({
name: 'Settlement System',
webhookUrl: 'https://api.example.com/webhooks/trusset'
})
}
);
const { data } = await response.json();
// Store data.apiKey and data.webhookSecret securely
{
"success": true,
"data": {
"id": "wh_abc123",
"name": "Settlement System",
"apiKey": "whk_live_...",
"webhookSecret": "whs_live_...",
"webhookUrl": "https://api.example.com/webhooks/trusset"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
{
"success": false,
"error": {
"code": "INVALID_URL",
"message": "webhookUrl must use HTTPS"
},
"metadata": {
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-06-15T12:00:00.000Z",
"instanceId": "inst_abc123"
}
}
