Skip to content

Template To Video

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

User will receive a video generated based on the uploaded image and the selected template style. For example, dancing video, hugging video, kissing video. All templates can be obtained by Get Video Template.

    1. By calling Get Video Template API to obtain all available template styles, select the template you need and obtain the template id.
    1. Call the template generated video interface with template id and user image as parameters.
    1. Use the Polling API to get results.

Request Headers

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

Request Body

  • templateIdstringRequired
    template id from [Get Video Template](https://api.newportai.com/docs/get-video-template).
  • imgUrlstringRequired
    image url that supports public access.

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/template2video' \
-H 'Authorization: Bearer {{key}}' \
-H 'Content-Type: application/json' \
-d '{
  "templateId": "6752c394d3333900087a538f",
  "imgUrl": "https://dreamface-resource-new.s3.amazonaws.com/server/aigc/file-transfer/2024-12-06/c866fe1b8c034fcb9bfa782d97bbac1f.jpg"
}'

Response:

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

Next Step:

Use Polling API to get the result.

Demo