Webhooks
Register a webhook endpoint
POST
/webhooksAn HTTPS endpoint and the events it receives. The signing secret is returned once.
curl -X POST "https://api.facetrustai.com/v1/webhooks" \ -H "Authorization: Bearer $FACETRUST_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }'
// Node.js 18+, ES module (built-in fetch and FormData) const res = await fetch('https://api.facetrustai.com/v1/webhooks', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FACETRUST_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }), }); const data = await res.json();
import os, uuid, requests res = requests.post( "https://api.facetrustai.com/v1/webhooks", headers={"Authorization": f"Bearer {os.environ['FACETRUST_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }, timeout=15, ) res.raise_for_status() data = res.json()
curl -X POST "https://api.facetrustai.com/v1/webhooks" \ -H "Authorization: Bearer $FACETRUST_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }'
// Node.js 18+, ES module (built-in fetch and FormData) const res = await fetch('https://api.facetrustai.com/v1/webhooks', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FACETRUST_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }), }); const data = await res.json();
import os, uuid, requests res = requests.post( "https://api.facetrustai.com/v1/webhooks", headers={"Authorization": f"Bearer {os.environ['FACETRUST_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }, timeout=15, ) res.raise_for_status() data = res.json()
curl -X POST "https://api.facetrustai.com/v1/webhooks" \ -H "Authorization: Bearer $FACETRUST_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }'
// Node.js 18+, ES module (built-in fetch and FormData) const res = await fetch('https://api.facetrustai.com/v1/webhooks', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FACETRUST_API_KEY}`, 'Idempotency-Key': crypto.randomUUID(), 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }), }); const data = await res.json();
import os, uuid, requests res = requests.post( "https://api.facetrustai.com/v1/webhooks", headers={"Authorization": f"Bearer {os.environ['FACETRUST_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "url": "https://example.com/hooks/facetrust", "events": [ "scan.completed", "enrollment.completed" ] }, timeout=15, ) res.raise_for_status() data = res.json()
200 · application/json
{
"id": "wh_01JD93",
"url": "https://example.com/hooks/facetrust",
"events": [
"scan.completed",
"enrollment.completed"
],
"secret": "whsec_6b3f…shown once"
}200 · application/json
{
"id": "wh_01JD93",
"url": "https://example.com/hooks/facetrust",
"events": [
"scan.completed",
"enrollment.completed"
],
"secret": "whsec_6b3f…shown once"
}200 · application/json
{
"id": "wh_01JD93",
"url": "https://example.com/hooks/facetrust",
"events": [
"scan.completed",
"enrollment.completed"
],
"secret": "whsec_6b3f…shown once"
}Use it for
Hearing about scans and admissions as they happen, from either channel.
Headers#
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <key>, a key with the webhooks:manage scope. See Authentication. |
Idempotency-Key | No | A UUID you generate. Retrying with the same key returns the original result. See Conventions. |
Content-Type | Yes | application/json |
Body parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
url | https URL | Yes | None |
events | string[] | Yes | See Webhook events. |
Response#
Returns 200 with the body shown in the response example. Examples follow the account type selected at the top of the page.
Shown above, with the request.
Errors#
| Code | HTTP | Meaning |
|---|---|---|
unauthorized | 401 | Missing, malformed, revoked or expired API key. |
forbidden_scope | 403 | The key doesn’t have the scope this endpoint needs. |
account_type_forbidden | 403 | This endpoint isn’t available to your account type. |
module_disabled | 403 | The module is switched off for your account. Contact FaceTrust. |
ip_not_allowed | 403 | The request came from an IP outside the key’s allowlist. |
rate_limited | 429 | Too many requests. Wait for Retry-After seconds. |
validation_failed | 422 | The request body failed validation; see fields for per-field errors. |