```py import requests from requests.structures imp...
# general-english
o
Copy code
py
import requests
from requests.structures import CaseInsensitiveDict

# URL of the API endpoint
url = "https://api.vapi.ai/file/upload"

# Prepare the header with your actual authorization token
headers = CaseInsensitiveDict()
headers["Authorization"] = "Bearer <your-token-here>"
headers["Content-Type"] = "multipart/form-data"  # This is a common mistake, as it may cause issues.

# Prepare the file you want to upload
# Open the file in binary mode
file_path = '/path/to/your/file.txt'
files = {'file': open(file_path, 'rb')}

# Making the POST request
response = requests.post(url, files=files, headers=headers)

# Print the response from the server
print(response.text)
Use the script above and let me know if it works?
4 Views