Skip to content
Start here

Create a new webhook configuration

POST/accounts/{account_id}/data-security/posture/webhooks

Creates a new webhook configuration for sending finding notifications to external endpoints.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Zero Trust Write
Path ParametersExpand Collapse
account_id: string
Body ParametersJSONExpand Collapse
authentication_type: "Basic Auth" or "None" or "Bearer Auth" or 2 more

Type of authentication used for the webhook.

One of the following:
"Basic Auth"
"None"
"Bearer Auth"
"Static Headers"
"HMAC-Signing"
destination_url: string

Target URL for the webhook configuration. Where resulting data will be sent.

formaturi
label: string

Account-specified display label for the webhook configuration.

headers: optional array of object { key, value }

List of custom headers to include in webhook requests.

key: string

Header key name.

maxLength255
value: optional string

Header value. Required on Create and Evaluate. On Update, omit or set to null to keep existing value.

maxLength4096
signing_secret: optional string

Secret key used for HMAC signing when authentication_type is “HMAC-Signing”.

ReturnsExpand Collapse
errors: array of object { code, message, documentation_url, source }
code: number

Error or message code.

minimum1000
message: string

Human-readable message.

documentation_url: optional string

Link to relevant documentation.

formaturi
source: optional object { pointer }
pointer: optional string

JSON pointer to the source of the error.

messages: array of object { code, message, documentation_url, source }
code: number

Error or message code.

minimum1000
message: string

Human-readable message.

documentation_url: optional string

Link to relevant documentation.

formaturi
source: optional object { pointer }
pointer: optional string

JSON pointer to the source of the error.

success: boolean

Whether the API call was successful.

result: optional object { id, authentication_type, created_at, 6 more }

Webhook configuration for sending finding notifications.

id: string

Unique identifier for the specific webhook configuration.

formatuuid
authentication_type: "Basic Auth" or "None" or "Bearer Auth" or 2 more

Type of authentication used for the webhook.

One of the following:
"Basic Auth"
"None"
"Bearer Auth"
"Static Headers"
"HMAC-Signing"
created_at: string

Timestamp when the webhook configuration was created.

formatdate-time
destination_url: string

Target URL for the webhook configuration. Where resulting data will be sent.

formaturi
label: string

Account-specified display label for the webhook configuration.

status: "enabled" or "disabled"

Current status of the webhook configuration. If disabled, data cannot be sent through this configuration.

One of the following:
"enabled"
"disabled"
updated_at: string

Timestamp when the webhook configuration was last updated.

formatdate-time
version: number

Version number of the configuration.

formatuint32
headers: optional array of object { key, value }

List of header keys configured for this webhook. Values are not included for security reasons.

key: optional string

Header key name (lowercase).

value: optional string

Header value. This field is never returned in API responses for security reasons.

Create a new webhook configuration

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/data-security/posture/webhooks \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "authentication_type": "Bearer Auth",
          "destination_url": "https://example.com/webhook",
          "label": "Send to Slack",
          "headers": [
            {
              "key": "Authorization",
              "value": "Bearer token123"
            },
            {
              "key": "X-Custom-Header",
              "value": "value"
            }
          ],
          "signing_secret": "my-secret-key"
        }'
{
  "errors": [
    {
      "code": 1000,
      "message": "Request processed successfully",
      "documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
      "source": {
        "pointer": "/data/attributes/name"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "Request processed successfully",
      "documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
      "source": {
        "pointer": "/data/attributes/name"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "authentication_type": "Bearer Auth",
    "created_at": "2024-01-15T10:30:00Z",
    "destination_url": "https://example.com/webhook",
    "label": "Send to Gmail",
    "status": "enabled",
    "updated_at": "2024-01-20T14:45:00Z",
    "version": 1,
    "headers": [
      {
        "key": "authorization"
      }
    ]
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "Request processed successfully",
      "documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
      "source": {
        "pointer": "/data/attributes/name"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "Request processed successfully",
      "documentation_url": "https://developers.cloudflare.com/api/operations/list-findings",
      "source": {
        "pointer": "/data/attributes/name"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "authentication_type": "Bearer Auth",
    "created_at": "2024-01-15T10:30:00Z",
    "destination_url": "https://example.com/webhook",
    "label": "Send to Gmail",
    "status": "enabled",
    "updated_at": "2024-01-20T14:45:00Z",
    "version": 1,
    "headers": [
      {
        "key": "authorization"
      }
    ]
  }
}