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

# Stream Call Transcript

GET https://api.agentphone.ai/v1/calls/{call_id}/transcript/stream

Stream transcript events over Server-Sent Events (Content-Type: text/event-stream), not a single JSON response. Events are connected, turn, and ended; heartbeat comments keep the connection alive. The published TypeScript SDK 1.0.25 does not parse this stream correctly. Use these HTTP examples and the [streaming guide](/docs/documentation/guides/calls#stream-transcript-sse) until a corrected SDK is released.

Reference: https://agentphone.to/docs/api-reference/calls/stream-call-transcript-v-1-calls-call-id-transcript-stream-get

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `call_id` (string, required)

## Response

### 200

Server-Sent Events. Each event has an event name (connected, turn, or ended) and JSON data; heartbeat lines are comments.

- Streaming response of `map from string to any`.

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

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

### ValidationErrorLocItems

- string
- integer

## Examples

**SDK Code**

```javascript
const API_KEY = "YOUR_API_KEY";
const callId = "call_ghi012";
const response = await fetch(
  `https://api.agentphone.ai/v1/calls/${callId}/transcript/stream`,
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);

if (!response.ok) {
  throw new Error(`Failed to stream transcript: ${response.status}`);
}

const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
let eventType = null;

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  buffer += decoder.decode(value, { stream: true });
  const lines = buffer.split("\n");
  buffer = lines.pop();

  for (const line of lines) {
    if (line.startsWith("event:")) {
      eventType = line.slice(6).trim();
    } else if (line.startsWith("data:")) {
      const data = JSON.parse(line.slice(5).trim());
      if (eventType === "connected") {
        console.log(`Connected to call ${data.callId} (${data.status})`);
      } else if (eventType === "turn") {
        console.log(`[${data.role}] ${data.content}`);
      } else if (eventType === "ended") {
        console.log(`Call ended - ${data.durationSeconds}s`);
      }
    }
  }
}
```

```python
import requests

API_KEY = "YOUR_API_KEY"
call_id = "call_ghi012"

url = f"https://api.agentphone.ai/v1/calls/{call_id}/transcript/stream"
headers = {"Authorization": f"Bearer {API_KEY}"}

with requests.get(url, headers=headers, stream=True, timeout=(10, 60)) as resp:
    resp.raise_for_status()
    event_type = None
    for line in resp.iter_lines(decode_unicode=True):
        if line.startswith("event:"):
            event_type = line[len("event:"):].strip()
        elif line.startswith("data:"):
            import json
            data = json.loads(line[len("data:"):].strip())
            if event_type == "turn":
                print(f"[{data['role']}] {data['content']}")
            elif event_type == "ended":
                print(f"Call ended — {data['durationSeconds']}s")
                break
```

```go
package main

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

func main() {

	url := "https://api.agentphone.ai/v1/calls/call_ghi012/transcript/stream"

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

	req.Header.Add("Authorization", "Bearer <token>")

	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.agentphone.ai/v1/calls/call_ghi012/transcript/stream")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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.agentphone.ai/v1/calls/call_ghi012/transcript/stream")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentphone.ai/v1/calls/call_ghi012/transcript/stream', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.agentphone.ai/v1/calls/call_ghi012/transcript/stream");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentphone.ai/v1/calls/call_ghi012/transcript/stream")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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