Authentication
The D-ID API uses Bearer token authentication. Your API key must be Base64-encoded
and passed as a Bearer token in the Authorization header.
Getting an API Key
- Sign up at studio.d-id.com
- Navigate to Settings > API Keys
- Create a new API key
Using the SDK
Pass your API key directly to the DIdClient constructor. The SDK handles
the Bearer token header automatically:
1 2 3 | |
Environment Variable Pattern
For production use, store your API key in an environment variable:
1 2 3 4 5 6 7 8 | |
Base64 Encoding
D-ID expects the API key to be Base64-encoded in the Authorization header.
If your key is not already Base64-encoded, encode it before passing it to the client:
1 2 3 4 5 6 7 | |
Basic Authentication (Alternative)
D-ID also supports HTTP Basic authentication for some endpoints. The SDK is configured with Bearer authentication by default, which is the recommended approach.