Class TurnstileWidget
- Namespace
- Cloudflare.NET.Turnstile.Models
- Assembly
- Cloudflare.NET.dll
Represents a Turnstile widget configuration.
Turnstile widgets provide bot protection without user friction. Each widget is identified by a public sitekey used in frontend integration, and has a secret key for server-side verification.
public record TurnstileWidget : IEquatable<TurnstileWidget>
- Inheritance
-
TurnstileWidget
- Implements
- Inherited Members
Remarks
The Secret property is only populated when the widget is created or when the secret is rotated. Subsequent GET requests will return null for this field.
Constructors
TurnstileWidget(string, string, WidgetMode, IReadOnlyList<string>, DateTime, DateTime, bool, ClearanceLevel?, bool, bool, string?, string?)
Represents a Turnstile widget configuration.
Turnstile widgets provide bot protection without user friction. Each widget is identified by a public sitekey used in frontend integration, and has a secret key for server-side verification.
public TurnstileWidget(string Sitekey, string Name, WidgetMode Mode, IReadOnlyList<string> Domains, DateTime CreatedOn, DateTime ModifiedOn, bool BotFightMode = false, ClearanceLevel? ClearanceLevel = null, bool EphemeralId = false, bool Offlabel = false, string? Region = null, string? Secret = null)
Parameters
SitekeystringWidget public key used in frontend integration.
NamestringWidget name for identification.
ModeWidgetModeWidget mode determining user interaction level.
DomainsIReadOnlyList<string>Allowed domains/hostnames for this widget.
CreatedOnDateTimeWhen the widget was created.
ModifiedOnDateTimeWhen the widget was last modified.
BotFightModeboolWhether bot fight mode is enabled.
ClearanceLevelClearanceLevel?Challenge clearance level.
EphemeralIdboolWhether to use ephemeral IDs.
OfflabelboolWhether off-label use is allowed.
RegionstringGeographic region for the widget.
SecretstringWidget secret key. Only returned on create or rotate.
Remarks
The Secret property is only populated when the widget is created or when the secret is rotated. Subsequent GET requests will return null for this field.
Properties
BotFightMode
Whether bot fight mode is enabled.
[JsonPropertyName("bot_fight_mode")]
public bool BotFightMode { get; init; }
Property Value
ClearanceLevel
Challenge clearance level.
[JsonPropertyName("clearance_level")]
public ClearanceLevel? ClearanceLevel { get; init; }
Property Value
CreatedOn
When the widget was created.
[JsonPropertyName("created_on")]
public DateTime CreatedOn { get; init; }
Property Value
Domains
Allowed domains/hostnames for this widget.
[JsonPropertyName("domains")]
public IReadOnlyList<string> Domains { get; init; }
Property Value
EphemeralId
Whether to use ephemeral IDs.
[JsonPropertyName("ephemeral_id")]
public bool EphemeralId { get; init; }
Property Value
Mode
Widget mode determining user interaction level.
[JsonPropertyName("mode")]
public WidgetMode Mode { get; init; }
Property Value
ModifiedOn
When the widget was last modified.
[JsonPropertyName("modified_on")]
public DateTime ModifiedOn { get; init; }
Property Value
Name
Widget name for identification.
[JsonPropertyName("name")]
public string Name { get; init; }
Property Value
Offlabel
Whether off-label use is allowed.
[JsonPropertyName("offlabel")]
public bool Offlabel { get; init; }
Property Value
Region
Geographic region for the widget.
[JsonPropertyName("region")]
public string? Region { get; init; }
Property Value
Secret
Widget secret key. Only returned on create or rotate.
[JsonPropertyName("secret")]
public string? Secret { get; init; }
Property Value
Sitekey
Widget public key used in frontend integration.
[JsonPropertyName("sitekey")]
public string Sitekey { get; init; }