---
title: Create a Turnstile Widget
---

[Skip to content](#_top)

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

[Turnstile](https://developers.cloudflare.com/api/go/resources/turnstile)

[Widgets](https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets)

Copy Markdown

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

---

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

# Create a Turnstile Widget

client.Turnstile.Widgets.New(ctx, params) (\*[Widget](<https://developers.cloudflare.com/api/go/resources/turnstile#(resource)%20turnstile.widgets%20%3E%20(model)%20widget%20%3E%20(schema)>), error)

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

Creates a Turnstile widget for an account.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Turnstile Sites Write``Account Settings Write`

##### ParametersExpand Collapse

<details>

<summary>

params WidgetNewParams

</summary>

AccountID param.Field\[string]

Path param: Identifier

maxLength32

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

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

Body param

maxLength10

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20domains">Link to this property</a>

<details>

<summary>

Mode param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)">WidgetNewParamsMode</a>]

Body param: Widget Mode

</summary>

const WidgetNewParamsModeNonInteractive <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)">WidgetNewParamsMode</a> = "non-interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const WidgetNewParamsModeInvisible <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)">WidgetNewParamsMode</a> = "invisible"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const WidgetNewParamsModeManaged <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)">WidgetNewParamsMode</a> = "managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20mode">Link to this property</a>

Name param.Field\[string]

Body param: 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(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20name">Link to this property</a>

<details>

<summary>

Direction param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)">WidgetNewParamsDirection</a>]Optional

Query param: Direction to order widgets.

</summary>

const WidgetNewParamsDirectionAsc <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)">WidgetNewParamsDirection</a> = "asc"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const WidgetNewParamsDirectionDesc <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)">WidgetNewParamsDirection</a> = "desc"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20direction">Link to this property</a>

Filter param.Field\[string]Optional

Query param: Filter widgets by field. The <code>name</code> field uses case-insensitive substring matching; <code>sitekey</code> uses exact matching. Format: <code>field:value</code>

Supported fields:

- <code>name</code> - Filter by widget name (e.g., <code>filter=name:login-form</code>)
- <code>sitekey</code> - Filter by sitekey (e.g., <code>filter=sitekey:0x4AAA</code>)

Returns 400 Bad Request if the field is unsupported or format is invalid. An empty filter value returns all results.

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20filter">Link to this property</a>

<details>

<summary>

Order param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a>]Optional

Query param: Field to order widgets by.

</summary>

const WidgetNewParamsOrderID <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a> = "id"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const WidgetNewParamsOrderSitekey <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a> = "sitekey"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const WidgetNewParamsOrderName <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a> = "name"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

const WidgetNewParamsOrderCreatedOn <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a> = "created\_on"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)%20%3E%20(member)%203">Link to this property</a>

const WidgetNewParamsOrderModifiedOn <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)">WidgetNewParamsOrder</a> = "modified\_on"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20order">Link to this property</a>

Page param.Field\[float64]Optional

Query param: Page number of paginated results.

minimum1

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20page">Link to this property</a>

PerPage param.Field\[float64]Optional

Query param: Number of items per page.

maximum1000

minimum5

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20per_page">Link to this property</a>

BotFightMode param.Field\[bool]Optional

Body param: 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(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bot_fight_mode">Link to this property</a>

<details>

<summary>

ClearanceLevel param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)">WidgetNewParamsClearanceLevel</a>]Optional

Body param: 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>

const WidgetNewParamsClearanceLevelNoClearance <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)">WidgetNewParamsClearanceLevel</a> = "no\_clearance"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const WidgetNewParamsClearanceLevelJschallenge <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)">WidgetNewParamsClearanceLevel</a> = "jschallenge"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const WidgetNewParamsClearanceLevelManaged <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)">WidgetNewParamsClearanceLevel</a> = "managed"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

const WidgetNewParamsClearanceLevelInteractive <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)">WidgetNewParamsClearanceLevel</a> = "interactive"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level%20%3E%20(schema)%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20clearance_level">Link to this property</a>

EphemeralID param.Field\[bool]Optional

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20ephemeral_id">Link to this property</a>

Offlabel param.Field\[bool]Optional

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

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20offlabel">Link to this property</a>

<details>

<summary>

Region param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region%20%3E%20(schema)">WidgetNewParamsRegion</a>]Optional

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

</summary>

const WidgetNewParamsRegionWorld <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region%20%3E%20(schema)">WidgetNewParamsRegion</a> = "world"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const WidgetNewParamsRegionChina <a href="https://developers.cloudflare.com/api/go/resources/turnstile/subresources/widgets/methods/create#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region%20%3E%20(schema)">WidgetNewParamsRegion</a> = "china"

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20region">Link to this property</a>

</details>

[Link to this property](<#(resource)%20turnstile.widgets%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type Widget struct{…}

A Turnstile widget’s detailed configuration

</summary>

BotFightMode 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>

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

</summary>

One of the following:

const WidgetClearanceLevelNoClearance WidgetClearanceLevel = "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>

const WidgetClearanceLevelJschallenge WidgetClearanceLevel = "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>

const WidgetClearanceLevelManaged WidgetClearanceLevel = "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>

const WidgetClearanceLevelInteractive WidgetClearanceLevel = "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>

CreatedOn Time

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 \[]<a href="https://developers.cloudflare.com/api/go/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>

EphemeralID 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 WidgetMode

Widget Mode

</summary>

One of the following:

const WidgetModeNonInteractive WidgetMode = "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>

const WidgetModeInvisible WidgetMode = "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>

const WidgetModeManaged WidgetMode = "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>

ModifiedOn Time

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 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

<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 WidgetRegion

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

</summary>

One of the following:

const WidgetRegionWorld WidgetRegion = "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>

const WidgetRegionChina WidgetRegion = "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 string

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 string

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>

DeployedVia WidgetDeployedViaOptional

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:

const WidgetDeployedViaWrangler WidgetDeployedVia = "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>

const WidgetDeployedViaDashboard WidgetDeployedVia = "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>

const WidgetDeployedViaSpin WidgetDeployedVia = "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>

const WidgetDeployedViaAPI WidgetDeployedVia = "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>

const WidgetDeployedViaUnknown WidgetDeployedVia = "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>

LastModifiedVia WidgetLastModifiedViaOptional

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:

const WidgetLastModifiedViaWrangler WidgetLastModifiedVia = "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>

const WidgetLastModifiedViaDashboard WidgetLastModifiedVia = "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>

const WidgetLastModifiedViaSpin WidgetLastModifiedVia = "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>

const WidgetLastModifiedViaAPI WidgetLastModifiedVia = "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>

const WidgetLastModifiedViaUnknown WidgetLastModifiedVia = "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)>)

### Create a Turnstile Widget

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/turnstile"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  widget, err := client.Turnstile.Widgets.New(context.TODO(), turnstile.WidgetNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Domains: cloudflare.F([]turnstile.WidgetDomainParam{"203.0.113.1", "cloudflare.com", "blog.example.com"}),
    Mode: cloudflare.F(turnstile.WidgetNewParamsModeInvisible),
    Name: cloudflare.F("blog.cloudflare.com login form"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", widget.EphemeralID)
}
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "bot_fight_mode": false,
    "clearance_level": "interactive",
    "created_on": "2014-01-01T05:20:00.123123Z",
    "domains": [
      "203.0.113.1",
      "cloudflare.com",
      "blog.example.com"
    ],
    "ephemeral_id": false,
    "mode": "invisible",
    "modified_on": "2014-01-01T05:20:00.123123Z",
    "name": "blog.cloudflare.com login form",
    "offlabel": false,
    "region": "world",
    "secret": "0x4AAF00AAAABn0R22HWm098HVBjhdsYUc",
    "sitekey": "0x4AAF00AAAABn0R22HWm-YUc",
    "deployed_via": "wrangler",
    "last_modified_via": "dashboard"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "bot_fight_mode": false,
    "clearance_level": "interactive",
    "created_on": "2014-01-01T05:20:00.123123Z",
    "domains": [
      "203.0.113.1",
      "cloudflare.com",
      "blog.example.com"
    ],
    "ephemeral_id": false,
    "mode": "invisible",
    "modified_on": "2014-01-01T05:20:00.123123Z",
    "name": "blog.cloudflare.com login form",
    "offlabel": false,
    "region": "world",
    "secret": "0x4AAF00AAAABn0R22HWm098HVBjhdsYUc",
    "sitekey": "0x4AAF00AAAABn0R22HWm-YUc",
    "deployed_via": "wrangler",
    "last_modified_via": "dashboard"
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
```