How to send Asynchronous requests to a SERP API zone

There are 2 methods for handling your API requests:

  • Direct (Synchronous) requests  - send a request and get the response in an average of 5 seconds
  • Asynchronous requests - send a request without waiting for the response

With Asynchronous requests, when you send a request, you get a “response ID.” We store the response for 24 hours from the time the request was sent. You can collect the responses at your convenience via a designated endpoint API command or webhook that notifies you when a request is completed and you can collect its result.

Therefore, Asynchronous mode in fact requires 2 separate requests:

  • Sending the request - This request includes the search parameters, returns a response_ID, and is charged as a direct request (i.e. you will be billed for this request).
    Note: This request syntax is different from that of synchronous requests and requires an API token for authentication
  • Collecting the response - This request includes the response_ID and is free of charge (i.e. you will not be billed for this request)
    - Asynchronous mode is recommended for high-volume requests
    - The response time in Asynchronous mode is slower due to queue considerations and retry rate
      (see our retry policy)

When Asynchronous mode is enabled on a SERP API zone's settings, and this zone is selected in the “Generated API” section on the SERP API Playground, the API adjusts accordingly. The API Guide will also adjust accordingly and provide additional examples with different code languages.

Sending an Asynchronous request - Shell example

curl -i --silent --compressed "[ACCOUNT_ID]&zone=[ZONE_NAME]" -H "Content-Type: application/json" -H "Authorization: Bearer [API_TOKEN]" -d "{\"country\":\"us\",\"query\":{\"q\":\"pizza\",\"num\":\"100\",\"hl\":\"en\",\"gl\":\"au\"}}"

`x-response-id` header will contain the ID of the request. Use it in the collection request


Collecting the Asynchronous response - Shell example

curl -v --compressed "[ACCOUNT_ID]&zone=[ZONE_NAME]&response_id=${[RESPONSE_ID]}" -H "Authorization: Bearer [API_TOKEN]"


For more information, see Configure a SERP API zone

Was this article helpful?