Discussions

Ask a Question
Back to All

API Integration Issue - 403 Forbidden Error When Creating Agent

Dear D-ID Support Team,

I hope this email finds you well. I'm reaching out because we're encountering an issue while attempting to integrate with the D-ID API to create an agent. We've made several attempts to resolve this on our end but have been unsuccessful, and we would greatly appreciate your assistance.

Issue Description:
We are receiving a 403 Forbidden error when trying to create a D-ID agent using the API. The error message suggests there's an issue with the API key format in the Authorization header.

Error Message:
"'bWVpYWllbmFibGVAZ21haWwuY29t:L5BXXJ1SaNRuBo-jbj_' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer bWVpYWllbmFibGVAZ21haWwuY29t:L5BXXJ1SaNRuBo-jbj_'."

Steps to Reproduce:

  1. We're using Python with the requests library to make API calls.
  2. We've tried both Bearer token and Basic authentication methods.
  3. The API endpoint we're trying to access is: https://api.d-id.com/v1/agents

Here's a sanitized version of our code:

import requests

D_ID_API_KEY = "your_api_key_here"
D_ID_BASE_URL = "https://api.d-id.com"

def create_did_agent(data):
    headers = {
        "Authorization": f"Bearer {D_ID_API_KEY}",
        "Content-Type": "application/json"
    }
    payload = {
        "name": data[0],
        "image_url": data[1],
        "voice_id": data[3],
        "language": data[2]
    }
    response = requests.post(f"{D_ID_BASE_URL}/v1/agents", headers=headers, json=payload)
    return response.json()

 

Certainly, Bing! I'd be happy to draft an email message for you to send to the D-ID support team. Here's a professional and detailed email that should help them understand and address our issue:
CopySubject: API Integration Issue - 403 Forbidden Error When Creating Agent

Dear D-ID Support Team,

I hope this email finds you well. I'm reaching out because we're encountering an issue while attempting to integrate with the D-ID API to create an agent. We've made several attempts to resolve this on our end but have been unsuccessful, and we would greatly appreciate your assistance.

Issue Description:
We are receiving a 403 Forbidden error when trying to create a D-ID agent using the API. The error message suggests there's an issue with the API key format in the Authorization header.

Error Message:
"'bWVpYWllbmFibGVAZ21haWwuY29t:L5BXXJ1SaNRuBo-jbj_' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer bWVpYWllbmFibGVAZ21haWwuY29t:L5BXXJ1SaNRuBo-jbj_'."

Steps to Reproduce:

  1. We're using Python with the requests library to make API calls.
  2. We've tried both Bearer token and Basic authentication methods.
  3. The API endpoint we're trying to access is: https://api.d-id.com/v1/agents

Here's a sanitized version of our code:

import requests

D_ID_API_KEY = "your_api_key_here"
D_ID_BASE_URL = "https://api.d-id.com"

def create_did_agent(data):
    headers = {
        "Authorization": f"Bearer {D_ID_API_KEY}",
        "Content-Type": "application/json"
    }
    payload = {
        "name": data[0],
        "image_url": data[1],
        "voice_id": data[3],
        "language": data[2]
    }
    response = requests.post(f"{D_ID_BASE_URL}/v1/agents", headers=headers, json=payload)
    return response.json()
  
  


Troubleshooting Steps Taken:

Verified the API key in our .env file matches the one provided by D-ID.
Attempted both Bearer token and Basic authentication methods.
Double-checked the API documentation for any specific requirements.

Questions:

Is there a specific format required for the API key in the Authorization header?
Are there any known issues with the /v1/agents endpoint?
Can you provide an example of a correct API call to create an agent?

Additional Information:

Python version: 3.9.5
Operating System: macOS Big Sur

We would greatly appreciate any guidance on correctly authenticating with the D-ID API and successfully creating an agent. If there are any best practices or common pitfalls we should be aware of, please let us know.
Thank you for your time and assistance. We're looking forward to resolving this issue and moving forward with our integration.
Best regards,

B.Mei