Cloudflare Turnstile Verification API

The Verification API from Cloudflare Turnstile — 1 operation(s) for verification.

OpenAPI Specification

cloudflare-turnstile-verification-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Cloudflare Turnstile Siteverify Verification API
  description: 'Server-side validation endpoint for Cloudflare Turnstile. The server

    submits the widget-issued token together with the site''s secret key to

    the siteverify endpoint and receives a JSON verdict containing success,

    challenge timestamp, hostname, action, cdata, and any error codes.

    '
  version: '1.0'
  contact:
    name: Cloudflare Turnstile
    url: https://developers.cloudflare.com/turnstile/get-started/server-side-validation/
servers:
- url: https://challenges.cloudflare.com
tags:
- name: Verification
paths:
  /turnstile/v0/siteverify:
    post:
      summary: Verify a Turnstile token
      operationId: siteverify
      tags:
      - Verification
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - secret
              - response
              properties:
                secret:
                  type: string
                  description: Turnstile secret key from the Cloudflare dashboard.
                response:
                  type: string
                  description: Token returned by the client-side Turnstile widget.
                remoteip:
                  type: string
                  description: Visitor IP address (optional).
                idempotency_key:
                  type: string
                  format: uuid
                  description: UUID to safely retry validation requests.
          application/json:
            schema:
              $ref: '#/components/schemas/SiteverifyRequest'
      responses:
        '200':
          description: Verification verdict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteverifyResponse'
components:
  schemas:
    SiteverifyRequest:
      type: object
      required:
      - secret
      - response
      properties:
        secret:
          type: string
        response:
          type: string
        remoteip:
          type: string
        idempotency_key:
          type: string
          format: uuid
    SiteverifyResponse:
      type: object
      properties:
        success:
          type: boolean
        challenge_ts:
          type: string
          format: date-time
        hostname:
          type: string
        action:
          type: string
        cdata:
          type: string
        error-codes:
          type: array
          items:
            type: string
            enum:
            - missing-input-secret
            - invalid-input-secret
            - missing-input-response
            - invalid-input-response
            - bad-request
            - timeout-or-duplicate
            - internal-error
        metadata:
          type: object
          properties:
            ephemeral_id:
              type: string
              description: Enterprise-only device fingerprint identifier.