Translation
Convert audio files to translated text accurately using Hasab AI APIs
Translation Endpoints
1. Upload and Translate Audio
Endpoint: POST /v1/upload-audio
Description: Upload an audio file and get its translated text.
Request Body (multipart/form-data):
{
"translate": true,
"summarize": false,
"language": "amh",
"transcribe": true,
"timestamps": false,
"source_language": "eng",
"file": "audio_file"
}Validation
| Parameter | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The audio file to process (MP3, WAV, or M4A). |
transcribe | Boolean | Yes | Whether to transcribe the audio (default: true). |
translate | Boolean | Yes | Whether to translate the transcription (default: true). |
summarize | Boolean | Yes | Whether to generate a summary of the transcription (default: false). |
language | String | Yes | Target language code for translation (e.g., "amh" for Amharic). |
source_language | String | Yes | Language code of the original audio (e.g., "eng" for English). |
timestamps | Boolean | No | Whether to include timestamps for each segment of the transcription (default: false). |
Response:
{
"success": true,
"message": "Audio uploaded and translated successfully",
"audio": {
"id": 1235,
"user_id": 5,
"filename": "/path/to/audio/meeting_recording.wav",
"original_filename": "meeting_recording.wav",
"path": "/path/to/audio/meeting_recording.wav",
"mime_type": "wav",
"file_size": "2048000",
"duration_in_seconds": 180,
"description": "Team meeting recording",
"is_meeting": true,
"summary": "",
"transcription": "The popover's position is controlled by the data-side attribute, which determines where it appears relative to the trigger. For example, data-side=\"bottom\" places it below, top above, left to the left, and right to the right. Each position also includes a smooth slide-in animation from the opposite direction, creating a clean and dynamic opening effect.",
"translation": "የፖፖቨሩ አቀማመጥ ከትሪገሩ አንጻር የት እንደሚታይ የሚወሰነው በዳታ-ሳይድ ባህሪው ነው። ለምሳሌ፣ ዳታ-ሳይድ=\"bottom\" ሲሆን ከታች፣ \"top\" ሲሆን ከላይ፣ \"left\" ሲሆን ወደ ግራ፣ እና \"right\" ሲሆን ደግሞ ወደ ቀኝ ያስቀምጠዋል። እያንዳንዱ አቀማመጥ ደግሞ ከተቃራኒ አቅጣጫ የሚመጣ ለስላሳ ተንሸራታች የመግቢያ አኒሜሽን ያካትታል፣ ይህም ንፁህ እና ተለዋዋጭ የመክፈቻ ውጤት ይፈጥራል።",
"created_at": "2025-10-29T14:00:00.000000Z",
"updated_at": "2025-10-29T14:00:00.000000Z"
},
"metadata": {
"tokens_charged": 25,
"remaining_tokens": 975,
"charge_message": "Tokens charged successfully"
},
"charge_message": "Tokens charged successfully",
"remaining_tokens": 975,
"tokens_charged": 25,
"summary": "",
"timestamp": []
}2. Translation History
Endpoint: GET /v1/translations
Description: Retrieve a list of all translation jobs processed by the user.
Query Parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
page | Int | No | Specify which page of results to retrieve. Default is 1. |
Response:
{
"status": "success",
"data": {
"translations": {
"current_page": 1,
"data": [
{
"id": 5595,
"user_id": "5",
"device_id": null,
"source_language": "english",
"target_language": "amh",
"source_text": "The popover's position is controlled by the data-side attribute, which determines where it appears relative to the trigger. For example, data-side=\"bottom\" places it below, top above, left to the left, and right to the right. Each position also includes a smooth slide-in animation from the opposite direction, creating a clean and dynamic opening effect.",
"translated_text": "የፖፖቨሩ አቀማመጥ ከትሪገሩ አንጻር የት እንደሚታይ የሚወሰነው በዳታ-ሳይድ ባህሪው ነው። ለምሳሌ፣ ዳታ-ሳይድ=\"bottom\" ሲሆን ከታች፣ \"top\" ሲሆን ከላይ፣ \"left\" ሲሆን ወደ ግራ፣ እና \"right\" ሲሆን ደግሞ ወደ ቀኝ ያስቀምጠዋል። እያንዳንዱ አቀማመጥ ደግሞ ከተቃራኒ አቅጣጫ የሚመጣ ለስላሳ ተንሸራታች የመግቢያ አኒሜሽን ያካትታል፣ ይህም ንፁህ እና ተለዋዋጭ የመክፈቻ ውጤት ይፈጥራል።",
"character_count": "356",
"success": "1",
"error_message": null,
"created_at": "2025-10-27T08:30:39.000000Z",
"updated_at": "2025-10-27T08:30:50.000000Z"
}
],
"first_page_url": "https://hasab.co/api/v1/translations?page=1",
"from": 1,
"last_page": 9,
"last_page_url": "https://hasab.co/api/v1/translations?page=9",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
}
],
"next_page_url": "https://hasab.co/api/v1/translations?page=2",
"path": "https://hasab.co/api/v1/translations",
"per_page": 15,
"prev_page_url": null,
"to": 15,
"total": 131
}
},
"message": "Translation history retrieved successfully",
"code": 200
}