HELP CENTER

How to set multiple tasks in one API request?

Using DataForSEO APIs, you can set up to 100 tasks in one API request. This will enable you to save time, as well as send more tasks in a minute.

As you may know, our API has a limit of 2000 API calls per minute. Consequently, if you set one task per call, you will be able to send only 2000 tasks, while setting 100 tasks per request will allow you to send 200,000 tasks per minute.

Note that you can set multiple tasks in one API call only with endpoints that use the standard method of data retrieval.

However, some of our clients don’t know how to set multiple tasks in one API call and how the API response will look like if they do so. This article will clear things up.

Setting multiple tasks

Suppose you need to receive SERP data for three keywords: phone, purchase phone, purchase smartphone. You can easily do that using the Task POST endpoint of SERP API.

POST https://api.dataforseo.com/v3/serp/google/organic/task_post

However, instead of sending three separate requests for each keyword, you can specify three Task POST parameters separated by commas in one request.

Your POST request will be structured as in the following example.

[
    {
        "language_code": "en",
        "location_code": 2840,
        "keyword": "phone"
    },
        {
        "language_code": "en",
        "location_code": 2840,
        "keyword": "purchase phone"
    },
        {
        "language_code": "en",
        "location_code": 2840,
        "keyword": "purchase smartphone"
    }

]

In the API response, you will get the IDs of the specified tasks.

{
    "version": "0.1.20210917",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "0.0952 sec.",
    "cost": 0.00225,
    "tasks_count": 3,
    "tasks_error": 0,
    "tasks": [
        {
            "id": "11161308-2806-0066-0000-051d31815301",
            "status_code": 20100,
            "status_message": "Task Created.",
            "time": "0.0179 sec.",
            "cost": 0.00075,
            "result_count": 0,
            "path": [
                "v3",
                "serp",
                "google",
                "organic",
                "task_post"
            ],
            "data": {
                "api": "serp",
                "function": "task_post",
                "se": "google",
                "se_type": "organic",
                "language_code": "en",
                "location_code": 2840,
                "keyword": "phone",
                "device": "desktop",
                "os": "windows"
            },
            "result": null
        },
        {
            "id": "11161308-2806-0066-0000-30c693de07ad",
            "status_code": 20100,
            "status_message": "Task Created.",
            "time": "0.0043 sec.",
            "cost": 0.00075,
            "result_count": 0,
            "path": [
                "v3",
                "serp",
                "google",
                "organic",
                "task_post"
            ],
            "data": {
                "api": "serp",
                "function": "task_post",
                "se": "google",
                "se_type": "organic",
                "language_code": "en",
                "location_code": 2840,
                "keyword": "purchase phone",
                "device": "desktop",
                "os": "windows"
            },
            "result": null
        },
        {
            "id": "11161308-2806-0066-0000-1fe6590d826c",
            "status_code": 20100,
            "status_message": "Task Created.",
            "time": "0.0050 sec.",
            "cost": 0.00075,
            "result_count": 0,
            "path": [
                "v3",
                "serp",
                "google",
                "organic",
                "task_post"
            ],
            "data": {
                "api": "serp",
                "function": "task_post",
                "se": "google",
                "se_type": "organic",
                "language_code": "en",
                "location_code": 2840,
                "keyword": "purchase smartphone",
                "device": "desktop",
                "os": "windows"
            },
            "result": null
        }
    ]
}

You can then use the Task GET endpoint of SERP API to collect the results.

GET https://api.dataforseo.com/v3/serp/google/organic/task_get/advanced/$id

Embed DataForSeo widget on your website


Embed code:
Preview: