Docs / API reference

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.

NameTypeDescription
idstringUnique ID, prefixed whk_.
objectstringAlways webhook.
urlstringHTTPS URL that receives POST requests.
eventsstring[]Event types to deliver. ["*"] subscribes to all current and future types.
statusenumENABLED or DISABLED. Webhooks failing for 3 consecutive days are disabled automatically and you are emailed.
descriptionstring | nullFree text.
createdAtstringISO 8601 timestamp.
updatedAtstringISO 8601 timestamp.
webhook object
{
  "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

TypeSent when
pod.createdA pod was created and is waiting for a host (CREATED).
pod.runningA pod reached RUNNING.
pod.exitedA pod reached EXITED. data.object.lastExitCode tells you whether it was stopped or crashed.
pod.terminatedA pod was terminated.
endpoint.createdA serverless endpoint was created.
endpoint.updatedEndpoint settings changed or a new image was rolled out.
endpoint.deletedA serverless endpoint was deleted.
endpoint.worker_unhealthyA worker crashed or failed health checks.
job.completedA job reached COMPLETED.
job.failedA job reached FAILED.
job.timed_outA job reached TIMED_OUT.
job.cancelledA job reached CANCELLED.
volume.createdA network volume became AVAILABLE.
volume.deletedA network volume was deleted.
billing.balance_lowBalance fell below your low-balance threshold.
billing.spend_limit_reachedThe monthly spend limit was reached; new resources are blocked.
billing.invoice_createdA 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 https://api.example.com/hooks/apipods
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:

  1. Split the header on commas and read t and v1.
  2. Reject the request if t is more than 300 seconds from your current time (replay protection).
  3. Compute the HMAC over the exact raw bytes you received, never over re-serialized JSON.
  4. 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 "", 204
Tip: When you rotate a secret, deliveries are signed with both the old and new secret for 24 hours, so the header contains two v1 values. Accept the request if either matches.

Delivery and retries

  • Respond with any 2xx status within 10 seconds. Do slow work asynchronously after responding.
  • Non-2xx responses 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 id and compare data.object.updatedAt before acting.
  • Redirects are not followed. Private IP ranges and non-HTTPS URLs are rejected.

Endpoints

MethodPathDescription
GET/webhooksList webhooks
POST/webhooksCreate a webhook
GET/webhooks/{webhookId}Retrieve a webhook
PATCH/webhooks/{webhookId}Update a webhook
DELETE/webhooks/{webhookId}Delete a webhook
POST/webhooks/{webhookId}/testSend a test event
GET/webhooks/{webhookId}/deliveriesRecent delivery attempts

List webhooks

GET/webhooks

Returns webhook subscriptions in your organization.

Request

curl https://api.apipods.com/v1/webhooks \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Response

200 OK
{
  "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

POST/webhooks

Creates a subscription. The response contains secret, returned only this once. Store it to verify signatures.

Parameters

NameInTypeDescription
urlrequiredbodystringHTTPS URL.
eventsrequiredbodystring[]Event types, or ["*"].
descriptionbodystringFree 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

201 Created
{
  "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…"
}
StatusWhen
400invalid_parameter: not an HTTPS URL, or an unknown event type.

Retrieve a webhook

GET/webhooks/{webhookId}

Returns one webhook. The secret is not included.

Parameters

NameInTypeDescription
webhookIdrequiredpathstringThe webhook ID.

Request

curl https://api.apipods.com/v1/webhooks/whk_1p8x4m2q \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Response

200 OK
{
  "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

PATCH/webhooks/{webhookId}

Changes the URL, events, description or status. Pass rotateSecret: true to issue a new secret (returned once in the response).

Parameters

NameInTypeDescription
webhookIdrequiredpathstringThe webhook ID.
urlbodystringNew URL.
eventsbodystring[]Replaces the event list.
statusbodyenumENABLED or DISABLED.
rotateSecretbodybooleanIssue 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

200 OK
{
  "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

DELETE/webhooks/{webhookId}

Deletes the subscription. Pending retries are dropped.

Parameters

NameInTypeDescription
webhookIdrequiredpathstringThe 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

POST/webhooks/{webhookId}/test

Sends a signed webhook.test event to the URL and returns the delivery result synchronously.

Parameters

NameInTypeDescription
webhookIdrequiredpathstringThe webhook ID.

Request

curl -X POST https://api.apipods.com/v1/webhooks/whk_1p8x4m2q/test \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Response

200 OK
{
  "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

GET/webhooks/{webhookId}/deliveries

Delivery attempts from the last 30 days, newest first. Useful for debugging failing endpoints.

Parameters

NameInTypeDescription
webhookIdrequiredpathstringThe webhook ID.
succeededquerybooleanFilter by outcome.
eventTypequerystringFilter by event type.

Request

curl https://api.apipods.com/v1/webhooks/whk_1p8x4m2q/deliveries?succeeded=false \
  -H "Authorization: Bearer $APIPODS_API_KEY"

Response

200 OK
{
  "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
}