> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bakbak.si/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bakbak.si/_mcp/server.

# Transcribe audio

POST https://hub.getraya.app/transcribe
Content-Type: multipart/form-data

Transcribes a WAV audio file using `multipart/form-data`.

Reference: https://docs.bakbak.si/api-reference/speech-to-text/transcribe

## Authentication

- `X-API-Key` header (required) — API key for authentication. Example: raya_ABCD1234567890abcdef

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — Audio file to transcribe (WAV format).
- `language` (enum, optional) — Optional language code for transcription.

## Response

### 200

Transcription successful

- `transcript` (string, required) — Transcribed text.
- `status` (enum, required) — Request status.
  - Allowed values: `success`, `error`

## Errors

### 400 Bad Request Error

Bad request - validation error

- `detail` (string, optional) — Error message describing what went wrong

### 401 Unauthorized Error

Unauthorized - Invalid or missing API key

- `detail` (string, optional) — Error message describing what went wrong

### 500 Internal Server Error

Internal server error

- `detail` (string, optional) — Error message describing what went wrong

## Examples

**Request**

```json
{
  "file": "<file: string>",
  "language": "hi"
}
```

**Response**

```json
{
  "transcript": "थैंक यू सर बस कुछ चीज़ें पूछनी थी ताकि हम कंसल्टेशन अच्छे से प्लान कर सकें आपके प्लॉट का एरिया रफली कितना होगा",
  "status": "success"
}
```

**SDK Code**

```python Speech-to-Text_transcribe_example
import requests

url = "https://hub.getraya.app/transcribe"

files = { "file": "open('string', 'rb')" }
payload = { "language": "hi" }
headers = {"X-API-Key": "<apiKey>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript Speech-to-Text_transcribe_example
const url = 'https://hub.getraya.app/transcribe';
const form = new FormData();
form.append('file', 'string');
form.append('language', 'hi');

const options = {method: 'POST', headers: {'X-API-Key': '<apiKey>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Speech-to-Text_transcribe_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://hub.getraya.app/transcribe"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nhi\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Speech-to-Text_transcribe_example
require 'uri'
require 'net/http'

url = URI("https://hub.getraya.app/transcribe")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nhi\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java Speech-to-Text_transcribe_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://hub.getraya.app/transcribe")
  .header("X-API-Key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nhi\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php Speech-to-Text_transcribe_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://hub.getraya.app/transcribe', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ],
    [
        'name' => 'language',
        'contents' => 'hi'
    ]
  ]
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Speech-to-Text_transcribe_example
using RestSharp;

var client = new RestClient("https://hub.getraya.app/transcribe");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nhi\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Speech-to-Text_transcribe_example
import Foundation

let headers = ["X-API-Key": "<apiKey>"]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ],
  [
    "name": "language",
    "value": "hi"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://hub.getraya.app/transcribe")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```