Documentation Index
Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Thewebhooks sub-client lets you create, list, and delete webhook endpoints. When events occur (e.g. a grant is created or revoked), Grantex sends an HTTP POST to your registered URLs with a signed payload.
webhooks.create()
Create a new webhook endpoint. The response includes asecret for verifying payload signatures — store it securely, as it is only returned once.
Parameters
The HTTPS URL to receive webhook events.
The events to subscribe to.
Event types
| Event | Description |
|---|---|
grant.created | A new grant has been issued |
grant.revoked | A grant has been revoked |
token.issued | A grant token has been issued |
Response: WebhookEndpointWithSecret
Unique webhook endpoint identifier.
The registered URL.
The subscribed event types.
The HMAC signing secret. Only returned on creation.
ISO 8601 creation timestamp.
webhooks.list()
List all webhook endpoints for your organization.Response: ListWebhooksResponse
Array of webhook endpoint objects (without secrets).
webhooks.delete()
Delete a webhook endpoint.Parameters
The webhook endpoint ID to delete.
Response
Returnsvoid.
Verifying webhook signatures
The SDK exports averifyWebhookSignature() function to verify that incoming webhook payloads were sent by Grantex. The function uses HMAC-SHA256 with timing-safe comparison.
Import
Usage
Parameters
The raw request body as received from Grantex.
The value of the
X-Grantex-Signature header.The webhook secret returned when the endpoint was created.
Response
Returnstrue if the signature is valid, false otherwise.