API Documentation

Welcome to the Njoka AI API. Our platform provides enterprise-grade access to African voice models, enabling you to build applications that speak and understand the languages of Central Africa.

Base URL: https://api.njokalab.com/v1

Authentication

The Njoka AI API uses API keys to authenticate requests. You can view and manage your API keys in the Developer Dashboard.

Authentication to the API is performed via HTTP Bearer Auth. Provide your API key as the Bearer token value.

bash

curl https://api.njokalab.com/v1/models \ -H "Authorization: Bearer YOUR_API_KEY"


POST

/stt

Transcribes audio files into text. Optimized for code-switching (Pidgin/English/French).

Parameters

Name Type Description
audio file The audio file to transcribe (mp3, wav, m4a). Max 25MB.
language string Optional. ISO code (e.g., 'en', 'fr', 'pcm'). Defaults to auto-detect.
diarization boolean Whether to identify different speakers. Default: false.

Example Request

curl -X POST https://api.njokalab.com/v1/stt \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "audio=@recording.mp3" \ -F "language=pcm"

Example Response

{
  "id": "stt_123456789",
  "text": "Abeg, wait small, I dey come.",
  "language": "pcm",
  "confidence": 0.98,
  "segments": [
    {
      "start": 0.0,
      "end": 2.5,
      "text": "Abeg, wait small,"
    },
    {
      "start": 2.5,
      "end": 4.0,
      "text": "I di cam."
    }
  ]
}

POST

/tts

Converts text into natural-sounding speech using African voices.

Parameters

Name Type Description
text string The text to synthesize. Max 4096 chars.
voice_id string ID of the voice (e.g., 'kofi_cm', 'amina_ng').

Example Request

curl -X POST https://api.njokalab.com/v1/tts \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "Welcome to NjokaLab, creating the future of African AI.", "voice_id": "kofi_cm" }' --output output.mp3


POST

/translate

Translates text between supported languages, preserving cultural nuances.

Parameters

Name Type Description
text string Text to translate.
source_lang string Source language code (e.g., 'pcm').
target_lang string Target language code (e.g., 'en').

Errors

Njoka AI uses conventional HTTP response codes to indicate the success or failure of an API request.

Code Description
400 Bad Request. The request was unacceptable (e.g., missing parameter).
401 Unauthorized. No valid API key provided.
429 Too Many Requests. You hit the rate limit.
500 Server Error. Something went wrong on our end.