> ## Documentation Index
> Fetch the complete documentation index at: https://lingopal.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Start Stream Via API

> Learn how to start a stream using the Lingopal SOD API with Python examples and environment variable setup.

## Required Environment Variables

* **`LINGOPAL_API_KEY`**: Your API key for authentication
* **`LINGOPAL_INGEST_URL`**: The SRT ingest URL (e.g., `srt://your.server:7070`)

## Example

```bash theme={null}
export LINGOPAL_API_KEY="your-api-key"
export LINGOPAL_INGEST_URL="srt://your.srt.server:7070"
python examples/start_stream.py
```

## Python Implementation

```python theme={null}
import os
import requests

# Environment variables
API_KEY = os.getenv("LINGOPAL_API_KEY")
INGEST_URL = os.getenv("LINGOPAL_INGEST_URL")
API_URL = os.getenv("LINGOPAL_API_URL", "https://streaming.lingopal.ai/v1/streams/start")

# Check required variables
if not API_KEY:
    raise ValueError("❌ Please set the LINGOPAL_API_KEY environment variable.")
if not INGEST_URL:
    raise ValueError("❌ Please set the LINGOPAL_INGEST_URL environment variable.")

# Payload
payload = {
    "ingest_url": INGEST_URL,
    "vocals_track": "0",
    "background_track": 1,
    "mix": "-9,-6",
    "enable_captions_708": True,
    "enable_captions_608": False,
    "src_language": "en",
    "dst_language": ["es"],
    "use_paraphrasing_transcription": True,
    "start_wowza": True,
    "is_hls_stream": False,
    "use_contextual_translation": False,
    "lipsync": False
}

# Headers
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "X-API-Key": API_KEY
}

# Make the API request
response = requests.post(API_URL, json=payload, headers=headers)
print(response.json())
```

## What This Does

This example demonstrates how to:

1. **Set up environment variables** for your API key and ingest URL
2. **Create a payload** with all the necessary stream parameters
3. **Make an authenticated API request** to start your stream
4. **Handle the response** from the API

## Parameters Explained

* **`ingest_url`**: Your SRT stream source URL
* **`src_language`**: Source language (e.g., "en" for English)
* **`dst_language`**: Target language(s) for translation (e.g., \["es"] for Spanish)
* **`enable_captions_708/608`**: Enable CEA-708 or CEA-608 captions
* **`vocals_track`**: Audio track for vocals (default: "0")
* **`background_track`**: Audio track for background audio (default: 1)
* **`mix`**: Audio mix settings (default: "-9,-6")
* **`lipsync`**: Enable lip synchronization
* **`use_contextual_translation`**: Enable contextual translation
* **`start_wowza`**: Start Wowza streaming server
* **`is_hls_stream`**: Set to true for HLS streams

## Next Steps

After starting your stream, you can:

* Monitor stream status using the stream ID returned
* Retrieve transcripts and captions
* Stop the stream when finished
* View analytics and usage data

For more information about the WebSocket protocol and message formats, see the [Introduction](/api-reference/endpoint/introduction) documentation.

## Getting Help

* Visit our [GitHub repository](https://github.com/lingopal-ai/lingopal-reference) for the latest code and issues
