https://api.botshield.ai/operations/gates-api/…. Like every BotShield operation, they answer HTTP 200 with a data envelope. A success is under data.data. A refusal is under data.error, with message, statusCode and a machine code. Check data.error first. See Errors.
The TypeScript SDK covers the Gates API from
botshield-sdk 2.2.1, as botshield.gates.* and botshield.gates.actions.*. The SDK takes camelCase fields and returns camelCase fields, and it does not unwrap the envelope: read result.data.data, and check result.data.error first.Authentication
Send a secret API key as a Bearer token:bs_dev_… or bs_production_…. The key must have Gates API access.
1
Open your API keys
In the BotShield Console, go to Settings → Developer Tools and select the API Keys tab.
2
Switch on Gates API access
On the key’s row, check Gates API access. The row then shows a Gates API badge. On a Production key, you confirm with your Developer passkey before the access is granted.
- Organization. Every call acts on the key’s organization.
- Environment. A
bs_dev_key places and reads Development gates. Abs_production_key places and reads Production gates.
Operations
Request bodies use camelCase field names (
gateType, destinationUrl). Responses use snake_case (gate_type, destination_url), except inside schedule, which keeps opensAt and closesAt.
Create a gate
POST /gates-api/create places a gate as a Draft, with its first policy document. Send activate: true to make it live in the same call.
curl
activate: true and a Production requirement is missing, the gate is still placed, as a Draft, and the response says why it is not live:
gates-api/activate with the same key. Do not call create again: the key is now taken.
The gate object
create, activate, get and list return gates in this shape. It holds your own settings and nothing about people.
The policy document
The policy document holds a gate’s settings. BotShield validates the whole document; a field it does not know is refused withinvalid_policy.
Your organization can also hold an organization-wide document. A gate’s document can only tighten what the organization’s allows. The
policy in the response is the effective result.
Presets
A preset pre-fills four settings. Any field you send inpolicy replaces the preset’s value for that field, as a whole: send all of passesPerPerson if you change it.
The signed-up presets link every pass, because the people who signed up have accounts with you. The others link only when you send your user ref. Send
link in policy to change it. Age is no preset’s: set gateType and ageThreshold yourself. An Age Gate never links, whatever link says.
Activate a gate
POST /gates-api/activate makes a Draft gate Active. Calling it on a gate that is already Active changes nothing and returns the gate.
curl
Production activation
A Development gate activates with no checks. A Production gate activates only when your organization has met these requirements, checked in this order:
The API has no passkey step at activation. The passkey you gave when you granted the key Gates API access stands in for it. Gates that are already Active keep running if a requirement changes later. See Go to production.
Extend a gate
POST /gates-api/extend moves a gate’s closing time later, for example when a show runs long. It changes nothing else: BotShield saves a new version of the gate’s policy document with only schedule.closesAt moved.
curl
version is the number of the policy document the extension saved. The response schedule.closesAt is in UTC.
A window only moves later. Extend refuses:
- a
closesAtthat is not later than the current one (extend_only); - a gate that has no closing time (
gate_has_no_end); - a gate whose closing time has already passed (
gate_closed). A closed gate is never reopened: place a new gate.
Close a gate
POST /gates-api/close stops the gate issuing passes. Tokens already issued still verify until they expire, 120 seconds after issue. The gate’s Verification Logs and Activity Logs are kept. A closed gate cannot be reopened.
curl
{ "closed": true, "already_closed": true }.
Cancel a gate
POST /gates-api/cancel removes a gate that nobody has passed through, for example one placed by mistake. If any verification has run on the gate, cancel is refused with gate_in_use: close it instead, so its log is kept. If BotShield cannot check the gate or cannot remove it, cancel answers retry and the gate stays as it was.
curl
Get a gate
GET /gates-api/get reads one Draft or Active gate by key.
curl
gate_not_found.
List gates
GET /gates-api/list returns your Draft and Active gates in the key’s environment, newest first. limit is optional: 1–200, default 50. Closed and cancelled gates are not listed.
curl
Rules
- A key is never renamed for you. If the key is taken,
createis refused withgate_key_taken. Unlike the Console, the API never adds a suffix such as-2, so the key you sent is always the gate’s key. If acreatecall timed out, callgetwith the same key before you retry. - Cancel only works before anyone has passed. After the first verification, close the gate instead.
- Close keeps the log. A closed gate stays in your Verification Logs and Activity Logs.
- A window only moves later.
extendnever movesclosesAtearlier and never reopens a gate that has closed. - Production activation needs business verification, a verified domain and room in your plan’s production gate allowance.
- The platform rules still hold. Every pass is a fresh passkey confirmation, and every token is valid for one check. Neither is a setting, and a policy document can only tighten a gate.
Error codes
Errors arrive asdata.error with HTTP 200. A body that fails input validation, for example a key with capital letters, is rejected with HTTP 400 before the operation runs. See Errors.
Next steps
The link setting
Decide whether a pass links the person to your account for them.
Who may pass
Passes per person and BotShield ID age.
Verify on your server
Check each token once, on your server.
BotShield Actions
Key any act to a passkey, without a gate.
