Register New Webhook

POST /v2/webhooks

This endpoint allows you to register a new Webhook to subscribe to certain kind of events being triggered by Squake

Important: This endpoint returns a newly created webhook upon a successful request.
The webhook includes a signing_key used to verify the authenticity of future webhook messages.
Please ensure you save this signing_key, as it cannot be retrieved later.

application/json

Body

This endpoint accepts JSON object with two fields:

  • kind
  • endpoint_url

Right now we're supporting next types:

  • order - we'll send you an event when purchase which was made via stripe changes status
  • confirmation_document_available - we'll send a document when it's generated
  • certificate_document_available - we'll send a document when it's generated

The endpoint_url value should be a valid URL that accepts POST requests.

  • kind string

    Values are order, confirmation_document_available, or certificate_document_available.

Responses

  • 201 application/json

    Created

    Hide response attributes Show response attributes object
    • id string(uuid)

      A unique identifier for the webhook, represented as a universally unique identifier (UUID)

    • last_failed_at string | null

      The timestamp of the most recent failed delivery attempt. If no failures have occurred, this field is null

    • last_sent_at string | null

      he timestamp of the most recent successful delivery attempt. If no attempts have been made, this field is null

    • The total number of consecutive failed delivery attempts

    • kind string

      The type of event that triggers the webhook

      Values are order, carbon_activity_expired, confirmation_document_available, or certificate_document_available.

    • endpoint_url string(uri)

      The URL where the webhook payloads are sent. Must be a valid URI that accepts POST requests

    • 32 bit signing key that we're using to generate webhook signature.
      signing_key is being generated on webhook creation and being exposed only once, so make sure you've saved it

  • 422 application/json

    Unprocessable Entity (WebDAV)

    Hide response attributes Show response attributes object
    • code string Required

      An application-specific error code, expressed as a string value.

      Values are field_validation_error, server_error, not_authorized, not_found, invalid_methodology, or invalid_type.

    • detail string

      A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.

    • source object
      Hide source attributes Show source attributes object
POST /v2/webhooks
curl \
 --request POST 'https://api.squake.earth/v2/webhooks' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"kind":"order","endpoint_url":"string"}'
Request examples
{
  "kind": "order",
  "endpoint_url": "string"
}
Response examples (201)
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "kind": "order",
  "signing_key": "TAWHPBAVckH8KmxRtlRX/rQ/mona5vUem7QFtozGHxM=",
  "endpoint_url": "http://example.com",
  "last_sent_at": "2024-08-24T14:15:22Z",
  "last_failed_at": "2024-08-22T14:10:78Z",
  "failed_attempts": 0
}
Response examples (422)
[
  {
    "code": "field_validation_error",
    "detail": "string",
    "source": {
      "id": "string",
      "attribute": "string",
      "model": "string"
    }
  }
]