{
  "openapi": "3.0.3",
  "info": {
    "title": "Scroll the Lore API",
    "version": "1.0.0",
    "description": "Greek and Norse myth: daily readings explained line by line, plans, search, and the whole Theogony, Iliad, Odyssey and Poetic Edda read a passage at a time",
    "contact": {
      "email": "scriptureappshelp@outlook.com"
    }
  },
  "servers": [
    {
      "url": "https://scripturescroller.pages.dev/lore/v1"
    }
  ],
  "paths": {
    "/today": {
      "get": {
        "operationId": "getToday",
        "summary": "Today's reading, line by line (same as the app shows today)",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Optional day as YYYY-MM-DD. Defaults to today (UTC)."
          }
        ],
        "responses": {
          "200": {
            "description": "The reading"
          }
        }
      }
    },
    "/readings": {
      "get": {
        "operationId": "listReadings",
        "summary": "All curated daily readings and plans",
        "responses": {
          "200": {
            "description": "List"
          }
        }
      }
    },
    "/readings/{id}": {
      "get": {
        "operationId": "getReading",
        "summary": "One reading or plan, line by line",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The reading"
          },
          "404": {
            "description": "Unknown id"
          }
        }
      }
    },
    "/search": {
      "get": {
        "operationId": "searchReadings",
        "summary": "Search the curated readings",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching lines"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/card": {
      "get": {
        "operationId": "getCard",
        "summary": "Today's reading one line at a time, for voice. Say next to hear the next line.",
        "parameters": [
          {
            "name": "n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Which card, starting at 1. Defaults to 1."
          },
          {
            "name": "reading",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A reading or plan id from /readings. Defaults to today's reading."
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Optional day as YYYY-MM-DD. Defaults to today (UTC)."
          }
        ],
        "responses": {
          "200": {
            "description": "One card, with a say field for reading aloud and a next link"
          },
          "400": {
            "description": "Card number out of range"
          },
          "404": {
            "description": "Unknown reading"
          }
        }
      }
    },
    "/books": {
      "get": {
        "operationId": "listBooks",
        "summary": "The whole books in the Library that can be read a passage at a time",
        "responses": {
          "200": {
            "description": "Book list with a start_reading link for each"
          }
        }
      }
    },
    "/read": {
      "get": {
        "operationId": "readBook",
        "summary": "Read a whole book one passage at a time, for voice. Follow next for the next passage; it carries on into the next chapter.",
        "parameters": [
          {
            "name": "book",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Book id or title from /books, for example iliad, odyssey."
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Chapter, book or letter to start at, as listed in the book (for example 5). Defaults to the beginning."
          },
          {
            "name": "n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Passage within the section, starting at 1."
          }
        ],
        "responses": {
          "200": {
            "description": "One passage: original, English, a say field for reading aloud, and next and previous links"
          },
          "400": {
            "description": "Missing book or passage out of range"
          },
          "404": {
            "description": "Unknown book or section"
          }
        }
      }
    }
  }
}
