{
  "openapi": "3.0.3",
  "info": {
    "title": "Verse Made Simple public verse search",
    "version": "1.2.0",
    "description": "English GET lookup and bilingual POST text search without AI-provider processing. Returns KJV source text and AI-assisted explanations. This is separate from the authenticated /api/v1 API."
  },
  "servers": [
    {
      "url": "https://www.versemadesimple.com"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchVerses",
        "summary": "Search verse text and references",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "A verse reference or text query. Missing or empty queries return [].",
            "schema": {
              "type": "string"
            },
            "example": "John 3:16"
          }
        ],
        "responses": {
          "200": {
            "description": "An array of verse matches. No match returns an empty array.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/VerseMatch"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Query exceeds 200 characters"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Search is temporarily unavailable"
          }
        }
      },
      "post": {
        "operationId": "searchPublishedText",
        "summary": "Search published English or Spanish readings without an AI provider",
        "description": "Returns faithful-style AI-assisted readings from the published text index. Search text is in the request body, not the URL. Missing language variants remain null. This endpoint does not generate text or send queries to an AI provider.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "example": "Juan 3:16"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "es"
                    ],
                    "default": "en"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30,
                    "default": 15
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Published faithful readings; count zero means no published matches.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "results",
                    "query",
                    "count"
                  ],
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "slug",
                          "reference",
                          "kjv",
                          "url",
                          "style",
                          "language",
                          "score"
                        ],
                        "properties": {
                          "slug": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "kjv": {
                            "type": "string",
                            "description": "English KJV source, separately attributed."
                          },
                          "simplified": {
                            "type": "string",
                            "nullable": true
                          },
                          "simplifiedEs": {
                            "type": "string",
                            "nullable": true
                          },
                          "bottomLine": {
                            "type": "string",
                            "nullable": true
                          },
                          "bottomLineEs": {
                            "type": "string",
                            "nullable": true
                          },
                          "url": {
                            "type": "string"
                          },
                          "style": {
                            "type": "string",
                            "enum": [
                              "faithful"
                            ]
                          },
                          "language": {
                            "type": "string",
                            "enum": [
                              "en",
                              "es"
                            ]
                          },
                          "score": {
                            "type": "string",
                            "enum": [
                              ""
                            ],
                            "description": "Legacy native compatibility field; no semantic score is produced."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, query, language or limit"
          },
          "429": {
            "description": "Request rate limit reached"
          },
          "503": {
            "description": "Search temporarily unavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VerseMatch": {
        "type": "object",
        "required": [
          "id",
          "reference",
          "kjv",
          "simplified",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "john-3-16"
          },
          "reference": {
            "type": "string",
            "example": "John 3:16"
          },
          "kjv": {
            "type": "string",
            "nullable": true
          },
          "simplified": {
            "type": "string",
            "description": "Published faithful-style AI-assisted reading; not canonical scripture."
          },
          "url": {
            "type": "string",
            "example": "/john/3/16",
            "description": "Relative verse page path."
          }
        }
      }
    }
  }
}
