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

# Create transcript from one uploaded audio file.

POST https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text
Content-Type: multipart/form-data

Transcribe one audio clip (up to the deployment's length limit, 120 s by default) and return the transcript in a single JSON response, with optional per-word timestamps and speaker attribution. Send the audio as a multipart file upload (`file`). The language is set per request (`language`, `ja` by default).

Options: `with_timestamps` adds `words` with start and end times; `diarization` attributes words to speakers (`speaker_id`: `speaker_1`, `speaker_2`, …) on deployments whose model carries speaker tokens, with word times null unless `with_timestamps` is also set; `kana` writes personal names in katakana.

The same route also accepts a JSON body (`Content-Type: application/json`) with `audio_url` (an https URL on fal's CDN or a base64 `data:` URI), `language`, and the optional `with_timestamps` / `diarization` flags; this is what the fal Playground and queue send. The response and the billed units are the same for both bodies.

In the Python SDK this route is `client.asr.transcribe(path, language=..., with_timestamps=..., diarization=...)`.

Reference: https://docs.kotoba.tech/s2t/file/speech-to-text-api/create-speech-to-text-transcript

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — Audio file to transcribe.
- `file_format` (enum, optional) — Input audio format. Use pcm_s16le_16 for raw 16-bit little-endian PCM at 16kHz mono; use other for encoded audio/video files.
- `language` (string, optional) — Input language. Same format as input-streaming TTS open messages; defaults to the configured server language.
- `keywords` (list of string, optional) — Keywords to use for the transcription. List of strings. Defaults to none.
- `kana` (boolean, optional) — 人名をカタカナで書き起こすかどうか。
- `with_timestamps` (boolean, optional) — Include calibrated timestamp items in the response.
- `diarization` (boolean, optional) — Attribute words and spacing to speakers. Times are null unless with_timestamps is enabled.

## Response

### 200

Successful Response

- `language_code` (string, required)
- `language_probability` (double, required)
- `text` (string, required)
- `words` (list of SpeechToTextWord, required)
- `audio_duration_secs` (double, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### SpeechToTextWord

- `text` (string, required)
- `type` (enum, optional, default: word)
  - Allowed values: `word`, `spacing`, `audio_event`
- `start` (double, optional, nullable)
- `end` (double, optional, nullable)
- `speaker_id` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

## Examples

**Request**

```json
{
  "file": "<file: UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=>"
}
```

**Response**

```json
{
  "language_code": "ja",
  "language_probability": 0.987,
  "text": "こんにちは、皆さん。本日の会議を始めましょう。",
  "words": [
    {
      "text": "こんにちは",
      "type": "word",
      "start": 0,
      "end": 0.5,
      "speaker_id": "speaker_1"
    },
    {
      "text": "、",
      "type": "spacing",
      "start": 0.5,
      "end": 0.6,
      "speaker_id": "speaker_1"
    },
    {
      "text": "皆さん",
      "type": "word",
      "start": 0.6,
      "end": 1,
      "speaker_id": "speaker_1"
    },
    {
      "text": "。",
      "type": "spacing",
      "start": 1,
      "end": 1.1,
      "speaker_id": "speaker_1"
    },
    {
      "text": "本日",
      "type": "word",
      "start": 1.2,
      "end": 1.6,
      "speaker_id": "speaker_2"
    },
    {
      "text": "の",
      "type": "word",
      "start": 1.6,
      "end": 1.7,
      "speaker_id": "speaker_2"
    },
    {
      "text": "会議",
      "type": "word",
      "start": 1.7,
      "end": 2.1,
      "speaker_id": "speaker_2"
    },
    {
      "text": "を",
      "type": "word",
      "start": 2.1,
      "end": 2.2,
      "speaker_id": "speaker_2"
    },
    {
      "text": "始めましょう",
      "type": "word",
      "start": 2.2,
      "end": 2.8,
      "speaker_id": "speaker_2"
    },
    {
      "text": "。",
      "type": "spacing",
      "start": 2.8,
      "end": 2.9,
      "speaker_id": "speaker_2"
    }
  ],
  "audio_duration_secs": 3
}
```

**SDK Code**

```python
import requests

url = "https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text"

files = { "file": "open('UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=', 'rb')" }
payload = {
    "file_format": ,
    "language": ,
    "keywords": ,
    "kana": ,
    "with_timestamps": ,
    "diarization": 
}

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

print(response.json())
```

```javascript
const url = 'https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text';
const form = new FormData();
form.append('file', 'UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=');
form.append('file_format', '');
form.append('language', '');
form.append('keywords', '');
form.append('kana', '');
form.append('with_timestamps', '');
form.append('diarization', '');

const options = {method: 'POST'};

options.body = form;

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

```go
package main

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

func main() {

	url := "https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_format\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywords\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"kana\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"with_timestamps\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"diarization\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text")

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

request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_format\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywords\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"kana\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"with_timestamps\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"diarization\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_format\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywords\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"kana\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"with_timestamps\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"diarization\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=',
        'contents' => null
    ]
  ]
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text");
var request = new RestRequest(Method.POST);
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA=\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file_format\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"keywords\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"kana\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"with_timestamps\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"diarization\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation
let parameters = [
  [
    "name": "file",
    "fileName": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQAAAAA="
  ],
  [
    "name": "file_format",
    "value": 
  ],
  [
    "name": "language",
    "value": 
  ],
  [
    "name": "keywords",
    "value": 
  ],
  [
    "name": "kana",
    "value": 
  ],
  [
    "name": "with_timestamps",
    "value": 
  ],
  [
    "name": "diarization",
    "value": 
  ]
]

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://fal.run/Kotoba-Technologies/kotoba-stt/v1/speech-to-text")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```