curl -X POST https://api.flux.dev/v1/webhooks \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook"
}'
const webhook = await flux.webhooks.create({
url: 'https://api.yourapp.com/webhooks/flux',
events: ['order.completed', 'user.signup'],
description: 'Production webhook'
});
webhook = flux.webhooks.create(
url="https://api.yourapp.com/webhooks/flux",
events=["order.completed", "user.signup"],
description="Production webhook"
)
{
"id": "wh_abc123",
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook",
"status": "active",
"secret": "whsec_a1b2c3d4e5f6...",
"created": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "invalid_request",
"message": "URL must use HTTPS",
"param": "url"
}
}
Webhooks
Create Webhook
Register a new webhook endpoint
POST
/
v1
/
webhooks
curl -X POST https://api.flux.dev/v1/webhooks \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook"
}'
const webhook = await flux.webhooks.create({
url: 'https://api.yourapp.com/webhooks/flux',
events: ['order.completed', 'user.signup'],
description: 'Production webhook'
});
webhook = flux.webhooks.create(
url="https://api.yourapp.com/webhooks/flux",
events=["order.completed", "user.signup"],
description="Production webhook"
)
{
"id": "wh_abc123",
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook",
"status": "active",
"secret": "whsec_a1b2c3d4e5f6...",
"created": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "invalid_request",
"message": "URL must use HTTPS",
"param": "url"
}
}
Creates a new webhook endpoint. When events matching the specified types occur, Flux will send a POST request to this URL.
string
required
The URL to receive webhook events. Must be HTTPS.
string[]
required
Array of event types to subscribe to. Use
["*"] to receive all events.string
A description for this webhook endpoint.
curl -X POST https://api.flux.dev/v1/webhooks \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook"
}'
const webhook = await flux.webhooks.create({
url: 'https://api.yourapp.com/webhooks/flux',
events: ['order.completed', 'user.signup'],
description: 'Production webhook'
});
webhook = flux.webhooks.create(
url="https://api.yourapp.com/webhooks/flux",
events=["order.completed", "user.signup"],
description="Production webhook"
)
{
"id": "wh_abc123",
"url": "https://api.yourapp.com/webhooks/flux",
"events": ["order.completed", "user.signup"],
"description": "Production webhook",
"status": "active",
"secret": "whsec_a1b2c3d4e5f6...",
"created": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "invalid_request",
"message": "URL must use HTTPS",
"param": "url"
}
}
Save the
secret from the response. You’ll need it to verify webhook signatures. This is the only time the secret is returned.