AnyCrawl

Search

SERP, search engine results page

SERP

Search the web using specified search engine

POST
/v1/search

Authorization

AuthorizationRequiredBearer <token>

JWT token for API authentication

In: header

Request Body

application/jsonRequired
enginestring

The search engine to be used

Value in: "google"
queryRequiredstring

The search query string

limitnumber

Maximum number of results per page. If scrape_options is provided, this also acts as a global cap on the number of result URLs to scrape across all pages.

Default: 10Minimum: 1Maximum: 100
offsetnumber

Number of results to skip

Default: 0Minimum: 0
pagesnumber

Number of pages to search

Default: 1Minimum: 1Maximum: 20
langunknown

Language locale for search results

countryunknown

Country locale for search results

scrape_optionsRequiredobject

Optional scraping options. If provided, the service scrapes result URLs (capped by limit across all pages) and merges outputs (e.g., html, markdown, metadata) into each item.

safe_searchnumber | null | null

Safe search filter level for Google. 0: off, 1: medium, 2: high, null: default

Minimum: 0Maximum: 2Value in: 0 | 1 | 2

Response Body

Successful search response format containing an array of search results and suggestions (may be empty)

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean

Indicates the search request was successful

Value in: true
dataRequiredarray<Any properties in object,object>

Array of search results and suggestions - can be empty if no results found. When scrape_options is used, additional enriched fields (e.g., html, markdown, metadata, status, jobId) may be present on each result.

Standard error response format for validation errors

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean

Indicates the request failed

Value in: false
errorRequiredstring

Error message

detailsRequiredobject

Validation error details

Unauthorized response format for authentication errors

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean

Indicates the request failed due to authentication issues

Value in: false
errorRequiredstring

Authentication error message

Payment required response format with credit information

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean

Indicates the request failed due to insufficient credits

Value in: false
errorRequiredstring

Error message

current_creditsRequirednumber

Current credit balance of the user

Internal server error response format

TypeScript Definitions

Use the response body type in TypeScript.

successRequiredboolean

Indicates the request failed due to server error

Value in: false
errorRequiredstring

Server error message

messageRequiredstring

Detailed error message describing what went wrong

curl -X POST "https://api.anycrawl.dev/v1/search" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "engine": "google",
    "query": "OpenAI ChatGPT",
    "limit": 10,
    "offset": 0,
    "pages": 1
  }'
const body = JSON.stringify({
  "engine": "google",
  "query": "OpenAI ChatGPT",
  "limit": 10,
  "offset": 0,
  "pages": 1
})

fetch("https://api.anycrawl.dev/v1/search", {
  headers: {
    "Authorization": "Bearer <token>"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.anycrawl.dev/v1/search"
  body := strings.NewReader(`{
    "engine": "google",
    "query": "OpenAI ChatGPT",
    "limit": 10,
    "offset": 0,
    "pages": 1
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Authorization", "Bearer <token>")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.anycrawl.dev/v1/search"
body = {
  "engine": "google",
  "query": "OpenAI ChatGPT",
  "limit": 10,
  "offset": 0,
  "pages": 1
}
response = requests.request("POST", url, json = body, headers = {
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
})

print(response.text)
{
  "success": true,
  "data": [
    {
      "title": "The Investment Case for Digital Infrastructure",
      "url": "https://www.patrizia.ag/fileadmin/user_upload/The_Investment_Case_for_Digital_Infrastructure.pdf",
      "description": "It took just five days for ChatGPT to reach one million users and just two months to reach 100 million users, the fastest of any social media platform or app in ...48 pages",
      "source": "Google Search Result"
    }
  ]
}
{
  "success": false,
  "error": "Validation error",
  "details": {
    "issues": [
      {
        "field": "engine",
        "message": "Invalid enum value. Expected 'playwright' | 'cheerio' | 'puppeteer', received 'cheeri1o'",
        "code": "invalid_enum_value"
      }
    ],
    "messages": [
      "Invalid enum value. Expected 'playwright' | 'cheerio' | 'puppeteer', received 'cheeri1o'"
    ]
  }
}
{
  "success": false,
  "error": "Invalid API key"
}
{
  "success": false,
  "error": "Insufficient credits",
  "current_credits": -2
}
{
  "success": false,
  "error": "Internal server error",
  "message": "Job 0ae56ed9-d9a9-4998-aea9-2ff5b51b2e4e timed out after 30000 seconds"
}