{
  "openapi": "3.1.0",
  "info": {
    "title": "ScopeBlind API",
    "version": "1.0.0",
    "description": "API abuse protection using cryptographic device proofs (VOPRF). Replaces CAPTCHAs. No PII, no friction, ~20ms at the edge. Full integration guide: https://www.scopeblind.com/llms.txt",
    "contact": {
      "email": "tommy@scopeblind.com",
      "url": "https://www.scopeblind.com"
    },
    "license": {
      "name": "FSL-1.1-MIT",
      "url": "https://fsl.software"
    },
    "x-llms-txt": "https://www.scopeblind.com/llms.txt"
  },
  "servers": [
    {
      "url": "https://api.scopeblind.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/provision": {
      "post": {
        "operationId": "provisionTenant",
        "summary": "Create a new ScopeBlind tenant",
        "description": "Provisions a new tenant and returns a slug, management token, and deployment config. The slug is used to generate the client script URL and dashboard URL. Save the mgmt_token securely — it is returned only once.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "target_url"
                ],
                "properties": {
                  "target_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "The API endpoint URL to protect (e.g. https://myapp.com/api/signup)"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Optional contact email for dashboard access and abuse reports"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tenant created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{12}$",
                      "description": "Unique tenant identifier"
                    },
                    "mgmt_token": {
                      "type": "string",
                      "description": "Management token (save securely, returned only once)"
                    },
                    "verifier_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Server-side verification endpoint"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "shadow"
                      ],
                      "description": "Initial mode (shadow = observe only)"
                    },
                    "deploy_config": {
                      "type": "object",
                      "description": "Environment variables for deployment",
                      "properties": {
                        "SCOPEBLIND_VERIFIER_URL": {
                          "type": "string"
                        },
                        "SHADOW_MODE": {
                          "type": "string"
                        },
                        "PROTECTED_METHODS": {
                          "type": "string"
                        },
                        "FALLBACK_MODE": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (missing URL, invalid format, etc.)"
          }
        }
      }
    },
    "/probe": {
      "post": {
        "operationId": "probeEndpoint",
        "summary": "Scan an API endpoint for abuse vulnerabilities",
        "description": "Analyzes the target URL for common abuse vectors: missing rate limiting, no bot detection, open registration, etc. Returns a list of checks with pass/warn/fail status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "HTTPS URL to scan"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Optional email for scan report delivery"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scan complete",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pass",
                              "warn",
                              "fail"
                            ]
                          },
                          "detail": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "recommendation": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sb/{slug}.js": {
      "get": {
        "operationId": "getClientScript",
        "summary": "Client-side verification script",
        "description": "Returns the JavaScript snippet to add to your HTML <head>. The script runs silently — no UI, no CAPTCHA. It generates a VOPRF device proof and sets an sb_token cookie.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JavaScript file",
            "content": {
              "application/javascript": {}
            }
          }
        }
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "operationId": "getJWKS",
        "summary": "Public keys for JWT verification",
        "description": "Returns the JSON Web Key Set used to verify ScopeBlind JWTs. Algorithm: EdDSA (Ed25519). Use with jose (Node.js) or PyJWT (Python).",
        "responses": {
          "200": {
            "description": "JWKS",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v/{slug}/verify": {
      "post": {
        "operationId": "verifyProof",
        "summary": "Server-side proof verification",
        "description": "Verifies a device proof token. Alternative to local JWT verification with JWKS.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-f0-9]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verification result"
          },
          "403": {
            "description": "Invalid or missing proof"
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Full integration guide for AI agents (llms.txt)",
    "url": "https://www.scopeblind.com/llms.txt"
  }
}