Speech-To-Text API Reference

This page covers all steps to integrate speech-to-text (STT) API into your system.

Good to know: A quick start guide can be good to help folks get up and running with your API in a few steps. Some people prefer diving in with the basics rather than meticulously reading every page of documentation!

Get your API keys

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can generate an API key from your user dashboard in Miragic website anytime.

Authentication

All requests must include the X-API-Key header containing your assigned API key.

How To Create Image Generation Task

POST /api/v1/speech-to-text/generate

This API starts the STT process by creating a task that generates text content from audio file.

Processing Information

  • Tasks are processed asynchronously in the background

  • Progress can be monitored using the Get Task Status API

  • The final result will be text content

Request

Parameter
Type
Required
Description

file

File

Yes

Input audio.

audio_format

String

Yes

This value can be set to mp3, or wav.

question

String

Yes

This value is text to specify output content. default value is Transcribe this audio:

Request Example

Response

Response Field

Field
Type
Description

jobId

String

A unique identifier used to track task status and retrieve results.

status

String

The initial status will be PENDING. Use the Get Task Status API to track progress.

message

String

To indicates the status of task.

success

Logic

true or false to indicate whether task is successful or not.

How To Get Task Status

GET /api/v1/speech-to-text/jobs/:jobId

This API lets you check the status of a STT task and retrieve the final result. Because the STT process runs asynchronously, you’ll need to poll this endpoint until the task is finished.

Task Status:

Status
Description
Progress
Next Action

PENDING

Task is currently being processed.

0~99%

Continue polling

COMPLETED

Task has finished successfully.

100%

Download result using download_signed_url

FAILED

Task processing failed.

N/A

Check error details and retry if needed

Progress Tracking:

  • The progress field indicates the percentage of task completion (0-100)

  • Progress updates are available in real-time during the PENDING state

  • Progress increases as the AI processes different stages of the try-on task

Polling Guidelines:

  • Start polling immediately after creating the task

  • Implement exponential backoff to avoid rate limiting

  • The download_signed_url is temporary and should be used promptly

  • Consider implementing a timeout after extended polling

Request:

URL Parameters

Parameter
Type
Required
Description

JobId

String

Yes

This value indicates task ID assigned by requesting STT process API

Request Example

Response Example

Completed Status (200):

Response Fields

Field
Type
Description

id

String

Unique identifier of the task

status

String

Current status of the task (PENDING/COMPLETED/FAILED)

transcription

String

text content from audio file.

createdAt

Number

Unix timestamp when processing is created

userId

String

Unique identifier of the user

Full Code Example

The following code lines are quick example to use our API in multiple languages.

Last updated