{"openapi":"3.1.0","info":{"title":"Taktik Voice API","version":"1.0.0","description":"Phoneme-level pronunciation assessment for English learners. Send a WAV recording and the text that was read; get scores for the utterance, every word and every phoneme. Requests are processed in the EU (AWS Ireland).","contact":{"name":"Taktik Voice","email":"contact@taktikware.com","url":"https://taktikvoice.com/#contact"}},"servers":[{"url":"https://api.taktikvoice.com","description":"Production"}],"externalDocs":{"url":"https://taktikvoice.com/docs","description":"Guides: authentication, audio format, errors and rate limits"},"tags":[{"name":"Pronunciation","description":"Pronunciation assessment"}],"security":[{"bearerAuth":[]}],"paths":{"/service/pronunciation":{"post":{"tags":["Pronunciation"],"summary":"Assess pronunciation","description":"Scores a recording against the text the speaker was asked to read, at utterance, word and phoneme level. Rate limit: 10 requests per minute per client IP. Errors raised by the assessment service (`400`, `503` while the model loads, `504`) carry a double-encoded `detail`: see `ServiceErrorDetail`.","operationId":"assessPronunciation","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PronunciationRequest"},"examples":{"shape":{"summary":"Request shape (replace audio_base64 with your recording)","description":"`audio_base64` here is only the 44-byte header of an empty 16 kHz mono 16-bit WAV file.","value":{"audio_base64":"UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=","transcript":"Could you send the proposal by Thursday?","language":"us"}}}}}},"responses":{"200":{"description":"Assessment result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PronunciationResponse"},"example":{"accuracy":0.96,"words":[{"text":"Could","phonemes":[{"text":"kʰ","start_time":0.2405,"end_time":0.2605,"probability":0.9956,"correct":true,"expected":["kʰ"],"candidates":[]},{"text":"ʊ","start_time":0.2806,"end_time":0.3006,"probability":0.6448,"correct":true,"expected":["ʊ"],"candidates":[]},{"text":"d","start_time":0.3407,"end_time":0.3808,"probability":0.4019,"correct":true,"expected":["d"],"candidates":[]}],"start_time":0.2405,"end_time":0.3808,"accuracy":1},{"text":"Thursday","phonemes":[{"text":"θ","start_time":1.6634,"end_time":1.6834,"probability":0.9876,"correct":true,"expected":["θ"],"candidates":[]},{"text":"ɝ","start_time":1.7035,"end_time":1.7235,"probability":0.9863,"correct":true,"expected":["ɝ"],"candidates":[]},{"text":"z","start_time":1.944,"end_time":1.964,"probability":0.9938,"correct":true,"expected":["z"],"candidates":[]},{"text":"d","start_time":1.9841,"end_time":2.0241,"probability":0.9592,"correct":true,"expected":["d"],"candidates":[]},{"text":"ej","start_time":0,"end_time":0,"probability":0,"correct":false,"expected":["ej"],"candidates":[{"value":"h/ç","probability":0.0103}]}],"start_time":1.6634,"end_time":2.0241,"accuracy":0.8}]}}}},"400":{"description":"The assessment service rejected the request: `language` other than `us`/`uk`, empty transcript, invalid base64, audio that is not a readable WAV, empty or shorter than 0.1 seconds. `detail` is double-encoded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceErrorDetail"},"examples":{"language":{"summary":"Unsupported language","value":{"detail":"{\"detail\":\"'fr' is not supported. Language must be 'us' or 'uk'.\"}"}},"wav":{"summary":"Audio is not a readable WAV file","value":{"detail":"{\"detail\":\"Invalid WAV file format\"}"}},"short":{"summary":"Audio too short","value":{"detail":"{\"detail\":\"Audio file is too short (minimum 0.1 seconds required)\"}"}}}}}},"401":{"description":"Missing, malformed, invalid or expired token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDetail"},"example":{"detail":"Missing or invalid Authorization header"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"More than 10 requests in the current minute from your IP address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitError"},"example":{"error":"Rate limit exceeded: 10 per 1 minute"}}}},"500":{"description":"Unexpected error. The usual cause is a long recording: the gateway waits 30 seconds for the assessment and then answers 500 with a `ReadTimeout` in `detail`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDetail"},"example":{"detail":"Gateway error forwarding to pronunciation-service: ReadTimeout('')"}}}},"503":{"description":"Temporarily unavailable: either the service stayed at capacity after the gateway retried for you (plain `detail`), or the model is still loading on a freshly started instance (double-encoded `detail`). Retry later with backoff.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorDetail"},"examples":{"capacity":{"summary":"At capacity after the gateway’s retries","value":{"detail":"Pronunciation service at capacity, please retry"}},"loading":{"summary":"Model still loading (double-encoded)","value":{"detail":"{\"detail\":\"Model is still loading, please retry\"}"}}}}}},"504":{"description":"Model inference took longer than 30 seconds. In practice the gateway’s own 30-second timeout usually fires first, so a long recording more often surfaces as `500`. `detail` is double-encoded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceErrorDetail"},"example":{"detail":"{\"detail\":\"Model inference timed out after 30.0s\"}"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Send `Authorization: Bearer <token>` with the token Taktik issued to you."}},"schemas":{"PronunciationRequest":{"properties":{"audio_base64":{"type":"string","title":"Audio Base64","description":"The recording as a WAV file, base64-encoded. Recommended: PCM 16-bit, 16 kHz, mono (other sample rates are resampled to 16 kHz and stereo is mixed down to mono). At least 0.1 seconds; keep it to a sentence, because processing is cut off at about 30 seconds. Send the plain base64 string, without a `data:` URI prefix."},"transcript":{"type":"string","title":"Transcript","description":"The text the speaker was asked to read. Must not be empty."},"language":{"type":"string","title":"Language","default":"uk","description":"Reference accent: `uk` (British English, default) or `us` (American English). Any other value returns `400`.","enum":["us","uk"]}},"type":"object","required":["audio_base64","transcript"],"title":"PronunciationRequest","description":"Audio plus the text the speaker was asked to read."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"PronunciationResponse":{"title":"PronunciationResponse","type":"object","description":"Scores for the whole utterance, every word of the transcript and every phoneme in each word.","required":["accuracy","words"],"properties":{"accuracy":{"type":"number","minimum":0,"maximum":1,"description":"Overall pronunciation score for the utterance: correct phonemes divided by all phonemes, from 0 to 1 (higher is better).","examples":[0.96]},"words":{"type":"array","description":"One entry per word of the normalised transcript, in order.","items":{"$ref":"#/components/schemas/WordScore"}}}},"WordScore":{"title":"WordScore","type":"object","required":["text","accuracy","start_time","end_time","phonemes"],"properties":{"text":{"type":"string","description":"The word after normalisation: punctuation removed and numbers spelled out (`21` becomes `twenty` and `one`), so `words` can have more entries than the transcript has words.","examples":["Thursday"]},"accuracy":{"type":"number","minimum":0,"maximum":1,"description":"Share of the word’s phonemes that were pronounced correctly, from 0 to 1.","examples":[0.8]},"start_time":{"type":"number","description":"Start of the word in the audio, in seconds.","examples":[1.6634]},"end_time":{"type":"number","description":"End of the word in the audio, in seconds.","examples":[2.0241]},"phonemes":{"type":"array","description":"The expected phonemes of the word, in order (the most likely pronunciation in the reference pronunciation lexicon). A word missing from the pronunciation lexicon comes back with a single phoneme whose `text` is an empty string and `correct` is `false`.","items":{"$ref":"#/components/schemas/PhonemeScore"}}}},"PhonemeScore":{"title":"PhonemeScore","type":"object","required":["text","start_time","end_time","probability","correct","expected","candidates"],"properties":{"text":{"type":"string","description":"The expected phoneme, in IPA. Empty string when the word is not in the reference pronunciation lexicon.","examples":["θ"]},"start_time":{"type":"number","description":"Start of the phoneme in the audio, in seconds. Can be 0 when the phoneme was not detected.","examples":[1.6634]},"end_time":{"type":"number","description":"End of the phoneme in the audio, in seconds. Can be 0 when the phoneme was not detected.","examples":[1.6834]},"probability":{"type":"number","minimum":0,"maximum":1,"description":"Model probability for this phoneme, from 0 to 1. It is a confidence value, not a grade: use `correct` to decide whether the phoneme was pronounced as expected.","examples":[0.9876]},"correct":{"type":"boolean","description":"Whether the phoneme was pronounced as expected.","examples":[false]},"expected":{"type":"array","items":{"type":"string"},"description":"Accepted pronunciation(s) of this phoneme, in IPA.","examples":[["ej"]]},"candidates":{"type":"array","description":"Other phonemes the model heard, with their probability. Often empty.","items":{"$ref":"#/components/schemas/PhonemeCandidate"}}},"examples":[{"text":"ej","start_time":0,"end_time":0,"probability":0,"correct":false,"expected":["ej"],"candidates":[{"value":"h/ç","probability":0.0103}]}]},"PhonemeCandidate":{"title":"PhonemeCandidate","type":"object","required":["value","probability"],"properties":{"value":{"type":"string","description":"Phoneme the model heard, in IPA.","examples":["h/ç"]},"probability":{"type":"number","minimum":0,"maximum":1,"description":"Model probability for this candidate, from 0 to 1.","examples":[0.0103]}}},"ErrorDetail":{"title":"ErrorDetail","type":"object","required":["detail"],"properties":{"detail":{"type":"string","description":"Human-readable error message."}}},"ServiceErrorDetail":{"title":"ServiceErrorDetail","type":"object","required":["detail"],"description":"Error raised by the assessment service. `detail` is a string that contains the service’s own JSON error body, so parse it a second time to read the message.","properties":{"detail":{"type":"string","description":"JSON text such as `{\"detail\":\"Invalid WAV file format\"}`: parse it to get the message."}}},"RateLimitError":{"title":"RateLimitError","type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Which limit was exceeded.","examples":["Rate limit exceeded: 10 per 1 minute"]}}}}}}