{
  "openapi": "3.1.0",
  "info": {
    "title": "Shir-man Jina Proxy API",
    "version": "1.0.0",
    "description": "Cloudflare Pages Function that forwards a verified URL request to r.jina.ai and returns markdown."
  },
  "servers": [
    {
      "url": "https://shir-man.com"
    }
  ],
  "paths": {
    "/jina-proxy": {
      "get": {
        "summary": "Fetch markdown for a verified URL or return the configured Turnstile site key",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "required": false,
            "description": "Target URL to proxy to r.jina.ai."
          },
          {
            "name": "sitekey",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "If present, returns the configured Turnstile site key."
          },
          {
            "name": "turnstileToken",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Turnstile token for verified content requests."
          },
          {
            "name": "cf-turnstile-response",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Alternate Turnstile token parameter."
          }
        ],
        "responses": {
          "200": {
            "description": "Markdown or JSON site key response"
          },
          "4XX": {
            "description": "Client error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Fetch markdown for a verified URL",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "target": {
                    "type": "string",
                    "format": "uri"
                  },
                  "href": {
                    "type": "string",
                    "format": "uri"
                  },
                  "turnstileToken": {
                    "type": "string"
                  },
                  "cf-turnstile-response": {
                    "type": "string"
                  }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Markdown response from the upstream reader"
          },
          "4XX": {
            "description": "Client error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
