> ## Documentation Index
> Fetch the complete documentation index at: https://docs.botshield.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a gate

> Remove a gate nobody has passed through. A gate with any verification on it is refused with `gate_in_use` — close it instead, so its log is kept.



## OpenAPI

````yaml /openapi.json post /gates-api/cancel
openapi: 3.1.0
info:
  title: BotShield API
  version: 2.0.0
  description: >-
    The BotShield partner API.


    **BotShield Gate** — ask whether a live human is present (Human Gate) or
    over an age threshold (Age Gate). The person confirms with their passkey in
    the BotShield app and you receive a signed result. Partners learn *that* a
    user is human, never *who*.


    **Agents Ask** — your agent proposes an action, a verified human confirms or
    denies it, and BotShield signs a Proof of Resolution you can verify offline.


    **Gates API** — place and run gates and BotShield Actions from your server.


    **Verified Accounts** — a person links their account on your platform with a
    passkey; your server reads the status and the registry, and can unlink
    (revoke) an account with its API key.


    Every operation answers HTTP 200 with a `data` envelope; handler errors
    arrive as `data.error`. See the API overview and error reference. In the
    `botshield-sdk` package (2.2.1) these operations live under
    `client.census.*`, `client.verification.*`, `client.gates.*`,
    `client.securedAccounts.*` and `client.actions.*`.
  contact:
    name: BotShield Support
    email: support@botshield.ai
    url: https://botshield.ai
servers:
  - url: https://api.botshield.ai/operations
    description: Production
security: []
tags:
  - name: BotShield Gate
    description: >-
      Ask whether a present human (Human Gate) or a human over an age threshold
      (Age Gate) confirmed, and verify the signed result.
  - name: Gates API
    description: >-
      Place, open, extend and close gates, and place BotShield Actions, from
      your server with an API key that has the `gates:write` scope.
  - name: Verified Accounts
    description: >-
      Read and end the Verified Accounts on your platform from your server with
      your API key: status, the registry, and revoke (unlink).
  - name: Agents Ask
    description: >-
      Your agent proposes an action; a verified human confirms or denies it in
      the BotShield app; you receive a signed Proof of Resolution.
paths:
  /gates-api/cancel:
    post:
      tags:
        - Gates API
      summary: Cancel a gate
      description: >-
        Remove a gate nobody has passed through. A gate with any verification on
        it is refused with `gate_in_use` — close it instead, so its log is kept.
      operationId: GatesApiCancel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - key
              properties:
                key:
                  type: string
                  pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
                  description: The key of the gate to cancel.
                  example: presale-nyc-1120
      responses:
        '200':
          description: >-
            Cancelled. NOTE: handler errors also arrive here (HTTP 200) as
            data.error — codes: `invalid_key` (401 — missing, malformed or
            inactive key), `gates_scope_required` (403 — the key lacks Gates API
            access), `org_not_found` (404), `gate_not_found` (404),
            `gate_in_use` (409), `retry` (503 — usage could not be checked; try
            again).
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    properties:
                      data:
                        type: object
                        required:
                          - cancelled
                        properties:
                          cancelled:
                            type: boolean
                            description: Always true.
                      error:
                        $ref: '#/components/schemas/GatesApiError'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - GatesKeyAuth: []
components:
  schemas:
    GatesApiError:
      type: object
      required:
        - message
        - statusCode
        - code
      description: >-
        Gates API handler error. Arrives inside `data.error` with HTTP 200 —
        check for it before reading the result.
      properties:
        message:
          type: string
        statusCode:
          type: integer
          example: 409
        code:
          type: string
          example: gate_key_taken
    InvalidInputError:
      type: object
      required:
        - message
        - input
        - errors
      properties:
        message:
          type: string
          example: Invalid input provided
        input:
          type: object
          additionalProperties: true
        errors:
          type: array
          items:
            type: object
            required:
              - propertyPath
              - invalidValue
              - message
            properties:
              propertyPath:
                type: string
              invalidValue:
                description: The invalid value
              message:
                type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - statusCode
          properties:
            message:
              type: string
            statusCode:
              type: integer
  responses:
    BadRequest:
      description: Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InvalidInputError'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    GatesKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Your secret server API key (`bs_dev_…` or `bs_production_…`) with Gates
        API access: the `gates:write` scope, granted in the Console under
        Settings → Developer Tools → API Keys. Without it every Gates API call
        answers `gates_scope_required`. The organization and environment always
        come from the key. Site keys are refused.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.