Create glossary with API
This guide walks you through the process of using Glossaries via the Palabra API. Glossaries let you define how the Speech-to-Speech Translation API recognizes and translates specific words or phrases. This is especially useful for ensuring consistent and accurate translations of professional, technical, or brand-specific terminology when integrating Palabra into your own applications or workflows.
Step 1: Get API Credentials
Visit Palabra API keys section to obtain your Client ID
and Client Secret
.
Step 2: Prepare your file
Requirements for a glossary file:
Accepted formats: CSV
Maximum file size: 1 MB
The required file format depends on the Glossary Type:
- Translation: Two words per row — first the term in the Source Language, followed by the term in the Target Language.
- Validation: Two words per row — both terms in the Source Language.
Step 3: Send Glossary Creation Request
Glossary creation through the API is performed in two steps:
Step 1: Submit glossary metadata
First, send a POST
request to create glossary.
At this stage, you do not upload the csv file itself — only its metadata is submitted.
Sample payload
{
"name": "Glossary#2",
"is_enabled": "true",
"glossary_type": "asr_hot",
"source_lang": "en",
"target_lang": "fr"
}
Field descriptions
name
(required)
A user-defined name for the glossary.
This name will appear in your Palabra dashboard and help you identify the glossary later.
is_enabled
(required)
Indicates whether the glossary should be active immediately after creation.
true
: The glossary is enabled and can be used by the API.false
: The glossary is saved but not yet active.
glossary_type
(required)
Specifies the type of glossary to create. Each type determines how terms are formatted and interpreted:
translation
— Source-target word/phrase mapping for translation.asr
— Used to validate or correct speech recognition results.
source_lang
(required)
The language code for the source language of the glossary (e.g., en
, fr
, bg
).
Used to interpret input terms.
target_lang
(conditionally required)
The language code for the target language, required only if glossary_type
is translation
.
Ignored for asr
and asr_hot
.
Create glossary request
fetch('https://api.palabra.ai/saas/glossary', {
method: 'POST',
headers: {
'ClientId': '<YOUR_CLIENT_ID>',
'ClientSecret': '<YOUR_CLIENT_SECRET>'
},
body: JSON.stringify({
data: {
name: 'Glossary#2',
is_enabled: true,
glossary_type: 'asr_hot',
source_lang: 'en',
target_lang: 'fr'
}
})
})
.then(response => response.json())
.catch(error => {
console.error('Error creating glossary:', error);
});
Response example
{
"glossary_id": "62edf6b3-458a-4bed-ab6e-e0b257bb4471",
"user_id": "02117a4f-a847-4264-9807-704d279bbf3a",
"name": "Glossary#2",
"is_enabled": true,
"glossary_type": "asr_hot",
"source_lang": "en",
"target_lang": "fr",
"utc_created_at": "2025-06-23T11:30:44.445612"
}
Step 2: Upload your file
Upload your file using POST
request to the following endpoint:
https://api.palabra.ai/saas/glossary/${id}/upload
const formData = new FormData();
formData.append('file', file);
fetch('https://api.palabra.ai/saas/glossary/62edf6b3-458a-4bed-ab6e-e0b257bb4471/upload', {
method: 'POST',
headers: {
'ClientId': '<YOUR_CLIENT_ID>',
'ClientSecret': '<YOUR_CLIENT_SECRET>'
},
body: formData
})
.then(response => response.json())
.catch(error => {
console.error('Upload error:', error);
});
After the file is uploaded, the glossary is ready to be used.