Organization webhooks

Manage webhook endpoints across the organization from the Dashboard — configs, deliveries, and secret rotation.

These endpoints back the organization's webhooks screen: register endpoints, inspect deliveries and retries, and rotate signing secrets, across the org's merchants.

The signing secret (whsec_…) is shown only when created or rotated — capture it at that moment. Every delivery is signed; verify the X-Tokeflow-Signature before acting. See Verifying signatures.

These endpoints power the Tokeflow Dashboard UI at the organization level. They are session-authenticated (JWT bearer) — the token comes from signing in to the Dashboard, not from an sk_/pk_ API key. Requests also carry the x-organization-id header, and the signed-in user must be a member of that organization.

The webhook config object

Returned by the list and retrieve endpoints on this page.

FieldTypeDescription
idstringUnique identifier for the webhook configuration.
merchant_idstringMerchant ID that owns this webhook configuration.
urlstringThe URL where webhook events will be sent.
descriptionstring | nullDescription for this webhook configuration.
event_filterarray | nullList of event types subscribed to. Null means all events.
is_activebooleanWhether this webhook configuration is active.
created_atstringWhen the webhook configuration was created. (ISO 8601 UTC).
updated_atstringWhen the webhook configuration was last updated. (ISO 8601 UTC).
last_triggered_atstring | nullWhen the webhook was last triggered (most recent delivery). (ISO 8601 UTC).

Endpoints

GET/api/v1/org/webhooks

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

List webhook configurations for merchant.

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number (1-indexed). Default 1, min 1.
limitnumberNoNumber of items per page. Default 20, min 1, max 100.

Example request

curl -G https://api.tokeflow.com/api/v1/org/webhooks \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20"

Example response200

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
      "url": "https://api.example.com/webhooks/payments",
      "description": "Production payment notifications",
      "event_filter": [
        "transaction.authorized",
        "transaction.failed",
        "transaction.refunded"
      ],
      "is_active": true,
      "created_at": "2024-01-15T10:30:00.000Z",
      "updated_at": "2024-01-15T10:30:00.000Z",
      "last_triggered_at": "2024-01-15T10:30:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "total_pages": 3,
    "has_next": true,
    "has_prev": false
  }
}

POST/api/v1/org/webhooks

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Create a new webhook configuration.

Request fields

FieldTypeRequiredDescription
urlstringYesThe URL where webhook events will be sent.
descriptionstringNoOptional description for this webhook configuration.
event_filterarrayNoList of event types to subscribe to. If not provided, all events will be sent.

Example request

curl -X POST https://api.tokeflow.com/api/v1/org/webhooks \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/webhooks/payments",
    "description": "Production payment notifications",
    "event_filter": [
      "transaction.authorized",
      "transaction.failed",
      "transaction.refunded"
    ]
  }'

Example response201

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
  "url": "https://api.example.com/webhooks/payments",
  "description": "Production payment notifications",
  "event_filter": [
    "transaction.authorized",
    "transaction.failed",
    "transaction.refunded"
  ],
  "is_active": true,
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-01-15T10:30:00.000Z",
  "last_triggered_at": "2024-01-15T10:30:00.000Z",
  "secret": "whsec_abc123def456..."
}

GET/api/v1/org/webhooks/deliveries

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

List all webhook deliveries for merchant.

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number (1-indexed). Default 1, min 1.
limitnumberNoNumber of items per page. Default 20, min 1, max 100.
statusstringYes

Example request

curl -G https://api.tokeflow.com/api/v1/org/webhooks/deliveries \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20" \
  --data-urlencode "status=active"

Example response200

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
      "merchant_webhook_config_id": "550e8400-e29b-41d4-a716-446655440002",
      "payment_transaction_id": "550e8400-e29b-41d4-a716-446655440003",
      "order_id": "550e8400-e29b-41d4-a716-446655440004",
      "event_type": "transaction.authorized",
      "payload": {
        "event": "transaction.authorized",
        "data": {
          "transaction_id": "..."
        }
      },
      "target_url": "https://api.example.com/webhooks/payments",
      "attempt_number": 1,
      "http_status_code": 200,
      "response_body": "{\"received\": true}",
      "status": "success",
      "next_retry_at": "2024-01-15T10:35:00.000Z",
      "created_at": "2024-01-15T10:30:00.000Z",
      "sent_at": "2024-01-15T10:30:01.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "total_pages": 3,
    "has_next": true,
    "has_prev": false
  }
}

GET/api/v1/org/webhooks/webhook-deliveries/:delivery_id

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Get a specific webhook delivery.

Path parameters

FieldTypeRequiredDescription
delivery_idstringYes

Example request

curl https://api.tokeflow.com/api/v1/org/webhooks/webhook-deliveries/123 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3"

