Skip to content

Do STT Pro(Speech To Text)

POST https://api.newportai.com/api/async/do_stt_pro

Do STT Pro API could be used for converting audio file into a text with better quailty.

  • Use Do STT Pro API to get taskId with POST method.
  • Use Polling API to get result.

Request Headers

  • Content-TypestringRequired
    Enum
    application/json
  • AuthorizationstringRequired
    Bearer authentication format, for example: Bearer

Request Body

  • audioUrlStringRequired
    audio file url, suport file less than 20MB and 2 hours long
  • lanList[String]Required
    speech language list, support: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR, and zh-CN

Response

  • codeinteger
    0 success, or error code.
  • messagestring
    "success", or error msg.
  • dataobject
    taskIdstring
    Use the taskId to request the Polling API to retrieve the generated outputs.

Example

Request

zsh
curl -X POST 'https://api.newportai.com/api/async/do_stt_pro' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
  "audioUrl": "https://newportai-api-market.s3.amazonaws.com/demo_stt/sttdemo.wav",
  "lan": ["en-US"]
}'

Response

json
{
  "code": 0,
  "message": "success", 
  "data": {
    "taskId": "a4d099e51496d205dfd83f49bbex832d"
  }
}

Next Step:

Use Polling API to get the result.

Request

zsh
curl -X POST 'https://api.newportai.com/api/getAsyncResult' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
  "taskId": "a4d099e51496d205dfd83f49bbex832d"
}'

Response:

json
{
  "code":0,
  "message":"success",
  "data":{
    "task":{
      "taskId":"a4d099e51496d205dfd83f49bbex832d",
      "status":3,
      "executionTime":3010,
      "expire":1735992325549,
      "taskType":"do_stt_pro"
    },
    "sttProResult": {
      "text": "Today is a beautiful day. The sun is shining, the birds are singing, and there is a gentle breeze in the air. I decided to take a walk in the park. The flowers are blooming, filling the air with their sweet fragrance. People are walking their dogs and the dogs seem very happy. I sit on a bench and watch the world go by. It's a peaceful moment and I feel very relaxed."
    }
  }
}