Interfaces

Webhooks

Get notified the moment something happens, an agent ships a deployment, a task finishes, or the account hits its budget cap.

Subscribe

POST /webhooks
curl -X POST https://api.server4agent.com/webhooks \
  -H "Authorization: Bearer $SERVER4AGENT_API_KEY" \
  -d '{
    "url": "https://example.com/hooks/server4agent",
    "events": ["deployment.live", "task.completed", "quota.cap_reached"]
  }'
GET/webhooksapi key

List the account's webhook subscriptions.

DELETE/webhooks/{id}api key

Unsubscribe.

Event payload

Every event is delivered as JSON, signed in the Server4Agent-Signature header so you can check it came from us.

deployment.live
{
  "id": "evt_4f1c9a2e7b3d5a6c8e0f1a2b",
  "event": "deployment.live",
  "created_at": "2026-05-27T10:21:00Z",
  "server_id": "srv_2k9",
  "project_id": "proj_9f2",
  "url": "https://checkout-service.apps.server4agent.app"
}

Retries

Answer with any 2xx to accept an event. If your endpoint times out (after 10 seconds) or answers 408, 425, 429 or a 5xx, the event is sent again after 1, 5 and 15 seconds, up to four attempts within 30 seconds. Any other answer is taken as final and the event is not sent again.

So the same event can arrive more than once. Its id, also sent as the Server4Agent-Event-Id header, stays the same on every attempt: skip an id you have already handled. Server4Agent-Delivery-Attempt says which attempt this is, starting at 1.

Event types

events
task.created · task.completed · task.failed
build.failed
deployment.live · deployment.removed
server.created · server.stopped · server.deleted
quota.threshold · quota.cap_reached · quota.egress_cap_reached

build.failed fires when a build ends without finishing, with its build_id and a reason of failed or cancelled. A build that succeeds on a public project sends deployment.live.

quota.threshold fires when spend crosses 80% of the account's budget cap, quota.cap_reached when it reaches the cap, and quota.egress_cap_reached when outbound traffic reaches the plan's monthly limit.

Project bring-up has no event of its own. Poll GET /projects/{id} until init_phase reads ready or failed.

Next: Examples→

Connect an agent

Create a key, paste the MCP config, and your assistant can publish what it builds at a live URL that keeps running.