Example response200

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
  "merchant_webhook_config_id": "550e8400-e29b-41d4-a716-446655440002",
  "payment_transaction_id": "550e8400-e29b-41d4-a716-446655440003",
  "order_id": "550e8400-e29b-41d4-a716-446655440004",
  "event_type": "transaction.authorized",
  "payload": {
    "event": "transaction.authorized",
    "data": {
      "transaction_id": "..."
    }
  },
  "target_url": "https://api.example.com/webhooks/payments",
  "attempt_number": 1,
  "http_status_code": 200,
  "response_body": "{\"received\": true}",
  "status": "success",
  "next_retry_at": "2024-01-15T10:35:00.000Z",
  "created_at": "2024-01-15T10:30:00.000Z",
  "sent_at": "2024-01-15T10:30:01.000Z"
}

DELETE/api/v1/org/webhooks/:webhook_id

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Delete a webhook configuration.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Example request

curl -X DELETE https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3"

Example response204 No Content

An empty body is returned on success.


GET/api/v1/org/webhooks/:webhook_id

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Get webhook configuration by ID.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Example request

curl https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3"

Example response200

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
  "url": "https://api.example.com/webhooks/payments",
  "description": "Production payment notifications",
  "event_filter": [
    "transaction.authorized",
    "transaction.failed",
    "transaction.refunded"
  ],
  "is_active": true,
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-01-15T10:30:00.000Z",
  "last_triggered_at": "2024-01-15T10:30:00.000Z"
}

PATCH/api/v1/org/webhooks/:webhook_id

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Update a webhook configuration.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Request fields

FieldTypeRequiredDescription
urlstringNoThe URL where webhook events will be sent.
descriptionstringNoOptional description for this webhook configuration.
event_filterarrayNoList of event types to subscribe to.
is_activebooleanNoWhether this webhook configuration is active.

Example request

curl -X PATCH https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/webhooks/payments",
    "description": "Production payment notifications",
    "event_filter": [
      "transaction.authorized",
      "transaction.failed",
      "transaction.refunded"
    ],
    "is_active": true
  }'

Example response200

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
  "url": "https://api.example.com/webhooks/payments",
  "description": "Production payment notifications",
  "event_filter": [
    "transaction.authorized",
    "transaction.failed",
    "transaction.refunded"
  ],
  "is_active": true,
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-01-15T10:30:00.000Z",
  "last_triggered_at": "2024-01-15T10:30:00.000Z"
}

GET/api/v1/org/webhooks/:webhook_id/deliveries

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

List webhook deliveries for a specific webhook.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number (1-indexed). Default 1, min 1.
limitnumberNoNumber of items per page. Default 20, min 1, max 100.
statusstringNoFilter by delivery status
fromstringNoFrom timestamp (ISO 8601 format) - filter deliveries after this time
tostringNoTo timestamp (ISO 8601 format) - filter deliveries before this time

Example request

curl -G https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42/deliveries \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20" \
  --data-urlencode "status=failed" \
  --data-urlencode "from=2024-01-01T00:00:00Z"

Example response200

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
      "merchant_webhook_config_id": "550e8400-e29b-41d4-a716-446655440002",
      "payment_transaction_id": "550e8400-e29b-41d4-a716-446655440003",
      "order_id": "550e8400-e29b-41d4-a716-446655440004",
      "event_type": "transaction.authorized",
      "payload": {
        "event": "transaction.authorized",
        "data": {
          "transaction_id": "..."
        }
      },
      "target_url": "https://api.example.com/webhooks/payments",
      "attempt_number": 1,
      "http_status_code": 200,
      "response_body": "{\"received\": true}",
      "status": "success",
      "next_retry_at": "2024-01-15T10:35:00.000Z",
      "created_at": "2024-01-15T10:30:00.000Z",
      "sent_at": "2024-01-15T10:30:01.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "total_pages": 3,
    "has_next": true,
    "has_prev": false
  }
}

POST/api/v1/org/webhooks/:webhook_id/rotate-secret

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Rotate the webhook secret.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Example request

curl -X POST https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42/rotate-secret \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3"

Example response200

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_id": "550e8400-e29b-41d4-a716-446655440001",
  "url": "https://api.example.com/webhooks/payments",
  "description": "Production payment notifications",
  "event_filter": [
    "transaction.authorized",
    "transaction.failed",
    "transaction.refunded"
  ],
  "is_active": true,
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-01-15T10:30:00.000Z",
  "last_triggered_at": "2024-01-15T10:30:00.000Z",
  "secret": "whsec_abc123def456..."
}

POST/api/v1/org/webhooks/:webhook_id/test

Org

Auth: Dashboard session (JWT bearer). Organization membership required.

Test a webhook configuration by sending a test event.

Path parameters

FieldTypeRequiredDescription
webhook_idstringYes

Example request

curl -X POST https://api.tokeflow.com/api/v1/org/webhooks/whk_3e9d1f42/test \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-organization-id: org_4b21e7c3"

Example response200

{
  "success": true,
  "message": "Operation completed successfully",
  "http_status": 200
}

Errors

Errors use the standard envelope. The most common cases here:

HTTPMeaning
400Invalid parameters or a state that does not allow this operation.
401Missing, expired, or invalid Dashboard session token.
403Authenticated, but the signed-in user lacks access to this entity.
404The record does not exist or is not visible to this entity.

On this page