Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.credentialsportal.com/llms.txt

Use this file to discover all available pages before exploring further.

The translation endpoints let you translate text using AI (powered by Meta’s M2M-100 model via Workers AI). Translations are cached to avoid redundant processing.

Translate text

POST /api/translate
Translates one or more strings into a target language. Request body:
text
string
A single string to translate. Use texts instead for batch mode.
texts
array
An array of strings to translate. Maximum 200 strings per request. Use this for batch mode instead of text.
to
string
required
BCP 47 language code of the target language (e.g., "es", "fr", "pt")
from
string
BCP 47 language code of the source language. Defaults to "en" if omitted.
Example — translate a single string:
curl -X POST https://app.credentialsportal.com/api/translate \
  -H "Authorization: Bearer ck_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Welcome to Credentials Portal",
    "to": "es"
  }'
Response:
{
  "translated": "Bienvenido al Portal de Credenciales",
  "from": "en",
  "to": "es"
}
Example — translate multiple strings:
curl -X POST https://app.credentialsportal.com/api/translate \
  -H "Authorization: Bearer ck_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "texts": ["Hello", "Goodbye", "Thank you"],
    "to": "fr"
  }'
Response:
{
  "translated": ["Bonjour", "Au revoir", "Merci"],
  "from": "en",
  "to": "fr"
}

List supported languages

GET /api/translate/languages
Returns all supported languages with their BCP 47 codes and display names (in both English and the native script). Example:
curl https://app.credentialsportal.com/api/translate/languages \
  -H "Authorization: Bearer ck_your_api_key"
Response:
{
  "languages": {
    "en": ["English", "English"],
    "es": ["Spanish", "Español"],
    "fr": ["French", "Français"],
    "pt": ["Portuguese", "Português"],
    "de": ["German", "Deutsch"],
    "zh": ["Chinese", "中文"]
  }
}
Each entry is an array of [englishName, nativeName]. 70+ languages are supported.

Translation in messages

Message translation happens automatically — when a user reads a conversation, each message is translated into their language on the fly. You don’t need to call the translation endpoint yourself for messaging. The POST /api/translate endpoint is useful for translating other content — such as custom field values, course names, or external data you’re importing.