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

# Extend a gate's window

> Move a placed gate's closing time later. Extend-only: never earlier, never on a gate that has already closed (a closed gate is never reopened), never on a gate with no end time. Saved as the next version of the gate's policy document; every other setting is unchanged.



## OpenAPI

````yaml /openapi.json post /gates-api/extend
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/extend:
    post:
      tags:
        - Gates API
      summary: Extend a gate's window
      description: >-
        Move a placed gate's closing time later. Extend-only: never earlier,
        never on a gate that has already closed (a closed gate is never
        reopened), never on a gate with no end time. Saved as the next version
        of the gate's policy document; every other setting is unchanged.
      operationId: GatesApiExtend
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - key
                - closesAt
              properties:
                key:
                  type: string
                  pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
                  description: The key of the gate to extend.
                  example: presale-nyc-1120
                closesAt:
                  type: string
                  format: date-time
                  description: >-
                    The new closing time (ISO 8601). Must be later than the
                    gate's current closing time.
                  example: '2026-11-21T04:00:00Z'
      responses:
        '200':
          description: >-
            Extended. NOTE: handler errors also arrive here (HTTP 200) as
            data.error — codes: `invalid_key` (401), `gates_scope_required`
            (403), `org_not_found` (404), `gate_not_found` (404 — no draft or
            active gate holds this key), `extend_only` (400 — closesAt is not
            later than now set), `invalid_closes_at` (400), `gate_closed` (409 —
            the window has already passed), `gate_has_no_end` (409), `conflict`
            (409 — the gate changed at the same moment; read and retry).
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    properties:
                      data:
                        type: object
                        required:
                          - gate
                          - extended
                          - version
                        properties:
                          gate:
                            $ref: '#/components/schemas/Gate'
                          extended:
                            type: boolean
                            description: Always true.
                          version:
                            type: integer
                            description: The gate's new policy document version.
                      error:
                        $ref: '#/components/schemas/GatesApiError'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - GatesKeyAuth: []
components:
  schemas:
    Gate:
      type: object
      required:
        - key
        - name
        - message
        - status
        - state
        - environment
        - destination_url
        - policy
        - placed_at
        - placed_by_api
      description: >-
        A gate as the Gates API returns it — your own facts about the gate,
        never anything about people.
      properties:
        key:
          type: string
          pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
          description: The gate key — what `create-verification-link` sends as `gate`.
          example: presale-nyc-1120
        name:
          type: string
          example: NYC presale
        message:
          type:
            - string
            - 'null'
          description: The gate's line to people on the arrival card.
        status:
          type: string
          enum:
            - draft
            - active
            - closed
          description: >-
            `draft` until activated; `closed` once closed (a closed gate cannot
            be reopened).
        state:
          type:
            - string
            - 'null'
          enum:
            - scheduled
            - open
            - closed
            - null
          description: >-
            Where an active gate is in its schedule. Null unless `status` is
            `active`.
        environment:
          type: string
          enum:
            - development
            - production
          description: The key's environment.
        destination_url:
          type:
            - string
            - 'null'
          format: uri
          description: Where the gate sends a person after they pass.
        policy:
          type:
            - object
            - 'null'
          description: >-
            The effective policy (base → org → gate). Null if none could be
            loaded.
          required:
            - preset
            - gate_type
            - age_threshold
            - signed_up
            - link
            - passes_per_person
            - real_days_at_least
            - schedule
            - line
          properties:
            preset:
              type:
                - string
                - 'null'
              enum:
                - presale
                - promo
                - drop
                - vote
                - reservation
                - claim
                - null
            gate_type:
              type: string
              enum:
                - human
                - age
            age_threshold:
              type:
                - integer
                - 'null'
              enum:
                - 13
                - 18
                - 21
                - null
              description: Age Gate only; null on a Human Gate.
            signed_up:
              type: boolean
            link:
              type: string
              enum:
                - required
                - optional
                - never
            passes_per_person:
              oneOf:
                - $ref: '#/components/schemas/PassesPerPerson'
                - type: 'null'
              description: Null = as often as they like.
            real_days_at_least:
              type: integer
              minimum: 0
              maximum: 365
            schedule:
              type: object
              required:
                - opensAt
                - closesAt
              properties:
                opensAt:
                  type:
                    - string
                    - 'null'
                  format: date-time
                closesAt:
                  type:
                    - string
                    - 'null'
                  format: date-time
            line:
              type: string
              description: The human-readable policy readback the Console shows.
              example: 2 per person · ever
        placed_at:
          type: string
          format: date-time
        placed_by_api:
          type: boolean
          description: true when an API key (not the Console) placed the gate.
    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
    PassesPerPerson:
      type: object
      required:
        - limit
        - window
      additionalProperties: false
      description: >-
        Passes per person on your platform: `limit` per `window` (`30d` =
        rolling 30 days, `ever` = lifetime).
      properties:
        limit:
          type: integer
          minimum: 1
          maximum: 100
          example: 2
        window:
          type: string
          enum:
            - day
            - week
            - 30d
            - ever
          example: ever
    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.