Skip to main content

Perform a search

POST 

/search

Perform a search for 1 or more terms. AlsoAsked charges the credits for the search when it creates the search.

The async field in the request body sets how the API returns the response:

  • false (default): a synchronous search. The API waits until the search is complete, for a maximum of 90 seconds, and then returns the response. If the search isn't complete after 90 seconds, it keeps running.
  • true: an asynchronous search. The API returns the response immediately.

In both cases, the API returns 200 OK with the search. The queries field is null until the search is complete: when its status field is success, no_results, or error. Then each query has the status and the results of its term. To get the search later, send GET /v1.1/search/{searchId} with the id field from the response.

For details, see Synchronous and asynchronous searches and Perform a search.

Request​

Responses​

The search that AlsoAsked created. For a synchronous search, the API returns the response when the search is complete or when the timeout ends. For an asynchronous search, the API returns the response immediately. The queries field is null until the search is complete. When the status field is success, no_results, or error, the queries field has one query for each unique term. Each query has the status and the results of its term.

Response Headers
    X-AlsoAsked-Credits

    The number of credits that remain in your account. On the live API, the value is your plan credits plus your pay-as-you-go credits. On the sandbox API, the value is your sandbox credits.

    Example: 100
    X-RateLimit-Limit

    The maximum number of requests that you can send in the window of the rate limit.

    Example: 200
    X-RateLimit-Remaining

    The number of requests that you can still send now: the lower of the remaining requests for your API key and for your IP address.

    Example: 184
    X-RateLimit-Reset

    The current time plus the length of the rate limit window, in Unix time (seconds since 1970-01-01T00:00:00+00:00). A request that you send now stops counting at this time. To know when you can send again after a 429 response, use the Retry-After header.

    Example: 1672531200