Replace the environment's bot and abuse protection settings
PUT /v1/user_management/bot_protection: Replace the environment's bot and abuse protection settings.
PUT /
Rules run in list order and the first match decides (allow stops evaluation). The rules engine needs a Business plan, the developer’s own Turnstile keys and new-device emails a Pro plan (plan_limit_reached otherwise); the managed CAPTCHA, device signals and the detections log are on every plan. captcha_provider: managed needs OhAuthCat’s widget to be configured for the deployment (parameter_invalid otherwise). Changes apply to the hosted pages within seconds.
- Scope
users:write- Auth
- Secret key (
sk_…) - Since
- 1.0
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Request body
Section titled “Request body”captcha_modestring Requiredone of
off,adaptive,alwayscaptcha_providerstring Requiredone of
managed,ownturnstile_site_keystring or nullmax length 128
The developer’s Turnstile secret, sealed at rest and never returned. Omit to keep the stored one.turnstile_secretstringmin length 1 · max length 256
clear_turnstile_secretbooleandevice_trackingboolean Requirednew_device_emailboolean Requiredrulesarray of BotRule Requiredmax items 50
Responses
Section titled “Responses”- 200 OK BotProtectionSettings
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X PUT \ "https://api.ohauthcat.com/v1/user_management/bot_protection" \ -H "Authorization: Bearer $OHAUTHCAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "captcha_mode": "off", "captcha_provider": "managed", "device_tracking": true, "new_device_email": true, "rules": [ { "id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "kind": "country", "action": "allow", "challenge": "captcha", "enabled": true, "flows": [ "sign_in" ], "values": [ "enterprise" ], "not_in": true, "threshold": 1, "window_seconds": 60, "days": 1 } ]}'const response = await fetch("https://api.ohauthcat.com/v1/user_management/bot_protection", { method: "PUT", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "captcha_mode": "off", "captcha_provider": "managed", "device_tracking": true, "new_device_email": true, "rules": [ { "id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "kind": "country", "action": "allow", "challenge": "captcha", "enabled": true, "flows": [ "sign_in" ], "values": [ "enterprise" ], "not_in": true, "threshold": 1, "window_seconds": 60, "days": 1 } ] }),});const data = await response.json();import osimport requests
response = requests.put( "https://api.ohauthcat.com/v1/user_management/bot_protection", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "captcha_mode": "off", "captcha_provider": "managed", "device_tracking": True, "new_device_email": True, "rules": [ { "id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "kind": "country", "action": "allow", "challenge": "captcha", "enabled": True, "flows": [ "sign_in", ], "values": [ "enterprise", ], "not_in": True, "threshold": 1, "window_seconds": 60, "days": 1, }, ], },)data = response.json(){ "object": "bot_protection", "captcha_mode": "off", "captcha_provider": "managed", "turnstile_site_key": "plan", "turnstile_secret_set": true, "device_tracking": true, "new_device_email": true, "rules": [ { "id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "kind": "country", "action": "allow", "challenge": "captcha", "enabled": true, "flows": [ "sign_in" ], "values": [ "enterprise" ], "not_in": true, "threshold": 1, "window_seconds": 60, "days": 1 } ]}