Mansa Platform Docs

Transcribe

Convert speech audio recordings into text via file upload or remote URL.

POST/v1/transcribe

Request example

curl --fail-with-body "$MANSA_API_BASE_URL/v1/transcribe" \
  -H "Authorization: Bearer $MANSA_API_KEY" \
  -F "audio=@interview_recording.wav" \
  -F "language=swahili"

Output

{
  "context": "OK",
  "data": {
    "transcript": "Habari za asubuhi, karibu kwenye mkutano wetu wa leo.",
    "text": "Habari za asubuhi, karibu kwenye mkutano wetu wa leo.",
    "durationSeconds": 45.2,
    "chunksUsed": 2
  }
}

Convert speech audio recordings into text across 38 African languages and English. Audio is transcribed using the OmniASR acoustic model with automated silence-aware chunking and intelligent text prettification (punctuation and capitalization).


Authentication

All requests require Bearer token authentication in the HTTP header:

Authorization: Bearer <YOUR_API_KEY>

Endpoint Overview

POST /v1/transcribe

Supports three input ingestion methods:

  1. Base64 Audio in JSON (audioBase64): Send raw base64-encoded audio directly in an application/json payload.
  2. Remote URL in JSON (audioUrl): Provide a publicly accessible HTTPS link to an audio file in an application/json payload.
  3. Direct Binary Upload (multipart/form-data): Upload a binary audio file directly.

Input Ingestion Methods

Method 1: Base64 Audio (application/json)

Submit base64-encoded audio strings directly in your JSON body. The server accepts raw base64 strings as well as strings prefixed with data URLs (e.g. data:audio/wav;base64,...).

curl -X POST https://api.mansa.ai/v1/transcribe \
  -H "Authorization: Bearer mansa_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "audioBase64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA...",
    "language": "swahili",
    "prettify": true
  }'

Method 2: Remote Audio URL (application/json)

Submit the URL of an audio file hosted on cloud storage (e.g. AWS S3, Google Cloud Storage, Cloudflare R2).

curl -X POST https://api.mansa.ai/v1/transcribe \
  -H "Authorization: Bearer mansa_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "audioUrl": "https://storage.example.com/audio/interview.mp3",
    "language": "yoruba",
    "prettify": true
  }'

JSON Request Fields (application/json)

FieldTypeRequiredDefaultDescription
audioBase64StringYes*—Base64-encoded audio bytes (*required if audioUrl is omitted).
audioUrlString (URI)Yes*—Publicly accessible HTTPS URL to audio file (*required if audioBase64 is omitted).
languageStringYes—Target language name (e.g. Swahili), ISO code (e.g. sw), or "auto".
prettifyBooleanNotrueWhen true, automatically applies punctuation, capitalization, and grammatical formatting using an LLM. Set to false for raw acoustic output.
fileNameStringNo—Optional original filename for tracking and auditing.
surfaceStringNo—Optional client surface tag (e.g. "mobile", "chat").

Method 3: Direct File Upload (multipart/form-data)

Upload an audio file directly from a client application or mobile device (up to 100 MB).

curl -X POST https://api.mansa.ai/v1/transcribe \
  -H "Authorization: Bearer mansa_live_..." \
  -F "audio=@recording.wav" \
  -F "language=swahili" \
  -F "prettify=true"

Multipart Form Fields

FieldTypeRequiredDefaultDescription
audioFile (Binary)Yes—The audio recording file to transcribe (up to 100 MB). (Alias: file)
languageStringYes—Target language name or code, or "auto" for automatic detection.
prettifyString / BooleanNotrueWhen true (or "true"), formats the transcript with punctuation and capitalization.
fileNameStringNo—Optional filename override.
surfaceStringNo—Optional client surface identifier.

Supported Audio Encodings & Limits

  • Supported Formats: WAV, MP3, WebM, OGG, M4A, FLAC, AAC.
  • Maximum File / Payload Size: 100 MB (both for direct file uploads and JSON payloads).
  • Automatic Chunking: Long audio recordings are dynamically divided into chunks with silence-aware boundary detection to ensure continuous transcript accuracy.

Response Structure

Successful responses are wrapped in the standard Mansa API envelope (data):

