> ## Documentation Index
> Fetch the complete documentation index at: https://docs.destined.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculate Accuracy

> Calculate WER/CER between reference and hypothesis text

<Note>
  This endpoint does not require authentication.
</Note>

## Request Body

<ParamField body="reference" type="string" required>
  The ground truth text
</ParamField>

<ParamField body="hypothesis" type="string" required>
  The transcribed text to evaluate
</ParamField>

## Response

<ResponseField name="wer" type="number" required>
  Word Error Rate (0.0 to 1.0)
</ResponseField>

<ResponseField name="cer" type="number" required>
  Character Error Rate (0.0 to 1.0)
</ResponseField>

<ResponseField name="substitutions" type="integer" required>
  Number of word substitutions
</ResponseField>

<ResponseField name="insertions" type="integer" required>
  Number of word insertions
</ResponseField>

<ResponseField name="deletions" type="integer" required>
  Number of word deletions
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.destined.ai/v1/stt/calculate-accuracy" \
    -H "Content-Type: application/json" \
    -d '{
      "reference": "Hello, this is a test.",
      "hypothesis": "Hello, this is the test."
    }'
  ```

  ```typescript TypeScript theme={null}
  const accuracy = await client.sttTesting.calculateAccuracyV1SttCalculateAccuracyPost({
    reference: "Hello, this is a test.",
    hypothesis: "Hello, this is the test.",
  });

  console.log(`WER: ${accuracy.wer * 100}%`);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "wer": 0.20,
    "cer": 0.05,
    "substitutions": 1,
    "insertions": 0,
    "deletions": 0,
    "reference_words": 5,
    "hypothesis_words": 5
  }
  ```
</ResponseExample>
