API Intermediate

The D-ID Talks API lets you programmatically create talking head videos from source images and text or audio. This lesson covers authentication, the talk creation workflow, status polling, and building robust integrations.

Authentication

D-ID uses API key authentication via Basic Auth. Your API key serves as the username with an empty password, Base64-encoded in the Authorization header.

Python
import requests

API_KEY = "your_api_key"
BASE_URL = "https://api.d-id.com"
headers = {
    "Authorization": f"Basic {API_KEY}",
    "Content-Type": "application/json"
}

# Create a talk
payload = {
    "source_url": "https://example.com/face.jpg",
    "script": {
        "type": "text",
        "input": "Hello from the D-ID API!",
        "provider": {"type": "microsoft", "voice_id": "en-US-JennyNeural"}
    }
}
resp = requests.post(f"{BASE_URL}/talks", json=payload, headers=headers)
talk_id = resp.json()["id"]

Talk Creation Workflow

  1. POST /talks

    Create a new talk with source image URL and script. Returns a talk ID.

  2. GET /talks/{id}

    Poll for status. States: created → started → done (or error).

  3. Download result

    When status is "done", the response includes result_url with the MP4 video.

Input Options

Input TypeFieldDescription
Textscript.inputText converted to speech by TTS provider
Audio URLscript.audio_urlPre-recorded audio file URL
SSMLscript.ssmlSSML markup for pronunciation control
Webhook Alternative: Instead of polling, configure a webhook URL in the request payload. D-ID will POST a notification when the talk is ready, reducing unnecessary API calls and latency.

Ready to Go Deeper?

Live instructor-led courses from our partners. Affiliate disclosure.