Making your first request
In the previous guide, we created an account and generated an API key. In this guide, we will transcribe a media file using the Whisper API.
Supported Upload Types
To send a file to the Whisper API, you can either directly upload the file as multipart upload or pass the URL of the file.
Multipart Upload
Say you have an audio file called audio.mp3
, we can transcribe it by sending a POST
request to the /transcribe
endpoint and passing the file as form data.
curl \ -H "X-API-Key: YOUR_API_KEY"\ https://api.whisper-api.com/transcribe
Replace YOUR_API_KEY
with the API key we generated in the previous guide.
URL
If the file is hosted on a server, you can pass the URL of the file to the /transcribe
endpoint.
curl \ -F "url=https://files.whisper-api.com/example.mp4" \ -H "X-API-Key: YOUR_API_KEY" \ https://api.whisper-api.com/transcribe
If the request is successful, the transcription will be queued and you will receive a response like this:
{ "task_id": "cea01962-21eb-4dd4-9970-3e375b47a7e1", "status": "queued", "result": null, "language": "en", "format": "text"}
The task_id
is a unique identifier for the transcription task. You can use this task_id
to check the status of the transcription task.
curl \ -H "X-API-Key: YOUR_API_KEY" \ https://api.whisper-api.com/status/cea01962-21eb-4dd4-9970-3e375b47a7e1
The most important field in the response is the result
field. If the transcription is successful, the result
field will contain the transcribed text. If the transcription is still in progress, the result
field will be null
. For our task above for example, we will receive a response like this:
{ "task_id": "cea01962-21eb-4dd4-9970-3e375b47a7e1", "status": "completed", "result": "Hello, my name is John Doe.", "format": "text"}
Conclusion
That’s it! You have successfully transcribed your first audio file using the Whisper API. If you have any questions or need help, feel free to reach out to us at support and we will be happy to help you.
In the next guide, we will learn how to tweak the transcription settings to get the best results.