{
  "openapi": "3.1.0",
  "info": {
    "title": "Proof of Type Input API",
    "version": "1.0.0",
    "summary": "Verify that a human typed a piece of text.",
    "description": "Proof of Type Input is an embeddable text box (https://www.proofoftype.com/sdk/v1.js) that proves a real person typed the text: signed in to Proof of Type, typed letter by letter (no paste, no AI-generated text), and signed on their phone. The site receives the text and a proof token (an EdDSA-signed JWT). This API verifies those tokens. Docs: https://www.proofoftype.com/developers/api",
    "contact": { "url": "https://www.proofoftype.com/developers" }
  },
  "servers": [{ "url": "https://www.proofoftype.com" }],
  "paths": {
    "/api/v1/verify": {
      "post": {
        "operationId": "verifyProof",
        "summary": "Verify a proof token (and optionally the text and your site)",
        "description": "Accept the text only if valid, text_matches and origin_matches are all true. CORS-enabled; no API key.",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyRequest" } } }
        },
        "responses": {
          "200": { "description": "Result", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyResponse" } } } },
          "400": { "description": "Missing token" }
        }
      },
      "get": {
        "operationId": "verifyProofGet",
        "summary": "Verify a proof token (query string)",
        "parameters": [
          { "name": "token", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "origin", "in": "query", "required": false, "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Result", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyResponse" } } } } }
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "operationId": "getJwks",
        "summary": "Public keys that sign proof tokens (EdDSA / Ed25519)",
        "responses": { "200": { "description": "JSON Web Key Set", "content": { "application/json": { "schema": { "type": "object" } } } } }
      }
    }
  },
  "components": {
    "schemas": {
      "VerifyRequest": {
        "type": "object",
        "required": ["token"],
        "properties": {
          "token": { "type": "string", "description": "The proof token (JWT) from the input's `<name>_proof` field or the verified event." },
          "text": { "type": "string", "description": "The exact text you received. Returns text_matches." },
          "origin": { "type": "string", "description": "Your site's origin, e.g. https://example.com. Returns origin_matches." }
        }
      },
      "VerifyResponse": {
        "type": "object",
        "required": ["valid"],
        "properties": {
          "valid": { "type": "boolean" },
          "reason": { "type": "string", "enum": ["missing_token", "malformed", "unknown_key", "bad_signature", "bad_claims", "unavailable"] },
          "text_matches": { "type": "boolean" },
          "origin_matches": { "type": "boolean" },
          "proof": { "$ref": "#/components/schemas/Proof" }
        }
      },
      "Proof": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "description": "Proof id (pot_…)" },
          "origin": { "type": "string", "description": "The site the text was typed on" },
          "author": { "type": "string", "description": "Proof of Type username who typed and signed it" },
          "signed_on": { "type": "string", "enum": ["ios", "android"] },
          "typed_at": { "type": "string", "format": "date-time" },
          "score": { "type": ["integer", "null"], "description": "Human score 0–100" },
          "wpm": { "type": ["integer", "null"] },
          "words": { "type": "integer" },
          "chars": { "type": "integer", "description": "Visible characters (no spaces)" },
          "text_sha256": { "type": "string", "description": "SHA-256 (hex) of the exact UTF-8 text" },
          "version": { "type": "integer" }
        }
      }
    }
  }
}
