Skip to content
Start here

Turnstile

TurnstileWidgets

List Turnstile Widgets
client.Turnstile.Widgets.List(ctx, params) (*V4PagePaginationArray[WidgetListResponse], error)
GET/accounts/{account_id}/challenges/widgets
Turnstile Widget Details
client.Turnstile.Widgets.Get(ctx, sitekey, query) (*Widget, error)
GET/accounts/{account_id}/challenges/widgets/{sitekey}
Create a Turnstile Widget
client.Turnstile.Widgets.New(ctx, params) (*Widget, error)
POST/accounts/{account_id}/challenges/widgets
Update a Turnstile Widget
client.Turnstile.Widgets.Update(ctx, sitekey, params) (*Widget, error)
PUT/accounts/{account_id}/challenges/widgets/{sitekey}
Delete a Turnstile Widget
client.Turnstile.Widgets.Delete(ctx, sitekey, body) (*Widget, error)
DELETE/accounts/{account_id}/challenges/widgets/{sitekey}
Rotate Secret for a Turnstile Widget
client.Turnstile.Widgets.RotateSecret(ctx, sitekey, params) (*Widget, error)
POST/accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret
ModelsExpand Collapse
type Widget struct{…}

A Turnstile widget's detailed configuration

BotFightMode bool

If bot_fight_mode is set to true, Cloudflare issues computationally expensive challenges in response to malicious bots (ENT only).

ClearanceLevel WidgetClearanceLevel

If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set

One of the following:
const WidgetClearanceLevelNoClearance WidgetClearanceLevel = "no_clearance"
const WidgetClearanceLevelJschallenge WidgetClearanceLevel = "jschallenge"
const WidgetClearanceLevelManaged WidgetClearanceLevel = "managed"
const WidgetClearanceLevelInteractive WidgetClearanceLevel = "interactive"
CreatedOn Time

When the widget was created.

formatdate-time
Domains []WidgetDomain
maxLength10
EphemeralID bool

Return the Ephemeral ID in /siteverify (ENT only).

Mode WidgetMode

Widget Mode

One of the following:
const WidgetModeNonInteractive WidgetMode = "non-interactive"
const WidgetModeInvisible WidgetMode = "invisible"
const WidgetModeManaged WidgetMode = "managed"
ModifiedOn Time

When the widget was modified.

formatdate-time
Name string

Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used.

maxLength254
minLength1
Offlabel bool

Do not show any Cloudflare branding on the widget (ENT only).

Region WidgetRegion

Region where this widget can be used. This cannot be changed after creation.

One of the following:
const WidgetRegionWorld WidgetRegion = "world"
const WidgetRegionChina WidgetRegion = "china"
Secret string

Secret key for this widget.

Sitekey string

Widget item identifier tag.

maxLength32
type WidgetDomain string

Hosts as a hostname or IPv4/IPv6 address represented by strings. The widget will only work on these domains, and their subdomains.