Webhooks API
Configure webhooks to receive notifications about events.
List Webhooks
GET /v1/webhooks
Response:
{
"success": true,
"webhooks": [
{
"id": "wh_abc123",
"url": "https://your-server.com/webhook",
"events": ["index.complete", "security.alert"],
"active": true,
"createdAt": "2024-01-10T08:00:00Z"
}
]
}
Create Webhook
POST /v1/webhooks
Request Body:
{
"url": "https://your-server.com/webhook",
"events": ["index.complete", "security.alert"],
"secret": "your-webhook-secret"
}
Response:
{
"success": true,
"webhook": {
"id": "wh_xyz789",
"url": "https://your-server.com/webhook",
"events": ["index.complete", "security.alert"],
"active": true
}
}
Delete Webhook
DELETE /v1/webhooks/:id
Available Events
| Event | Description |
|---|---|
index.started | Indexing has started |
index.complete | Indexing completed successfully |
index.failed | Indexing failed |
security.alert | New security vulnerability found |
analysis.complete | Analysis completed |
Webhook Payload
All webhooks receive a JSON payload:
{
"event": "index.complete",
"timestamp": "2024-01-15T10:30:00Z",
"project": {
"id": "proj_abc123",
"name": "my-app"
},
"data": {
"filesCount": 234,
"symbolsCount": 1847,
"duration": 45
}
}
Verifying Signatures
Webhooks include a signature header for verification:
X-ArchiCore-Signature: sha256=abc123...
Verification (Node.js):
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(`sha256=${expected}`)
);
}
Retry Policy
Failed webhook deliveries are retried:
- Attempt 1: Immediate
- Attempt 2: After 1 minute
- Attempt 3: After 5 minutes
- Attempt 4: After 30 minutes
- Attempt 5: After 2 hours
After 5 failed attempts, the webhook is disabled.