{
  "context": "OK",
  "data": {
    "transcript": "Habari za asubuhi, karibu kwenye mkutano wetu wa leo.",
    "rawTranscript": "habari za asubuhi karibu kwenye mkutano wetu wa leo",
    "prettified": true,
    "text": "Habari za asubuhi, karibu kwenye mkutano wetu wa leo.",
    "durationSeconds": 45.2,
    "chunksUsed": 2,
    "billing": {
      "cost": 8,
      "balanceBefore": 250,
      "balanceAfter": 242,
      "pricing": {
        "rate": "per_second"
      }
    }
  },
  "meta": {
    "cost": 8,
    "balanceBefore": 250,
    "balanceAfter": 242,
    "pricing": {
      "rate": "per_second"
    }
  }
}
  • data.transcript: The finalized transcript. If prettify is enabled, this contains punctuation and capitalization.
  • data.rawTranscript: The raw, unformatted acoustic model output.
  • data.prettified: Boolean indicating whether formatting was applied.
  • data.durationSeconds: Exact audio duration detected by server-side FFmpeg analysis.
  • data.chunksUsed: Number of audio segments processed.
  • data.billing: Mansa Credits consumed and remaining account balance.

Supported Languages (38 Languages)

Language inputs are case-insensitive. You can pass full language names, common aliases, or standard ISO 639 codes:

LanguageSlug / CodeLanguageSlug / Code
Afrikaansafrikaans / afAmharicamharic / am
Arabicarabic / arBambarabambara / bm
Bembabemba / bemBerberberber
Chichewa (Nyanja)chichewa / nyEnglishenglish / en
Eweewe / eeFonfon
Fula (Fulani)fula / ffHausahausa / ha
Igboigbo / igKanurikanuri / kr
Kikuyukikuyu / kiKinyarwandakinyarwanda / rw
Kirundikirundi / rnKriokrio
Lingalalingala / lnLuganda (Ganda)luganda / lg
Malagasymalagasy / mgNdebele (South)ndebele / nr
Oromooromo / omSepedi (N. Sotho)sepedi / nso
Sesotho (S. Sotho)sesotho / stShonashona / sn
Somalisomali / soSwahiliswahili / sw
Swatiswati / ssTigrinyatigrinya / ti
Tsongatsonga / tsTswanatswana / tn
Twi (Akan)twi / akUmbunduumbundu / umb
Vendavenda / veWolofwolof / wo
Xhosaxhosa / xhYorubayoruba / yo
Zuluzulu / zu

[!TIP] Regional Arabic dialects (e.g. Arabic (Egyptian), Arabic (Algerian), Arabic (Moroccan)) and Malagasy dialects (e.g. Malagasy (Plateau)) are automatically normalized to their respective model targets.


Errors & HTTP Status Codes

Errors use the standard RFC-7807 error format (HttpErrorDto):

{
  "type": "about:blank",
  "title": "BAD_REQUEST",
  "isError": true,
  "detail": "Either audioUrl or audioBase64 must be provided in the JSON payload.",
  "invalidParams": [],
  "context": ""
}
HTTP StatusError Category (title)Common Causes
400BAD_REQUESTMissing audio payload (neither audioBase64, audioUrl, nor multipart file provided).
401AUTHENTICATION_ERRORMissing or invalid API key in Authorization header.
402PAYMENT_ERRORInsufficient credit balance to process the audio duration.
413PAYLOAD_TOO_LARGEAudio file or base64 payload exceeds the 100 MB limit.
422VALIDATION_ERRORMissing required language parameter, or unsupported language.
500SERVER_ERRORAcoustic model inference or audio decoding failure.

Billing & Credits

  • Automatic Server Duration Calculation: Billed duration is detected by server-side FFmpeg analysis of the audio stream.
  • Pricing Rate: Transcription is billed on a per-second basis, equivalent to $10 per hour of audio (~$0.17 per minute).
  • Solvency Check: A preflight check verifies your wallet has sufficient balance for the estimated recording length before inference starts.
  • Text Prettification: Included at no additional charge when prettify: true is enabled.

For account balance management and bulk packages, see Pricing.