Account
Configure a webhook to receive results via push instead of polling. When a webhook is configured, the API sends an HTTP POST to your URL when analysis completes. The webhook payload contains the job result — see Response Schema for field definitions. For when to use webhooks and implementation best practices, see Production Checklist — Webhooks.
POST /v2/account/webhook
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| url | string | Required | HTTPS URL where webhooks are sent. Must be publicly accessible. |
| secret_key | string | Required | Secret used to sign webhook payloads. Store securely and use only for signature verification on your server. |
Example
curl -X POST "https://api.amplifierhealth.com/v2/account/webhook" \
-H "X-Account-ID: your-account-id" \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"url":"https://your-server.com/webhooks/amplifier","secret_key":"your-webhook-secret"}'How webhooks work
- Webhooks are sent asynchronously when analysis completes successfully.
- The API sends an HTTP POST to your configured URL with a JSON payload.
- If your endpoint is unavailable or returns a non-2xx status, the system retries delivery up to 5 times with increasing delays. Respond within 30 seconds to avoid timeout.
Webhook request format
Headers:
Content-Type: application/jsonX-Webhook-Signature: HMAC-SHA256 signature of the raw request body (use to verify the request came from Amplifier)
Payload: The body contains the completed job result: job_id, status, use_case, result (with summary, signals, audio_quality, extended_metrics). See Response Schema for field definitions.
Signature verification
To verify the webhook request came from Amplifier:
- Read the raw request body (as bytes or string) and the
X-Webhook-Signatureheader. - Compute HMAC-SHA256 of the raw body using your
secret_key. - Compare the computed value with the header using a constant-time comparison.
Example (Python only): HMAC verification is typically implemented on your server; below uses the Python standard library.
# Requires no additional packages — hmac and hashlib are Python standard library modules.
import hmac
import hashlib
def verify_webhook_signature(secret_key: str, payload_body: str, signature_header: str) -> bool:
expected = hmac.new(
secret_key.encode("utf-8"),
payload_body.encode("utf-8"),
hashlib.sha256,
).hexdigest()
return hmac.compare_digest(expected, signature_header)
# In your webhook handler:
# payload_body = request.get_data(as_text=True) # or request.body.decode("utf-8")
# signature = request.headers.get("X-Webhook-Signature", "")
# if verify_webhook_signature(secret_key, payload_body, signature):
# process_job(json.loads(payload_body))Response
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the webhook was configured. |
message | string | Confirmation message. |
For implementation best practices, see Production Checklist — Webhooks.
Errors
Validation errors return 422 with a detail array. For authentication (401), rate limiting (429), and other codes, see Error Reference.
GET /v2/account/credits
Response
| Field | Type | Description |
|---|---|---|
credits | integer | Remaining credits for the account. |
If the account has no remaining credits, analyze endpoints return 402 Payment Required. Check this endpoint before submitting jobs.
Example
curl -X GET "https://api.amplifierhealth.com/v2/account/credits" \
-H "X-Account-ID: your-account-id" \
-H "X-API-Key: your-api-key"Errors
For 401 and other codes, see Error Reference.
