Skip to main content
Set one webhook endpoint for your account, and the git service sends it a signed POST each time a push or a commit updates a repo’s refs. Use it to start CI, index new code, or wake an agent when a branch moves.

Set the endpoint

  • One endpoint per account, for every repo. Calling webhook.set() again replaces the URL.
  • The URL must be https and reachable from the internet.
  • Each call returns a new signing secret and replaces the old one. There’s no call to read a secret back, so to rotate it, call webhook.set() again and deploy the new secret to your receiver.

The event

Each delivery is a JSON push event. The SDK’s verify functions return it parsed, with camelCase fields in TypeScript and snake_case in Python.
A ref that was created has a before of 40 zeros, and a ref that was deleted has an after of 40 zeros.

Verify deliveries

Each request carries an X-Archil-Signature header:
Verify it with the SDK before you trust the body. Pass the raw request body exactly as it arrived: a body that was parsed and serialized again won’t verify. Signatures more than 5 minutes old are rejected, which you can change with toleranceSeconds (tolerance_seconds in Python).
  • verifyWebhook (verify_webhook) returns the parsed event, and throws WebhookVerificationError, with the reason, if the signature is missing, wrong, or too old.
  • verifySignature (verify_signature) returns true or false instead.
In TypeScript they’re in disk/webhooks, which also exports SIGNATURE_HEADER and EVENT_ID_HEADER. In Python they’re in archil.git. Both run anywhere, including edge runtimes.

Delivery

  • At least once. If your endpoint doesn’t answer with a 2xx within 10 seconds, the git service retries the delivery with backoff until it does. The same event can arrive more than once, so de-duplicate on id.
  • In order per repo. Events for one repo arrive in the order its refs changed. Events for different repos aren’t ordered relative to each other.
  • Durable. Each event is recorded on the repo’s disk as part of the push, so an event isn’t lost if the git service restarts before delivering it.
  • Forks send no event for their starting state, only for their own pushes and commits afterward. See Forks.
Answer quickly and do slow work after responding: an endpoint that takes longer than 10 seconds is treated as a failed delivery, and the event is sent again.