Skip to content
dhanu docs
Browse pages

API reference

Transcribe audio

POST /api/pub/v1/transcriptions, turn an audio file into text.

POSThttps://api.dhanu.ai/api/pub/v1/transcriptions

Transcribes one audio file sent as a multipart request (field audio) and returns the text. It runs synchronously, so keep clips to a few minutes; for long recordings upload the file and start a task instead. Billed per call; a test key returns a fixture transcript at no cost.

Request

curl -X POST https://api.dhanu.ai/api/pub/v1/transcriptions \
  -H "Authorization: Bearer $DHANU_API_KEY" \
  -F "audio=@standup.m4a"
const { text } = await dhanu.transcriptions.create({
  data: await fs.readFile("standup.m4a"),
  filename: "standup.m4a",
  mimeType: "audio/mp4",
});
with open("standup.m4a", "rb") as fh:
    transcript = dhanu.transcriptions.create(data=fh.read(), filename="standup.m4a", mime_type="audio/mp4")
print(transcript.text)

Response

201 Created

{ "text": "Yesterday I finished the invoice export…", "cost": { "amount": 12, "currency": "NPR" } }

Errors

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.
invalid_request_body422The body did not match the schema; error.issues names each field.
project_id_required422A multi-project key called without projectId.
insufficient_credits402The workspace credit balance is zero or below.
key_spend_limit_reached402The key reached its monthly spend cap.
invalid_generation_prompt422The prompt was empty or longer than 2000 characters.
unsupported_media_type415The file type is not accepted.