Skip to main content
When a developer approves signup, Gate posts a gate.session.approved event to your webhook endpoint. Unlike other Foil webhooks, this one has a request/response contract: your handler must return an encrypted credentials envelope that the CLI decrypts and writes into the developer’s project. This page covers the Gate-specific bits. For everything common to all Foil webhooks - signature verification, retries, headers, the delivery log - see Webhooks.

Set up the endpoint

Create a webhook endpoint subscribed to gate.session.approved, then point your Gate service at it via webhook_endpoint_id. See Webhooks → Endpoints for both the dashboard flow and the API.

Verify the signature

Standard Foil HMAC verification - see Webhooks → Authentication for ready-to-paste code in Node.js, Python, Go, Ruby, and PHP.

Handle the payload

The envelope is the standard webhook envelope. The gate.session.approved data object is:
The full schema is also published in the API reference under Webhooks.

Return credentials

Your webhook must return an encrypted delivery envelope, not raw keys or onboarding links. Gate owns the service metadata like docs_url; your webhook should only return the encrypted customer outputs.
When decrypted by the CLI, the ciphertext should contain your registry-owned env_vars only, for example:

Idempotency

Gate may retry your webhook. Use gate_session_id to make requests idempotent:
The general retry rules - 5 attempts, ≥ 1 minute between attempts, dedupe by envelope id - apply here too. See Webhooks → Retries.

What’s next