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.
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
- POST /talks
Create a new talk with source image URL and script. Returns a talk ID.
- GET /talks/{id}
Poll for status. States: created → started → done (or error).
- Download result
When status is "done", the response includes result_url with the MP4 video.
Input Options
| Input Type | Field | Description |
|---|---|---|
| Text | script.input | Text converted to speech by TTS provider |
| Audio URL | script.audio_url | Pre-recorded audio file URL |
| SSML | script.ssml | SSML markup for pronunciation control |
Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX