{
  "openapi": "3.1.0",
  "info": {
    "title": "Write Like Human API",
    "version": "1.4.0",
    "summary": "The Human Writing Protocol for AI agents: rules, a pitfall catalog, a draft checker, signed checks and an MCP server.",
    "description": "Free and open: the rules, the catalog, the checker and MCP need no key. Limits: 30 checker or MCP calls a minute per IP. Bearer tokens (OAuth, https://writelikehuman.app/.well-known/oauth-authorization-server) identify an agent. The early-bird pass (free, claimed at /checkout_sessions) signs check reports, 10 a day. Free pass, not a sale.",
    "contact": {
      "name": "Spectrum Flare",
      "url": "https://spectrumflr.com"
    },
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://writelikehuman.app"
    }
  ],
  "externalDocs": {
    "url": "https://writelikehuman.app/llms.txt",
    "description": "llms.txt"
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://writelikehuman.app/oauth/token",
            "scopes": {
              "check": "Identify the agent on /check",
              "mcp": "Identify the agent on /mcp"
            }
          },
          "authorizationCode": {
            "authorizationUrl": "https://writelikehuman.app/oauth/authorize",
            "tokenUrl": "https://writelikehuman.app/oauth/token",
            "scopes": {
              "check": "Identify the agent on /check",
              "mcp": "Identify the agent on /mcp"
            }
          }
        }
      },
      "pass": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "An early-bird pass from a completed checkout. Scope: signed_checks."
      }
    },
    "schemas": {
      "CheckRequest": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 30000
          },
          "lang": {
            "type": "string",
            "enum": [
              "en",
              "pl"
            ]
          },
          "channel": {
            "type": "string",
            "enum": [
              "default",
              "social",
              "email",
              "docs",
              "proposal",
              "article"
            ]
          }
        }
      },
      "CheckReport": {
        "type": "object",
        "properties": {
          "lang": {
            "type": "string"
          },
          "verdict": {
            "type": "string"
          },
          "counts": {
            "type": "object"
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "needs_a_reader": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "signature": {
            "type": "string",
            "description": "Compact JWS (EdDSA) over the report summary when a pass with scope signed_checks was sent. Verify with /.well-known/jwks.json."
          }
        }
      }
    }
  },
  "paths": {
    "/rules.md": {
      "get": {
        "operationId": "getRules",
        "summary": "The protocol as Markdown",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "pl",
                "all"
              ]
            }
          },
          {
            "name": "section",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/rules.json": {
      "get": {
        "operationId": "getRulesJson",
        "summary": "The protocol as JSON",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/patterns.json": {
      "get": {
        "operationId": "listPatterns",
        "summary": "The pitfall catalog",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/patterns/{id}.json": {
      "get": {
        "operationId": "getPattern",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One pattern",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Unknown id"
          }
        }
      }
    },
    "/check": {
      "post": {
        "operationId": "checkText",
        "summary": "Measure a draft against the protocol",
        "description": "Nothing is stored. With a pass (scope signed_checks) the report is signed.",
        "security": [
          {},
          {
            "pass": []
          },
          {
            "oauth2": [
              "check"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            },
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckReport"
                }
              }
            }
          },
          "400": {
            "description": "Bad input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Too long"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (streamable HTTP, stateless JSON-RPC)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agent": {
      "get": {
        "operationId": "whoami",
        "summary": "Echo how this site sees the caller: Web Bot Auth signature, bearer token",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "The one free pass on offer (not a sale)",
        "responses": {
          "200": {
            "description": "JSON",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/checkout_sessions": {
      "post": {
        "operationId": "createCheckoutSession",
        "summary": "Start a checkout (Agentic Commerce Protocol shape)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session"
          },
          "400": {
            "description": "Bad input"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/checkout_sessions/{id}": {
      "get": {
        "operationId": "getCheckoutSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session"
          },
          "404": {
            "description": "Unknown"
          }
        }
      },
      "post": {
        "operationId": "updateCheckoutSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session"
          }
        }
      }
    },
    "/checkout_sessions/{id}/complete": {
      "post": {
        "operationId": "completeCheckoutSession",
        "summary": "Complete the checkout with an empty body. Free pass, not a sale: returns the pass.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completed session with pass"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/checkout_sessions/{id}/cancel": {
      "post": {
        "operationId": "cancelCheckoutSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Canceled session"
          }
        }
      }
    },
    "/oauth/register": {
      "post": {
        "operationId": "registerClient",
        "summary": "Dynamic client registration (RFC 7591)",
        "responses": {
          "201": {
            "description": "Client"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/oauth/token": {
      "post": {
        "operationId": "token",
        "summary": "OAuth token endpoint",
        "responses": {
          "200": {
            "description": "Token"
          },
          "400": {
            "description": "OAuth error"
          },
          "429": {
            "description": "Rate limited. Retry-After says when.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Status",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    }
  }
}