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

# Get a realtime session

GET https://api.beatapi.io/v1/realtime/sessions/{session_id}

Reference: https://docs.beatapi.io/api-reference/core/realtime-video/get-realtime-session

## Authentication

- `Authorization` header (bearer token, required) — Send your API key as `Authorization: Bearer <BEATAPI_API_KEY>`.

## Request

### Path parameters

- `session_id` (string, required)

## Response

### 200

Realtime session

- `data` (RealtimeSession, required)

## Errors

### 401 Unauthorized Error

No API key (`missing_api_key`), or a key that is wrong, expired, disabled or exhausted (`invalid_api_key`; the message says which). Send it as `Authorization: Bearer <key>`; the key works with or without the `sk-` prefix. Not retryable.

- `error` (ErrorError, required) — Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

### 404 Not Found Error

Realtime session not found

- `error` (ErrorError, required) — Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

## Types

### RealtimeSession

- `id` (string, required) — Stable Realtime Session ID used to inspect or close the session.
- `object` (enum, required) — Object discriminator; always `realtime.session`.
  - Allowed values: `realtime.session`
- `status` (enum, required) — Active means BeatAPI accepted the first billing heartbeat after remote output began.
  - Allowed values: `ready`, `connecting`, `active`, `closed`, `failed`, `expired`
- `expires_at` (datetime, required) — Time when the unconnected short-lived session credential expires.
- `max_duration_seconds` (enum, required) — Maximum selected live duration and billing tier in seconds.
  - Allowed values: `15`, `60`, `300`
- `allowed_origins` (list of string, required) — Exact browser origins authorized to use this Session.
- `credits` (RealtimeSessionCredits, required) — USD reservation, settlement, and refund lifecycle for this Realtime Session. Compatibility field names are retained.
- `request_id` (string, required) — Correlation ID to retain for logs and BeatAPI support.
- `created_at` (datetime, required) — Time when the Session was created.
- `connected_at` (datetime, required, nullable) — Time of the first accepted BeatAPI billing heartbeat; null before billing activation.
- `closed_at` (datetime, required, nullable) — Time when the Session closed, or null while it remains open.

### ErrorError

Structured BeatAPI error. Use `code` (or `retryable`) for program logic and retain `request_id` for support.

- `code` (enum, required) — Stable machine-readable error code. `unauthorized` is the deprecated name for a 401; since 2026-09-29 a 401 is `missing_api_key` or `invalid_api_key`. Treat a legacy `unauthorized` like `invalid_api_key`.
  - Allowed values: `bad_request`, `missing_api_key`, `invalid_api_key`, `unauthorized`, `forbidden`, `not_found`, `insufficient_credits`, `idempotency_conflict`, `user_concurrency_exceeded`, `rate_limit_exceeded`, `content_policy_violation`, `processing_unavailable`, `processing_failed`, `processing_timeout`, `result_transfer_failed`, `invalid_signature`, `realtime_disabled`, `realtime_capacity_unavailable`, `realtime_session_expired`, `origin_not_allowed`, `invalid_client_secret`, `transport_not_allowed`, `internal_error`
- `message` (string, required) — English sentence that states the cause; for `bad_request` it names the field. Written for people and logs, not for parsing.
- `retryable` (boolean, required) — Whether making the same call again could succeed. Present on every error; branch on it instead of the status code. True for 429, 500 and 503 (rate_limit_exceeded, user_concurrency_exceeded, internal_error, processing_unavailable, processing_timeout, processing_failed, result_transfer_failed, realtime_capacity_unavailable). False for a request, key or balance that must change first (bad_request, content_policy_violation, missing_api_key, invalid_api_key, insufficient_credits, forbidden, not_found, idempotency_conflict, realtime_disabled and the other realtime credential codes).
- `request_id` (string, required) — Correlation ID to retain for BeatAPI support.
- `retry_after_seconds` (integer, optional) — Seconds to wait before retrying. Present on every 429, and on a 503 when the wait is known; the same value is sent in the `Retry-After` header.
- `docs` (string, optional) — The public Skill page that says what to do about an error. Present on errors answered by the capability endpoints (`/v1/capabilities/search`, `/v1/capabilities/inspect`, `/v1/capabilities/run`); absent on every other endpoint.

### RealtimeSessionCredits

USD reservation, settlement, and refund lifecycle for this Realtime Session. Compatibility field names are retained.

- `reserved` (double, required) — USD amount reserved when the Session is created.
- `settled` (double, required) — USD amount settled after the first accepted billing heartbeat.
- `refunded` (double, required) — USD amount refunded if the Session ends without billing activation.

## Examples

**Response**

```json
{
  "data": {
    "id": "string",
    "object": "realtime.session",
    "status": "ready",
    "expires_at": "2024-01-15T09:30:00Z",
    "max_duration_seconds": 15,
    "allowed_origins": [
      "https://app.example.com"
    ],
    "credits": {
      "reserved": 1.1,
      "settled": 1.1,
      "refunded": 1.1
    },
    "request_id": "string",
    "created_at": "2024-01-15T09:30:00Z",
    "connected_at": "2024-01-15T09:30:00Z",
    "closed_at": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.beatapi.io/v1/realtime/sessions/session_id"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.beatapi.io/v1/realtime/sessions/session_id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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.beatapi.io/v1/realtime/sessions/session_id"

	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.beatapi.io/v1/realtime/sessions/session_id")

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.beatapi.io/v1/realtime/sessions/session_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.beatapi.io/v1/realtime/sessions/session_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/realtime/sessions/session_id");
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.beatapi.io/v1/realtime/sessions/session_id")! 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()
```