Webhooks
Webhooks push events about pods, endpoints, jobs, volumes and billing to your HTTPS endpoint, so you don't have to poll. Every delivery is signed.
The webhook object
These are organization-wide subscriptions. To get notified about a single serverless job, pass webhook on /run instead; see Job webhooks. Both use the same signature scheme.
| Name | Type | Description |
|---|---|---|
id | string | Unique ID, prefixed whk_. |
object | string | Always webhook. |
url | string | HTTPS URL that receives POST requests. |
events | string[] | Event types to deliver. ["*"] subscribes to all current and future types. |
status | enum | ENABLED or DISABLED. Webhooks failing for 3 consecutive days are disabled automatically and you are emailed. |
description | string | null | Free text. |
createdAt | string | ISO 8601 timestamp. |
updatedAt | string | ISO 8601 timestamp. |
{
"id": "whk_1p8x4m2q",
"object": "webhook",
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"billing.balance_low"
],
"status": "ENABLED",
"description": "Ops alerts",
"createdAt": "2026-10-20T10:11:12Z",
"updatedAt": "2026-10-20T10:11:12Z"
}Event types
| Type | Sent when |
|---|---|
pod.created | A pod was created and is waiting for a host (CREATED). |
pod.running | A pod reached RUNNING. |
pod.exited | A pod reached EXITED. data.object.lastExitCode tells you whether it was stopped or crashed. |
pod.terminated | A pod was terminated. |
endpoint.created | A serverless endpoint was created. |
endpoint.updated | Endpoint settings changed or a new image was rolled out. |
endpoint.deleted | A serverless endpoint was deleted. |
endpoint.worker_unhealthy | A worker crashed or failed health checks. |
job.completed | A job reached COMPLETED. |
job.failed | A job reached FAILED. |
job.timed_out | A job reached TIMED_OUT. |
job.cancelled | A job reached CANCELLED. |
volume.created | A network volume became AVAILABLE. |
volume.deleted | A network volume was deleted. |
billing.balance_low | Balance fell below your low-balance threshold. |
billing.spend_limit_reached | The monthly spend limit was reached; new resources are blocked. |
billing.invoice_created | A new invoice or receipt is available. |
New event types may be added at any time. Ignore types you do not handle.
Event payload
Each delivery is a POST with a JSON event. data.object is the full resource as the API would return it at the time of the event.
POST /hooks/apipods HTTP/1.1
Content-Type: application/json
User-Agent: Apipods-Webhooks/1.0
Apipods-Signature: t=1763485339,v1=5b0f3c9e1d7a2f48c6e0b9a4d1f37e25c8a6b0d4e9f2a7c1b3d5e8f0a2c4b6d8
Apipods-Event-Id: evt_9w3k7m2x
{
"id": "evt_9w3k7m2x",
"object": "event",
"type": "pod.exited",
"createdAt": "2026-11-18T17:02:19Z",
"data": {
"object": {
"id": "pod_8f2k1x9q",
"object": "pod",
"name": "llama-finetune",
"status": "EXITED",
"desiredStatus": "RUNNING",
"image": "apipods/pytorch:2.9.0-py3.12-cuda12.8.1",
"gpuTypeId": "NVIDIA_H100_80GB_SXM",
"gpuCount": 1,
"regionId": "eu-nl-1",
"vcpuCount": 20,
"memoryInGb": 125,
"containerDiskInGb": 50,
"volumeInGb": 100,
"volumeMountPath": "/workspace",
"networkVolumeId": null,
"templateId": null,
"startCommand": null,
"ports": [
{
"port": 8888,
"protocol": "http",
"url": "https://8f2k1x9q-8888.proxy.apipods.net"
},
{
"port": 22,
"protocol": "tcp",
"publicIp": "203.0.113.42",
"publicPort": 40122
}
],
"env": {
"HF_HOME": "/workspace/hf",
"HF_TOKEN": "{{ secrets.HF_TOKEN }}"
},
"costPerHr": 8.78,
"lastExitCode": 137,
"createdAt": "2026-11-18T09:14:02Z",
"startedAt": "2026-11-18T09:14:41Z",
"updatedAt": "2026-11-18T17:02:19Z"
}
}
}Verifying signatures
The Apipods-Signature header has the form t=<unix timestamp>,v1=<signature>. The signature is the hex-encoded HMAC-SHA256 of the string <t>.<raw request body>, keyed with the webhook's secret (whsec_7Hq2…). To verify:
- Split the header on commas and read
tandv1. - Reject the request if
tis more than 300 seconds from your current time (replay protection). - Compute the HMAC over the exact raw bytes you received, never over re-serialized JSON.
- Compare with a constant-time comparison function.
import hashlib
import hmac
import time
TOLERANCE_SEC = 300
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(item.split("=", 1) for item in header.split(","))
timestamp, signature = parts["t"], parts["v1"]
if abs(time.time() - int(timestamp)) > TOLERANCE_SEC:
return False
signed = f"{timestamp}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature)
# Flask example
from flask import Flask, abort, request
app = Flask(__name__)
@app.post("/hooks/apipods")
def apipods_webhook():
if not verify(request.get_data(), request.headers["Apipods-Signature"], WEBHOOK_SECRET):
abort(400)
event = request.get_json()
if event["type"] == "pod.exited":
notify(event["data"]["object"]["id"])
return "", 204v1 values. Accept the request if either matches.Delivery and retries
- Respond with any
2xxstatus within 10 seconds. Do slow work asynchronously after responding. - Non-
2xxresponses and timeouts are retried with exponential backoff for up to 24 hours, 8 attempts in total (after roughly 1 min, 5 min, 15 min, 1 h, 3 h, 6 h and 12 h). - Deliveries can arrive more than once and out of order. Deduplicate on the event
idand comparedata.object.updatedAtbefore acting. - Redirects are not followed. Private IP ranges and non-HTTPS URLs are rejected.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /webhooks | List webhooks |
| POST | /webhooks | Create a webhook |
| GET | /webhooks/{webhookId} | Retrieve a webhook |
| PATCH | /webhooks/{webhookId} | Update a webhook |
| DELETE | /webhooks/{webhookId} | Delete a webhook |
| POST | /webhooks/{webhookId}/test | Send a test event |
| GET | /webhooks/{webhookId}/deliveries | Recent delivery attempts |
List webhooks
/webhooksReturns webhook subscriptions in your organization.
Request
curl https://api.apipods.com/v1/webhooks \
-H "Authorization: Bearer $APIPODS_API_KEY"Response
{
"object": "list",
"data": [
{
"id": "whk_1p8x4m2q",
"object": "webhook",
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"billing.balance_low"
],
"status": "ENABLED",
"description": "Ops alerts",
"createdAt": "2026-10-20T10:11:12Z",
"updatedAt": "2026-10-20T10:11:12Z"
}
],
"hasMore": false,
"nextCursor": null
}Create a webhook
/webhooksCreates a subscription. The response contains secret, returned only this once. Store it to verify signatures.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
urlrequired | body | string | HTTPS URL. |
eventsrequired | body | string[] | Event types, or ["*"]. |
description | body | string | Free text. |
Request
curl -X POST https://api.apipods.com/v1/webhooks \
-H "Authorization: Bearer $APIPODS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"billing.balance_low"
],
"description": "Ops alerts"
}'Response
{
"id": "whk_1p8x4m2q",
"object": "webhook",
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"billing.balance_low"
],
"status": "ENABLED",
"description": "Ops alerts",
"createdAt": "2026-10-20T10:11:12Z",
"updatedAt": "2026-10-20T10:11:12Z",
"secret": "whsec_7Hq2…"
}| Status | When |
|---|---|
400 | invalid_parameter: not an HTTPS URL, or an unknown event type. |
Retrieve a webhook
/webhooks/{webhookId}Returns one webhook. The secret is not included.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
webhookIdrequired | path | string | The webhook ID. |
Request
curl https://api.apipods.com/v1/webhooks/whk_1p8x4m2q \
-H "Authorization: Bearer $APIPODS_API_KEY"Response
{
"id": "whk_1p8x4m2q",
"object": "webhook",
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"billing.balance_low"
],
"status": "ENABLED",
"description": "Ops alerts",
"createdAt": "2026-10-20T10:11:12Z",
"updatedAt": "2026-10-20T10:11:12Z"
}Update a webhook
/webhooks/{webhookId}Changes the URL, events, description or status. Pass rotateSecret: true to issue a new secret (returned once in the response).
Parameters
| Name | In | Type | Description |
|---|---|---|---|
webhookIdrequired | path | string | The webhook ID. |
url | body | string | New URL. |
events | body | string[] | Replaces the event list. |
status | body | enum | ENABLED or DISABLED. |
rotateSecret | body | boolean | Issue a new signing secret. |
Request
curl -X PATCH https://api.apipods.com/v1/webhooks/whk_1p8x4m2q \
-H "Authorization: Bearer $APIPODS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
"pod.running",
"pod.exited",
"pod.terminated",
"billing.balance_low"
]
}'Response
{
"id": "whk_1p8x4m2q",
"object": "webhook",
"url": "https://api.example.com/hooks/apipods",
"events": [
"pod.running",
"pod.exited",
"pod.terminated",
"billing.balance_low"
],
"status": "ENABLED",
"description": "Ops alerts",
"createdAt": "2026-10-20T10:11:12Z",
"updatedAt": "2026-11-18T15:30:00Z"
}Delete a webhook
/webhooks/{webhookId}Deletes the subscription. Pending retries are dropped.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
webhookIdrequired | path | string | The webhook ID. |
Request
curl -X DELETE https://api.apipods.com/v1/webhooks/whk_1p8x4m2q \
-H "Authorization: Bearer $APIPODS_API_KEY"Response
Returns 204 No Content with an empty body.
Send a test event
/webhooks/{webhookId}/testSends a signed webhook.test event to the URL and returns the delivery result synchronously.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
webhookIdrequired | path | string | The webhook ID. |
Request
curl -X POST https://api.apipods.com/v1/webhooks/whk_1p8x4m2q/test \
-H "Authorization: Bearer $APIPODS_API_KEY"Response
{
"id": "dlv_8k3w9m2q",
"object": "webhook_delivery",
"webhookId": "whk_1p8x4m2q",
"eventId": "evt_2p7x4m9k",
"eventType": "webhook.test",
"attempt": 1,
"responseStatus": 200,
"durationInMs": 141,
"succeeded": true,
"createdAt": "2026-11-18T15:31:02Z"
}List deliveries
/webhooks/{webhookId}/deliveriesDelivery attempts from the last 30 days, newest first. Useful for debugging failing endpoints.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
webhookIdrequired | path | string | The webhook ID. |
succeeded | query | boolean | Filter by outcome. |
eventType | query | string | Filter by event type. |
Request
curl https://api.apipods.com/v1/webhooks/whk_1p8x4m2q/deliveries?succeeded=false \
-H "Authorization: Bearer $APIPODS_API_KEY"Response
{
"object": "list",
"data": [
{
"id": "dlv_5q8m2w7k",
"object": "webhook_delivery",
"webhookId": "whk_1p8x4m2q",
"eventId": "evt_9w3k7m2x",
"eventType": "pod.exited",
"attempt": 1,
"responseStatus": 502,
"durationInMs": 10000,
"succeeded": false,
"createdAt": "2026-11-18T17:02:20Z"
}
],
"hasMore": false,
"nextCursor": null
}