All Products
Search
Document Center

Alibaba Cloud Model Studio:Call image and video generation APIs using Postman or cURL

Last Updated:Mar 16, 2026

Image and video generation tasks can take tens of seconds to several minutes. These APIs use an asynchronous two-step pattern to prevent HTTP timeouts: create a task, then poll for the result.

Choose a tool:

  • Postman: Graphical HTTP client (best for beginners)

  • cURL: Command-line HTTP client (best for terminal users)

Postman and cURL are for quick testing only. For production, use the official SDK or build your own HTTP client.

How asynchronous generation works

All image and video generation APIs follow a two-step async pattern:

  1. Create a task -- Send a POST request with your prompt and parameters. The API returns a task_id.

  2. Poll for the result -- Send GET requests with the task_id until task_status is SUCCEEDED. The response then contains the output URL.

HTTP call flow for text-to-image

Task status reference

Status Meaning Action
RUNNING The task is in progress. Poll again in 3-5 seconds.
SUCCEEDED Generation is complete. Retrieve the output URL from the response.
Important

Both task_id and the output image URL expire after 24 hours. Download the result promptly.

Send requests with Postman

Prerequisites

Before you begin:

cURL-to-Postman parameter mapping

Use the following table to convert a cURL example into a Postman request:

cURL syntax Postman location Purpose
curl -X POST or curl -X GET Request method drop-down HTTP method
https://<url> URL input field API endpoint
-H 'Key: Value' Headers tab Request headers
-d '{...}' Body tab Request body (JSON)

Step 1: Create a task

The following cURL command shows the equivalent request you will configure in Postman:

curl -X POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.5-t2i-preview",
    "input": {
        "prompt": "A flower shop with exquisite windows, a beautiful wooden door, and flowers on display"
    },
    "parameters": {
        "size": "1024*1024",
        "n": 1
    }
}'
Different regions use separate base_urls.

Configure the request in Postman:

  1. Click + to create a new HTTP request.

  2. Set method to POST and enter the endpoint URL: Set request method and URL

    • Singapore: https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis

    • Virginia: https://dashscope-us.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis

    • Beijing: https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis

  3. In the Headers tab, add:

    Key Value Purpose
    X-DashScope-Async enable Enable asynchronous mode
    Authorization Bearer <your-api-key> Authentication. Replace <your-api-key> with your Model Studio API key.
    Content-Type application/json Specify JSON request body

    Configure request headers

  4. In the Body tab, select rawJSON, then paste:

       {
           "model": "wan2.5-t2i-preview",
           "input": {
               "prompt": "A flower shop with exquisite windows, a beautiful wooden door, and flowers on display"
           },
           "parameters": {
               "size": "1024*1024",
               "n": 1
           }
       }

    Configure request body

  5. Click Send. The response contains a task_id — save it for Step 2.

    Response with task_id

Step 2: Poll for the result

Use the task_id from Step 1 to query task status.

Equivalent cURL command:

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Configure the query request in Postman:

  1. Create a new HTTP request and set method to GET.

  2. Enter the query URL. Replace {task_id} with the value from Step 1:

    • Singapore: https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

    • Virginia: https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}

    • Beijing: https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

  3. In the Headers tab, add the Authorization key (same API key as Step 1).

  4. Click Send.

Query task status in Postman

If task_status is RUNNING, wait 3-5 seconds and click Send again. When SUCCEEDED, copy the image URL.

Successful result with image URL
Important

The image URL expires after 24 hours. Download the image before it expires.

Send requests with cURL

Prerequisites

Before you begin, make sure you have:

Check if cURL is installed

To check whether cURL is installed, run:

curl --version

Expected output:

curl 8.x.x (x86_64-apple-darwin23.0) libcurl/8.x.x ...

If you see command not found (Linux/macOS) or 'curl' is not recognized (Windows), download and install cURL.

Step 1: Create a task

Run the following command in your terminal:

curl -X POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.5-t2i-preview",
    "input": {
        "prompt": "A flower shop with exquisite windows, a beautiful wooden door, and flowers on display"
    },
    "parameters": {
        "size": "1024*1024",
        "n": 1
    }
}'
Different regions use separate base_urls.

The response returns a task_id:

cURL response with task_id

Step 2: Poll for the result

Replace {task_id} with the value from Step 1:

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
Different regions use separate base_urls.

When task_status is SUCCEEDED, the response contains the image URL:

Next steps