---
title: Turnstile
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Turnstile

#### TurnstileWidgets

##### [List Turnstile Widgets](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/list)

turnstile.widgets.list(WidgetListParams\*\*kwargs) -> SyncV4PagePaginationArray\[[WidgetListResponse](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)>)]

GET/accounts/{account\_id}/challenges/widgets

##### [Turnstile Widget Details](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/get)

turnstile.widgets.get(strsitekey, WidgetGetParams\*\*kwargs) -> [Widget](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

GET/accounts/{account\_id}/challenges/widgets/{sitekey}

##### [Create a Turnstile Widget](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/create)

turnstile.widgets.create(WidgetCreateParams\*\*kwargs) -> [Widget](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

POST/accounts/{account\_id}/challenges/widgets

##### [Update a Turnstile Widget](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/update)

turnstile.widgets.update(strsitekey, WidgetUpdateParams\*\*kwargs) -> [Widget](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

PUT/accounts/{account\_id}/challenges/widgets/{sitekey}

##### [Delete a Turnstile Widget](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/delete)

turnstile.widgets.delete(strsitekey, WidgetDeleteParams\*\*kwargs) -> [Widget](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

DELETE/accounts/{account\_id}/challenges/widgets/{sitekey}

##### [Rotate Secret for a Turnstile Widget](https://developers.cloudflare.com/api/python/resources/turnstile/subresources/widgets/methods/rotate_secret)

turnstile.widgets.rotate\_secret(strsitekey, WidgetRotateSecretParams\*\*kwargs) -> [Widget](<https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

POST/accounts/{account\_id}/challenges/widgets/{sitekey}/rotate\_secret

##### ModelsExpand Collapse

<details>

<summary>

class Widget: …

A Turnstile widget’s detailed configuration

</summary>

bot\_fight\_mode: bool

If bot\_fight\_mode is set to <code>true</code>, Cloudflare issues computationally expensive challenges in response to malicious bots (ENT only).

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20bot_fight_mode">Link to this property</a>

<details>

<summary>

clearance\_level: Literal\["no\_clearance", "jschallenge", "managed", "interactive"]

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

</summary>

One of the following:

"no\_clearance"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%200">Link to this property</a>

"jschallenge"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%201">Link to this property</a>

"managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%202">Link to this property</a>

"interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20clearance_level">Link to this property</a>

created\_on: datetime

When the widget was created.

formatdate-time

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20created_on">Link to this property</a>

domains: List\[<a href="https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_domain%20%3E%20(schema)">WidgetDomain</a>]

maxLength10

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20domains">Link to this property</a>

ephemeral\_id: bool

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20ephemeral_id">Link to this property</a>

<details>

<summary>

mode: Literal\["non-interactive", "invisible", "managed"]

Widget Mode

</summary>

One of the following:

"non-interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"invisible"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

modified\_on: datetime

When the widget was modified.

formatdate-time

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20modified_on">Link to this property</a>

name: str

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

offlabel: bool

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20offlabel">Link to this property</a>

<details>

<summary>

region: Literal\["world", "china"]

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

</summary>

One of the following:

"world"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20region%20%3E%20(member)%200">Link to this property</a>

"china"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20region%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20region">Link to this property</a>

secret: str

Secret key for this widget.

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20secret">Link to this property</a>

sitekey: str

Unique identifier for a Turnstile widget.

maxLength32

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20sitekey">Link to this property</a>

<details>

<summary>

deployed\_via: Optional\[Literal\["wrangler", "dashboard", "spin", 2 more]]

Origin that created this widget, recorded at creation time and immutable afterward. Server-derived from the create request; not client-settable. Omitted from the response for widgets created before this field existed.

</summary>

One of the following:

"wrangler"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%200">Link to this property</a>

"dashboard"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%201">Link to this property</a>

"spin"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%202">Link to this property</a>

"api"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%203">Link to this property</a>

"unknown"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20deployed_via">Link to this property</a>

<details>

<summary>

last\_modified\_via: Optional\[Literal\["wrangler", "dashboard", "spin", 2 more]]

Origin of the most recent mutation (create, update, delete, or secret rotation). Server-derived; not client-settable. Omitted for widgets last mutated before this field existed.

</summary>

One of the following:

"wrangler"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%200">Link to this property</a>

"dashboard"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%201">Link to this property</a>

"spin"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%202">Link to this property</a>

"api"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%203">Link to this property</a>

"unknown"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)%20%3E%20(property)%20last_modified_via">Link to this property</a>

</details>

[Link to this property](<#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>)

str

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

[Link to this property](<#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_domain%20%3E%20(schema)>)

<details>

<summary>

class WidgetListResponse: …

A Turnstile Widgets configuration as it appears in listings

</summary>

bot\_fight\_mode: bool

If bot\_fight\_mode is set to <code>true</code>, Cloudflare issues computationally expensive challenges in response to malicious bots (ENT only).

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20bot_fight_mode">Link to this property</a>

<details>

<summary>

clearance\_level: Literal\["no\_clearance", "jschallenge", "managed", "interactive"]

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

</summary>

One of the following:

"no\_clearance"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%200">Link to this property</a>

"jschallenge"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%201">Link to this property</a>

"managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%202">Link to this property</a>

"interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20clearance_level%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20clearance_level">Link to this property</a>

created\_on: datetime

When the widget was created.

formatdate-time

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20created_on">Link to this property</a>

domains: List\[<a href="https://developers.cloudflare.com/api/python/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_domain%20%3E%20(schema)">WidgetDomain</a>]

maxLength10

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20domains">Link to this property</a>

ephemeral\_id: bool

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20ephemeral_id">Link to this property</a>

<details>

<summary>

mode: Literal\["non-interactive", "invisible", "managed"]

Widget Mode

</summary>

One of the following:

"non-interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"invisible"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

modified\_on: datetime

When the widget was modified.

formatdate-time

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20modified_on">Link to this property</a>

name: str

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

offlabel: bool

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20offlabel">Link to this property</a>

<details>

<summary>

region: Literal\["world", "china"]

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

</summary>

One of the following:

"world"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20region%20%3E%20(member)%200">Link to this property</a>

"china"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20region%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20region">Link to this property</a>

sitekey: str

Unique identifier for a Turnstile widget.

maxLength32

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20sitekey">Link to this property</a>

<details>

<summary>

deployed\_via: Optional\[Literal\["wrangler", "dashboard", "spin", 2 more]]

Origin that created this widget, recorded at creation time and immutable afterward. Server-derived from the create request; not client-settable. Omitted from the response for widgets created before this field existed.

</summary>

One of the following:

"wrangler"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%200">Link to this property</a>

"dashboard"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%201">Link to this property</a>

"spin"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%202">Link to this property</a>

"api"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%203">Link to this property</a>

"unknown"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20deployed_via">Link to this property</a>

<details>

<summary>

last\_modified\_via: Optional\[Literal\["wrangler", "dashboard", "spin", 2 more]]

Origin of the most recent mutation (create, update, delete, or secret rotation). Server-derived; not client-settable. Omitted for widgets last mutated before this field existed.

</summary>

One of the following:

"wrangler"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%200">Link to this property</a>

"dashboard"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%201">Link to this property</a>

"spin"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%202">Link to this property</a>

"api"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%203">Link to this property</a>

"unknown"

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)%20%3E%20(property)%20last_modified_via">Link to this property</a>

</details>

[Link to this property](<#(resource)%20turnstile.widgets%20%3E%20(model)%20widget_list_response%20%3E%20(schema)>)