> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 按 ID 获取转录文本

GET https://api.elevenlabs.io/v1/speech-to-text/transcripts/{transcription_id}

通过 ID 获取此前生成的转录文本。

Reference: https://elevenlabs.io/docs/api-reference/speech-to-text/get

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `transcription_id` (string, required) — 要检索的转录文本唯一 ID

## Response

### 200

转录数据

- `speech_to_text_transcripts_get_Response_200`
  - SpeechToTextChunkResponseModel: SpeechToTextChunkResponseModel
  - MultichannelSpeechToTextResponseModel: MultichannelSpeechToTextResponseModel
  - SpeechToTextChunkResponseModel: SpeechToTextChunkResponseModel
  - MultichannelSpeechToTextResponseModel: MultichannelSpeechToTextResponseModel

## Errors

### 422 Unprocessable Entity Error

验证错误。

- `detail` (list of ValidationError, optional)

## Types

### SpeechToTextChunkResponseModel

Chunk-level detail of the transcription with timing information.

- `language_code` (string, required) — 检测到的语言代码（例如英语为 'eng'）。
- `language_probability` (double, required) — 语言检测的置信度评分（0 到 1）。
- `text` (string, required) — 转录的原始文本。
- `words` (list of SpeechToTextWordResponseModel, required) — 词语及其时间信息列表。
- `channel_index` (integer, optional, nullable) — 该转录文本所属的通道索引（适用于多通道音频）。
- `additional_formats` (list of AdditionalFormatResponseModel, optional, nullable) — 请求的转录文本附加格式。
- `transcription_id` (string, optional, nullable) — 响应的转录 ID。
- `entities` (list of DetectedEntity, optional, nullable) — 检测到的实体列表，包含其文本、类型和在转录文本中的字符位置。
- `audio_duration_secs` (double, optional, nullable) — 已转录音频的时长，单位为秒。
- `edited_transcript` (SpeechToTextChunkResponseModelEditedTranscript, optional, nullable) — 可选转录编辑的结果：编辑后的文本，或无法生成时的错误信息。未请求编辑时不返回此字段。成功时，`text` 和 `edited_text` 均包含编辑后的转录文本；可将它们与顶层 `text` 对比，查看变更内容。

### MultichannelSpeechToTextResponseModel

多声道语音转文本转录的响应模型。

- `transcripts` (list of SpeechToTextChunkResponseModel, required) — 转录文本列表，每个音频通道对应一个。每份转录文本均包含相应通道的文本和词级详细信息。
- `transcription_id` (string, optional, nullable) — 响应的转录 ID。
- `audio_duration_secs` (double, optional, nullable) — 所有声道转录音频的总时长，单位为秒。

### ValidationError

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

### SpeechToTextWordResponseModel

带时间信息的单词级转录详情。

- `text` (string, required) — 已转录的词语或声音。
- `type` (enum, required) — 词语或声音的类型。“audio_event”用于笑声、脚步声等非词语声音。
  - Allowed values: `word`, `spacing`, `audio_event`
- `logprob` (double, required) — 预测此词概率的对数。Logprobs 范围为 [-infinity, 0]，值越高表示模型对预测结果的置信度越高。
- `start` (double, optional, nullable) — 单词或声音的起始时间，单位为秒。
- `end` (double, optional, nullable) — 单词或声音结束时间，单位为秒。
- `speaker_id` (string, optional, nullable) — 此词说话人的唯一标识符。
- `characters` (list of SpeechToTextCharacterResponseModel, optional, nullable) — 构成该词的字符及其时间信息。
- `channel_index` (integer, optional, nullable) — 该词所在的语音通道（适用于多通道音频）。单通道转录为 Null。

### AdditionalFormatResponseModel

- `requested_format` (string, required) — 请求的格式。
- `file_extension` (string, required) — 附加格式的文件扩展名。
- `content_type` (string, required) — 附加格式的内容类型。
- `is_base64_encoded` (boolean, required) — 内容是否采用 base64 编码。
- `content` (string, required) — 附加格式的内容。

### DetectedEntity

An entity detected within transcribed text.

- `text` (string, required) — The text that was identified as an entity.
- `entity_type` (string, required) — The type of entity detected (e.g., 'credit_card', 'email_address', 'person_name').
- `start_char` (integer, required) — Start character position in the transcript text.
- `end_char` (integer, required) — End character position in the transcript text.

### SpeechToTextChunkResponseModelEditedTranscript

可选转录编辑的结果：编辑后的文本，或无法生成时的错误信息。未请求编辑时不返回此字段。成功时，`text` 和 `edited_text` 均包含编辑后的转录文本；可将它们与顶层 `text` 对比，查看变更内容。

- `kind`: `error` (TranscriptEditError)
  - `error_type` ("edit_failed", required) — edit_failed：无法生成编辑结果。
  - `message` (string, required) — 面向用户的简短失败说明。
- `kind`: `transcript` (EditedTranscript)
  - `edited_text` (string, required) — The edited transcript text. If no edits were made it will be identical to the `text` field.
  - `text` (string, required) — The committed transcript text the edit instruction was applied to.
  - `message_type` (string, optional, default: edited_transcript)

### ValidationErrorLocItems

- string
- integer

### SpeechToTextCharacterResponseModel

- `text` (string, required) — 已转录的字符。
- `start` (double, optional, nullable) — 字符的起始时间，单位为秒。
- `end` (double, optional, nullable) — 字符结束时间，单位为秒。

## Examples

**Response**

```json
{
  "language_code": "en",
  "language_probability": 0.98,
  "text": "Hello world!",
  "words": [
    {
      "end": 0.5,
      "logprob": -0.124,
      "speaker_id": "speaker_1",
      "start": 0,
      "text": "Hello",
      "type": "word"
    },
    {
      "end": 0.5,
      "logprob": 0,
      "speaker_id": "speaker_1",
      "start": 0.5,
      "text": " ",
      "type": "spacing"
    },
    {
      "end": 1.2,
      "logprob": -0.089,
      "speaker_id": "speaker_1",
      "start": 0.5,
      "text": "world!",
      "type": "word"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id';
const options = {method: 'GET'};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id"

	req, _ := http.NewRequest("GET", url, nil)

	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://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id")

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

request = Net::HTTP::Get.new(url)

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.get("https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/speech-to-text/transcripts/transcription_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```