{
  "openapi": "3.1.0",
  "info": {
    "title": "Lyric Studio rhymes API",
    "version": "1.0.0",
    "description": "Rhymes, syllable counts and rhyme schemes for English song lyrics, from the Lyric Studio rhyming dictionary. Free, no key."
  },
  "servers": [{ "url": "https://api.lyricstudio.co" }],
  "paths": {
    "/api/rhymes": {
      "get": {
        "operationId": "findRhymes",
        "summary": "Perfect, multisyllabic and slant rhymes for a word or short phrase",
        "parameters": [
          { "name": "word", "in": "query", "required": true, "schema": { "type": "string", "maxLength": 60 }, "description": "A word or a phrase of up to four words." },
          { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "maximum": 80, "default": 40 } }
        ],
        "responses": {
          "200": {
            "description": "Rhymes grouped by kind, each with its syllable count",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rhymes" } } }
          }
        }
      }
    },
    "/api/analyze": {
      "post": {
        "operationId": "analyzeLyrics",
        "summary": "Syllables and rhyme letter of every line",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "properties": { "text": { "type": "string", "maxLength": 8000 } }, "required": ["text"] } } }
        },
        "responses": {
          "200": {
            "description": "Each line with its syllable count and rhyme letter",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Analysis" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Rhyme": { "type": "object", "properties": { "word": { "type": "string" }, "syllables": { "type": "integer" } } },
      "Rhymes": {
        "type": "object",
        "properties": {
          "query": { "type": "string" },
          "found": { "type": "boolean" },
          "syllables": { "type": "integer" },
          "perfect": { "type": "array", "items": { "$ref": "#/components/schemas/Rhyme" } },
          "multisyllabic": { "type": "array", "items": { "$ref": "#/components/schemas/Rhyme" } },
          "slant": { "type": "array", "items": { "$ref": "#/components/schemas/Rhyme" } },
          "page": { "type": "string" },
          "app": { "type": "string" }
        }
      },
      "Analysis": {
        "type": "object",
        "properties": {
          "lines": {
            "type": "array",
            "items": { "type": "object", "properties": { "line": { "type": "string" }, "syllables": { "type": "integer" }, "rhyme": { "type": ["string", "null"] } } }
          },
          "total_syllables": { "type": "integer" },
          "scheme": { "type": "string" }
        }
      }
    }
  }
}
