Skip to content

Polling

POST https://api.newportai.com/api/getAsyncResult

Polling the asynchronous result by this API.

  • Use Polling API to get result with POST method.

Request Headers

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

Request Body

  • taskIDstring
    task id return by task API.

Response

  • codeint
    int Operation code, 0 indicates success, non-0 indicates failure
  • messagestring
    Operation prompt message
  • dataobject
    Request content
    • taskobject
      Task-related information
      • taskIdstring
        task id
      • statusint
        Task status code, integer value, enumeration. 1 task submission; 2 The task is in progress; 3 The task is successful. 4 Task Failure
      • reasonstring
        Provides the reason for a task's failure.
      • taskTypestring
        task type
    • imageslist
      images result
      • imageUrlstring
        image url
      • imageTypestring
        image type (jpg,png..)
    • videoslist
      videos result
      • videoUrlstring
        video url
      • videoTypestring
        video type (mp4..)
    • audioslist
      audios result
      • audioUrlstring
        audio url
      • audioTypestring
        audio type(wav..)
    • sttProResultobject
      speech-to-text pro result
      • textstring
        transcribed text content.
    • sttResultobject
      detailed speech-to-text result with timestamps and additional metadata
      • dataarray
        list of word-level transcription data
        • genderstring
          gender of the speaker (if identified)
        • bgint
          start timestamp of the speech segment (in milliseconds)
        • textstring
          transcribed text for this segment
        • edint
          end timestamp of the speech segment (in milliseconds)
      • tlint
        total length of the speech (in milliseconds)
      • typestring
        the type of speech transcription
    • cloneIdstring
      clone id, only from voice_clone. Once generated, you can always use it in Do TTS Clone.

Example

Request:

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

Response:

json
{
  "code": 0,
  "message": "success",
  "data": {
    "task": {
      "taskId": "b08337dc08d7428daa64b3d5e61b8350",
      "status": 3,
      "reason": "",
      "taskType": "inpainting"
    },
    "images": [
      {
        "imageUrl": "https://dreamface-resource-new.s3.amazonaws.com/server/aigc/main/e8fb9818-869c-4f49-93dd-adb1648d0352.jpg",
        "imageType": "jpg"
      }
    ],
    "videos": [
      {
        "videoUrl": "https://s3.amazonaws.com/pt-resource-new/algorithm/2024-09-10/11ddd0315d4bb373.mp4",
        "videoType": "mp4"
      }
    ],
    "audios": [
      {
        "audioUrl": "https://s3.amazonaws.com/pt-tts-new/oneshot_tts_result/20241115/_/4213350.wav",
        "audioType": ".wav"
      }
    ],
    "cloneId": "40dc8e22ab179680ec5480f9fb32d1ec"
  }
}