Echo Labs Docs
Search the docs
Find a guide, an endpoint or a section

Quickstart

Upload media, order captions, and download the result.

Before you start

Create a full-access API key and set it as the ECHO_API_KEY environment variable. Install the Python requests package.

Caption a file

Save your media as video.mp4. Reserve an upload, then send the file to its upload_url with a PUT request. Keep this URL private; anyone holding it can upload until it expires. See limits for file sizes and expiry.

python
import os, time, requests

API = "https://api.el.ai/v1"
auth = {"Authorization": f"Bearer {os.environ['ECHO_API_KEY']}"}

def request(method, url, **kwargs):
    response = requests.request(method, url, **kwargs)
    response.raise_for_status()
    return response

# 1. Upload
upload = request("POST", f"{API}/uploads", headers=auth).json()
with open("video.mp4", "rb") as f:
    request("PUT", upload["upload_url"], data=f)

# 2. Order
job = request("POST", f"{API}/jobs", headers=auth,
              json={"upload_id": upload["id"]}).json()

# 3. Wait
while job["status"] in ("queued", "processing"):
    time.sleep(60)
    job = request("GET", f"{API}/jobs/{job['id']}", headers=auth).json()
if job["status"] != "completed":
    raise RuntimeError(job["cancellation"])

# 4. Download
srt = request("GET", f"{API}/jobs/{job['id']}/captions?format=srt", headers=auth)
with open("video.srt", "wb") as f:
    f.write(srt.content)

For a public media URL, skip uploading and replace the job request body with:

json
{ "media_url": "https://example.com/video.mp4" }

Send exactly one of media_url or upload_id. See Create job for options, Job lifecycle for outcomes, and Webhooks to replace polling.