# Tashkīl

> Add Arabic diacritics to unvoweled text. Send plain Fusha, get back the same text with the vowel marks needed for precise reading — ready for narration, learning tools, or TTS.

## Why diacritize

Tashkīl adds Arabic diacritics to unvoweled text, making written content clearer for pronunciation, narration, learning, and downstream speech workflows. The model is especially well suited to **Modern Standard Arabic (Fusha)**, where it preserves formal wording while adding the vowel marks needed for more precise reading.

| Included | Typical use case |
| --- | --- |
| Arabic diacritization for plain text | Preparing Fusha scripts for narration and text-to-speech |
| Strong performance on Fusha and formal Arabic | Supporting Arabic reading and pronunciation tools |
| Synchronous API response — simple app flows | Normalizing formal Arabic text before publishing or review |
| Output usable before TTS or content review | Cleaner input for [Synthesize](/text-to-speech/synthesize) and [Audio narrative](/text-to-speech/audio-narrative) |

> Best on formal Arabic. Dialectal, noisy, or highly informal text may need additional review after diacritization.

## Endpoint

`POST /api/v1/tashkil/diacritize`

Authenticated with the `x-api-key` header, JSON body in, JSON out. One field, one round trip.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | **Yes** | Arabic text to diacritize. |

## Diacritize text

Send unvoweled Arabic; read `data.diacritized_text` from the response.

```bash
curl 'https://api.munsit.com/api/v1/tashkil/diacritize' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_MUNSIT_API_KEY' \
  -d '{
    "text": "ذهب الطالب الى المدرسة"
  }'
```

```python
import requests

response = requests.post(
    "https://api.munsit.com/api/v1/tashkil/diacritize",
    headers={"x-api-key": "YOUR_MUNSIT_API_KEY"},
    json={"text": "ذهب الطالب الى المدرسة"},
)

result = response.json()
print(result["data"]["diacritized_text"])
```

```javascript
const response = await fetch('https://api.munsit.com/api/v1/tashkil/diacritize', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_MUNSIT_API_KEY',
  },
  body: JSON.stringify({ text: 'ذهب الطالب الى المدرسة' }),
});

const result = await response.json();
console.log(result.data.diacritized_text);
```

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

func main() {
    body, _ := json.Marshal(map[string]string{"text": "ذهب الطالب الى المدرسة"})

    req, _ := http.NewRequest("POST", "https://api.munsit.com/api/v1/tashkil/diacritize", bytes.NewReader(body))
    req.Header.Set("x-api-key", os.Getenv("MUNSIT_API_KEY"))
    req.Header.Set("Content-Type", "application/json")

    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()

    var result map[string]any
    json.NewDecoder(resp.Body).Decode(&result)
    data := result["data"].(map[string]any)
    fmt.Println(data["diacritized_text"])
}
```

Response

```
{
  "statusCode": 200,
  "data": {
    "original_text": "ذهب الطالب الى المدرسة",
    "diacritized_text": "ذَهَبَ الطَّالِبُ إِلَى المَدْرَسَةِ"
  },
  "message": "Success"
}
```

Output

```
ذَهَبَ الطَّالِبُ إِلَى المَدْرَسَةِ
```

Output

```
ذَهَبَ الطَّالِبُ إِلَى المَدْرَسَةِ
```

Output

```
ذَهَبَ الطَّالِبُ إِلَى المَدْرَسَةِ
```

## Response fields

The response wraps both the original and the diacritized text, so you can diff or display them side by side.

| Field | Type | Description |
| --- | --- | --- |
| `statusCode` | number | HTTP-style status code. |
| `data.original_text` | string | Original input text. |
| `data.diacritized_text` | string | Text with Arabic diacritics. |
| `message` | string | Request status message. |

## Errors

Errors follow the shared `errorCode` / `errorMessage` shape — for example `{"errorCode": 40101, "errorMessage": "API key required"}`, `"Invalid API key"`, or a validation error like `"text: Expected string"`.

| HTTP status | errorCode | Scenario |
| --- | --- | --- |
| **400** | `40001` | Missing or invalid `text` field. |
| **401** | `40101` | Missing, invalid, expired, or revoked API key. |
| **413** | `41301` | Request body exceeds the maximum size limit. |
| **500** | `50001` | Internal error or upstream Tashkil service failure. |

## Go further

Diacritized text is the perfect input for speech.

- [Synthesize speech](/text-to-speech/synthesize) — Feed the diacritized text straight into TTS for precise pronunciation. — `POST /text-to-speech`

- [Audio narrative](/text-to-speech/audio-narrative) — Turn the polished text into an embeddable audio player. — `dashboard`

- [Translation](/understanding/translation) — Translate content between languages with streaming output. — `POST /translation/stream`

- [Error handling](/errors) — The shared errorCode / errorMessage format, in full. — `guide`
