{
    "openapi": "3.0.3",
    "info": {
        "title": "Text Analysis \u2014 Ksty.ch",
        "version": "1.0",
        "description": "Word counts, readability grades and language detection for any block of text \u2014 rule-based, no ML.\n\n# Text Analysis API\n\nThree things about a block of text, in one call: **how big it is**, **how hard it is to read**, and **what language it is in**.\n\nEverything is computed from the text itself using published formulas and character statistics. No model is loaded, no external service is contacted. That has two consequences worth planning around: latency is flat and predictable regardless of load, and the same input always returns the same numbers \u2014 so you can store a score and compare it against one computed months later.\n\n```\nPOST /api/v1/text-analysis\nX-Api-Key: ksty_test_...\nContent-Type: application/json\n\n{\"text\": \"The quick brown fox jumps over the lazy dog. It was a sunny day.\"}\n```\n\n```json\n{\n  \"counts\": { \"words\": 14, \"sentences\": 2, \"syllables\": 17, \"reading_time_seconds\": 5 },\n  \"readability\": {\n    \"reliable\": true,\n    \"scores\": { \"flesch_reading_ease\": 92.4, \"flesch_kincaid_grade\": 2.1 },\n    \"consensus_grade\": 2.4,\n    \"interpretation\": { \"ease\": \"very easy\", \"school_level\": \"2nd grade\" }\n  },\n  \"language\": { \"language\": \"en\", \"name\": \"English\", \"confidence\": 0.71 }\n}\n```\n\n## Counts\n\nWords keep their internal apostrophes and hyphens \u2014 \"don't\" is one word, not two, because that is what a reader speaks and what the readability formulas assume when they divide by word count.\n\nSentence splitting masks common abbreviations first. Without that, *\"Dr. Smith went home.\"* counts as two sentences, which shortens the average sentence length and makes the text look far simpler than it is. Every grade-level formula divides by sentence count, so that single mistake moves all of them at once.\n\nReading time assumes 200 words per minute silently; speaking time assumes 130.\n\n## Readability\n\nSix formulas, not one:\n\n| Score | Reads as |\n|---|---|\n| `flesch_reading_ease` | 0\u2013100, **higher is easier**. 60\u201370 is standard prose. |\n| `flesch_kincaid_grade` | US school grade |\n| `gunning_fog` | US school grade, weights 3+ syllable words |\n| `smog_index` | US school grade, common in health writing |\n| `coleman_liau_index` | US school grade, from letters rather than syllables |\n| `automated_readability_index` | US school grade, from characters |\n\nThey weigh the same two ingredients \u2014 sentence length and word weight \u2014 but disagree on the weighting, so they routinely differ by a grade or two on the same text. `consensus_grade` averages the five grade-level scores. **The spread between them is itself information**: when they cluster, the text is consistently pitched; when they scatter, it mixes short sentences with heavy vocabulary (or the reverse), and no single number describes it well.\n\nBelow 10 words, `reliable` is `false` and `scores` is `null`. A formula built on averages over sentences cannot say anything trustworthy about a fragment, and returning a confident-looking number for \"Hello there\" would be worse than returning nothing.\n\n> These formulas are calibrated on **English** prose. Run them on French and you will get numbers, but not meaningful ones \u2014 which is why the language result is returned alongside, so you can check before trusting the grade.\n\n## Language detection\n\nTwo stages, cheapest and most decisive first.\n\n**Script.** Most languages are settled by the Unicode block their letters occupy \u2014 Devanagari is Hindi, Hangul is Korean, Thai is Thai. Near-certain from a handful of characters, no statistics needed. Detected this way: Japanese, Korean, Chinese, Russian, Arabic, Hindi, Hebrew, Greek, Thai. The response reports `\"method\": \"script\"`.\n\n**Function words and n-grams.** English, Spanish, French, German, Italian, Portuguese and Dutch share an alphabet, so they need evidence. Three signals combine: function words (`the`, `de`, `der`, `het`), character trigrams that capture morphology (`sch`, `\u00e7\u00e3o`, `ijk`), and diacritics (`\u00df`, `\u00f1`). Function words carry the most weight because they survive topic changes \u2014 a Spanish text about football and one about medicine share almost no vocabulary except `de`, `la`, `que`. Reported as `\"method\": \"ngram\"`.\n\n`confidence` is the winner's share of the total evidence, so it says how far clear of the runner-up it finished \u2014 not how certain the answer is in absolute terms. `alternatives` lists the next-best candidates, which is where you look when confidence is middling.\n\n### Accuracy & limitations\n\n- **Short text is hard.** Under 5 words, `reliable` is `false`. \"No\" is valid in several of these languages, and nothing can decide between them.\n- **Related languages compete.** Spanish and Portuguese, or Dutch and German, share function words and diacritics. Expect lower confidence on a single sentence and check `alternatives`.\n- **One language per call.** A text mixing two languages returns whichever dominates, not a breakdown.\n- **Syllables are approximated.** English syllable counting uses vowel-group heuristics; an exact count needs a pronunciation dictionary. It is within one syllable on the overwhelming majority of words, and the formulas themselves were calibrated on the same approximation.\n\n## When to use it\n\n- Enforcing a reading level on help-centre or policy copy before it ships.\n- Routing user-submitted content to the right language queue.\n- Showing \"N min read\" on articles, from a real word count.\n- Screening a CMS import for text that is far denser than the rest of the corpus.",
        "x-credit-cost": 1,
        "x-free-grant": {
            "type": "monthly",
            "amount": 100
        },
        "x-sandbox": true
    },
    "servers": [
        {
            "url": "https://ksty.ch/api/v1"
        }
    ],
    "security": [
        {
            "ApiKeyAuth": []
        }
    ],
    "paths": {
        "/text-analysis": {
            "get": {
                "operationId": "text-analysis_get",
                "summary": "Full analysis \u2014 counts, readability and language",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "counts": {
                                        "words": 9,
                                        "sentences": 1,
                                        "syllables": 11,
                                        "reading_time_seconds": 3
                                    },
                                    "readability": {
                                        "reliable": false,
                                        "note": "Fewer than 10 words \u2014 readability scores need a paragraph or so to mean anything, so they are omitted.",
                                        "scores": null
                                    },
                                    "language": {
                                        "language": "en",
                                        "name": "English",
                                        "confidence": 0.68,
                                        "reliable": true
                                    }
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "counts": {
                                            "type": "object",
                                            "description": "Every size measure \u2014 see the counts endpoint."
                                        },
                                        "readability": {
                                            "type": "object",
                                            "description": "Six formulas plus a consensus grade, or nulls with a note when the text is too short."
                                        },
                                        "language": {
                                            "type": "object",
                                            "description": "Detected language with confidence and alternatives."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "description": "Runs all three analyses and returns them together. The focused endpoints below cost the same, so use them only when you want a smaller payload.",
                "parameters": [
                    {
                        "name": "text",
                        "in": "query",
                        "required": true,
                        "description": "The text to analyse. Up to 100,000 characters.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "operationId": "text-analysis_post",
                "summary": "Full analysis \u2014 counts, readability and language",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "counts": {
                                        "words": 9,
                                        "sentences": 1,
                                        "syllables": 11,
                                        "reading_time_seconds": 3
                                    },
                                    "readability": {
                                        "reliable": false,
                                        "note": "Fewer than 10 words \u2014 readability scores need a paragraph or so to mean anything, so they are omitted.",
                                        "scores": null
                                    },
                                    "language": {
                                        "language": "en",
                                        "name": "English",
                                        "confidence": 0.68,
                                        "reliable": true
                                    }
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "counts": {
                                            "type": "object",
                                            "description": "Every size measure \u2014 see the counts endpoint."
                                        },
                                        "readability": {
                                            "type": "object",
                                            "description": "Six formulas plus a consensus grade, or nulls with a note when the text is too short."
                                        },
                                        "language": {
                                            "type": "object",
                                            "description": "Detected language with confidence and alternatives."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "description": "Runs all three analyses and returns them together. The focused endpoints below cost the same, so use them only when you want a smaller payload.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "text"
                                ],
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "The text to analyse. Up to 100,000 characters.",
                                        "example": "The quick brown fox jumps over the lazy dog."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/text-analysis.counts": {
            "get": {
                "operationId": "text-analysis_counts_get",
                "summary": "Word, sentence and character counts only",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "characters": 28,
                                    "characters_no_spaces": 23,
                                    "words": 6,
                                    "unique_words": 6,
                                    "sentences": 2,
                                    "paragraphs": 1,
                                    "syllables": 7,
                                    "avg_word_length": 3.83,
                                    "avg_sentence_length": 3,
                                    "reading_time_seconds": 2,
                                    "speaking_time_seconds": 3
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "characters": {
                                            "type": "integer",
                                            "description": "Total characters including whitespace."
                                        },
                                        "characters_no_spaces": {
                                            "type": "integer",
                                            "description": "Characters with all whitespace removed."
                                        },
                                        "letters": {
                                            "type": "integer",
                                            "description": "Letter characters only \u2014 the input to the Coleman-Liau and ARI formulas."
                                        },
                                        "words": {
                                            "type": "integer",
                                            "description": "Words, counting \"don't\" and \"well-known\" as one each."
                                        },
                                        "unique_words": {
                                            "type": "integer",
                                            "description": "Distinct words, compared case-insensitively."
                                        },
                                        "sentences": {
                                            "type": "integer",
                                            "description": "Sentences, with common abbreviations masked so \"Dr.\" does not split one."
                                        },
                                        "paragraphs": {
                                            "type": "integer",
                                            "description": "Blocks separated by a blank line."
                                        },
                                        "syllables": {
                                            "type": "integer",
                                            "description": "Approximate total syllables (English vowel-group heuristic)."
                                        },
                                        "polysyllabic_words": {
                                            "type": "integer",
                                            "description": "Words of 3+ syllables \u2014 what Gunning Fog and SMOG treat as complex."
                                        },
                                        "long_words": {
                                            "type": "integer",
                                            "description": "Words of 7+ characters."
                                        },
                                        "avg_word_length": {
                                            "type": "number",
                                            "description": "Mean characters per word."
                                        },
                                        "avg_sentence_length": {
                                            "type": "number",
                                            "description": "Mean words per sentence."
                                        },
                                        "avg_syllables_per_word": {
                                            "type": "number",
                                            "description": "Mean syllables per word."
                                        },
                                        "reading_time_seconds": {
                                            "type": "integer",
                                            "description": "At 200 words per minute, silent reading."
                                        },
                                        "speaking_time_seconds": {
                                            "type": "integer",
                                            "description": "At 130 words per minute, read aloud."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "text",
                        "in": "query",
                        "required": true,
                        "description": "The text to count.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "operationId": "text-analysis_counts_post",
                "summary": "Word, sentence and character counts only",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "characters": 28,
                                    "characters_no_spaces": 23,
                                    "words": 6,
                                    "unique_words": 6,
                                    "sentences": 2,
                                    "paragraphs": 1,
                                    "syllables": 7,
                                    "avg_word_length": 3.83,
                                    "avg_sentence_length": 3,
                                    "reading_time_seconds": 2,
                                    "speaking_time_seconds": 3
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "characters": {
                                            "type": "integer",
                                            "description": "Total characters including whitespace."
                                        },
                                        "characters_no_spaces": {
                                            "type": "integer",
                                            "description": "Characters with all whitespace removed."
                                        },
                                        "letters": {
                                            "type": "integer",
                                            "description": "Letter characters only \u2014 the input to the Coleman-Liau and ARI formulas."
                                        },
                                        "words": {
                                            "type": "integer",
                                            "description": "Words, counting \"don't\" and \"well-known\" as one each."
                                        },
                                        "unique_words": {
                                            "type": "integer",
                                            "description": "Distinct words, compared case-insensitively."
                                        },
                                        "sentences": {
                                            "type": "integer",
                                            "description": "Sentences, with common abbreviations masked so \"Dr.\" does not split one."
                                        },
                                        "paragraphs": {
                                            "type": "integer",
                                            "description": "Blocks separated by a blank line."
                                        },
                                        "syllables": {
                                            "type": "integer",
                                            "description": "Approximate total syllables (English vowel-group heuristic)."
                                        },
                                        "polysyllabic_words": {
                                            "type": "integer",
                                            "description": "Words of 3+ syllables \u2014 what Gunning Fog and SMOG treat as complex."
                                        },
                                        "long_words": {
                                            "type": "integer",
                                            "description": "Words of 7+ characters."
                                        },
                                        "avg_word_length": {
                                            "type": "number",
                                            "description": "Mean characters per word."
                                        },
                                        "avg_sentence_length": {
                                            "type": "number",
                                            "description": "Mean words per sentence."
                                        },
                                        "avg_syllables_per_word": {
                                            "type": "number",
                                            "description": "Mean syllables per word."
                                        },
                                        "reading_time_seconds": {
                                            "type": "integer",
                                            "description": "At 200 words per minute, silent reading."
                                        },
                                        "speaking_time_seconds": {
                                            "type": "integer",
                                            "description": "At 130 words per minute, read aloud."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "text"
                                ],
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "The text to count.",
                                        "example": "Hello world. This is a test."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/text-analysis.readability": {
            "get": {
                "operationId": "text-analysis_readability_get",
                "summary": "Readability grades and a plain-language interpretation",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "reliable": true,
                                    "scores": {
                                        "flesch_reading_ease": 8.2,
                                        "flesch_kincaid_grade": 19.8,
                                        "gunning_fog": 24.6,
                                        "smog_index": 19.1,
                                        "coleman_liau_index": 21.4,
                                        "automated_readability_index": 23.1
                                    },
                                    "consensus_grade": 21.6,
                                    "interpretation": {
                                        "ease": "very difficult",
                                        "school_level": "College graduate",
                                        "audience": "Academic or specialist register; expect general readers to struggle."
                                    }
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reliable": {
                                            "type": "boolean",
                                            "description": "false when the text is under 10 words, in which case scores is null. A grade computed from two sentences is noise, so none is returned."
                                        },
                                        "note": {
                                            "type": "string",
                                            "description": "Why scores were omitted, when they were."
                                        },
                                        "consensus_grade": {
                                            "type": "number",
                                            "description": "Mean of the five grade-level scores. A wide spread between them means the text mixes registers."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "text",
                        "in": "query",
                        "required": true,
                        "description": "The text to score. Needs at least 10 words to return scores.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "operationId": "text-analysis_readability_post",
                "summary": "Readability grades and a plain-language interpretation",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "reliable": true,
                                    "scores": {
                                        "flesch_reading_ease": 8.2,
                                        "flesch_kincaid_grade": 19.8,
                                        "gunning_fog": 24.6,
                                        "smog_index": 19.1,
                                        "coleman_liau_index": 21.4,
                                        "automated_readability_index": 23.1
                                    },
                                    "consensus_grade": 21.6,
                                    "interpretation": {
                                        "ease": "very difficult",
                                        "school_level": "College graduate",
                                        "audience": "Academic or specialist register; expect general readers to struggle."
                                    }
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reliable": {
                                            "type": "boolean",
                                            "description": "false when the text is under 10 words, in which case scores is null. A grade computed from two sentences is noise, so none is returned."
                                        },
                                        "note": {
                                            "type": "string",
                                            "description": "Why scores were omitted, when they were."
                                        },
                                        "consensus_grade": {
                                            "type": "number",
                                            "description": "Mean of the five grade-level scores. A wide spread between them means the text mixes registers."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "text"
                                ],
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "The text to score. Needs at least 10 words to return scores.",
                                        "example": "The committee subsequently determined that the implementation of the proposed methodology would necessitate substantial additional expenditure."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/text-analysis.language": {
            "get": {
                "operationId": "text-analysis_language_get",
                "summary": "Detect the language of the text",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "language": "fr",
                                    "name": "French",
                                    "script": "Latin",
                                    "confidence": 0.42,
                                    "reliable": true,
                                    "method": "ngram",
                                    "alternatives": [
                                        {
                                            "language": "es",
                                            "name": "Spanish",
                                            "confidence": 0.21
                                        }
                                    ]
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "language": {
                                            "type": "string",
                                            "description": "ISO 639-1 code, or null when nothing could be determined."
                                        },
                                        "name": {
                                            "type": "string",
                                            "description": "English name of the language."
                                        },
                                        "script": {
                                            "type": "string",
                                            "description": "Writing system \u2014 Latin, Cyrillic, Han, Devanagari and so on."
                                        },
                                        "confidence": {
                                            "type": "number",
                                            "description": "0\u20131. The winner's share of the total evidence, so it measures the margin over the runner-up rather than absolute certainty."
                                        },
                                        "reliable": {
                                            "type": "boolean",
                                            "description": "false for very short text or a close call. Check alternatives before acting on an unreliable result."
                                        },
                                        "method": {
                                            "type": "string",
                                            "description": "script when the Unicode block decided it (near-certain), ngram when function words and trigrams did, none when nothing matched."
                                        },
                                        "alternatives": {
                                            "type": "array",
                                            "description": "Next-best candidates with their confidence. Populated only for Latin-script scoring."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "text",
                        "in": "query",
                        "required": true,
                        "description": "The text to identify. At least 5 words for a reliable answer on Latin-script languages.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "operationId": "text-analysis_language_post",
                "summary": "Detect the language of the text",
                "x-credit-cost": 1,
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "example": {
                                    "language": "fr",
                                    "name": "French",
                                    "script": "Latin",
                                    "confidence": 0.42,
                                    "reliable": true,
                                    "method": "ngram",
                                    "alternatives": [
                                        {
                                            "language": "es",
                                            "name": "Spanish",
                                            "confidence": 0.21
                                        }
                                    ]
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "language": {
                                            "type": "string",
                                            "description": "ISO 639-1 code, or null when nothing could be determined."
                                        },
                                        "name": {
                                            "type": "string",
                                            "description": "English name of the language."
                                        },
                                        "script": {
                                            "type": "string",
                                            "description": "Writing system \u2014 Latin, Cyrillic, Han, Devanagari and so on."
                                        },
                                        "confidence": {
                                            "type": "number",
                                            "description": "0\u20131. The winner's share of the total evidence, so it measures the margin over the runner-up rather than absolute certainty."
                                        },
                                        "reliable": {
                                            "type": "boolean",
                                            "description": "false for very short text or a close call. Check alternatives before acting on an unreliable result."
                                        },
                                        "method": {
                                            "type": "string",
                                            "description": "script when the Unicode block decided it (near-certain), ngram when function words and trigrams did, none when nothing matched."
                                        },
                                        "alternatives": {
                                            "type": "array",
                                            "description": "Next-best candidates with their confidence. Populated only for Latin-script scoring."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "invalid_request \u2014 No \"text\" parameter was sent, or it was empty once trimmed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid API key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits \u2014 nothing is charged and the API is never reached",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "The key is not scoped to this API, or a test key was used on an API without sandbox support",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "text_too_large \u2014 The text exceeded 100,000 characters.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded for this key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "The API failed after being charged; credits are refunded automatically",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "text"
                                ],
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "The text to identify. At least 5 words for a reliable answer on Latin-script languages.",
                                        "example": "Le chat noir dort sur le tapis dans le salon."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Api-Key"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string",
                                "description": "Stable machine-readable code \u2014 branch on this, never on the message."
                            },
                            "message": {
                                "type": "string"
                            },
                            "request_id": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
}