API 文档提供英文版本。

Google Images

Search Google Images.

GET/api/v1/google/images

Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.

Parameters

Query and filters

ParameterTypeDescription
qrequiredstringImage search query, up to 2,048 characters.Up to 2,048 characters.
hlstringLanguage of the Google Images interface.Default: en.
glstringTwo-letter country code used to localize results.
safe"active" | "off"Set active to filter explicit images, or off to disable SafeSearch.
tbsstringGoogle image filters, such as isz:l for large images, itp:photo for photographs, or ic:trans for transparent images.Up to 4,096 characters.
license"creative_commons" | "commercial_and_other" | "free_to_share" | "free_to_share_commercially" | "free_to_modify" | "free_to_modify_commercially"Limit results to images Google lists under these usage rights. Use creative_commons for Creative Commons licenses, or commercial_and_other for commercial and other licenses such as stock photos.free_to_share: free to use or share. free_to_share_commercially: free to use or share, even commercially. free_to_modify: free to use, share or modify. free_to_modify_commercially: free to use, share or modify, even commercially.Combine license with other tbs filters, such as isz:l, but do not also send a sur: usage-rights filter in tbs.
device"desktop" | "tablet" | "mobile"Device profile used for the image search.Default: desktop.

Results and pagination

ParameterTypeDescription
startintegerGoogle's page offset. For the next page, use pagination.next_start from the response and keep the same query and filters. This offset is independent of num and the number of returned images.Default: 0.Range: 0 to 1000.
numintegerMaximum number of images returned from this page, from 1 to 100. This limits the parsed response; Google may supply fewer images.Default: 100.Range: 1 to 100.

Response

A JSON object with search_metadata (request id, credits used and remaining) and the result groups the page returns. Groups and fields depend on the content of each page, so treat every field as optional.

Examples

cURL
curl "https://serpfast.com/api/v1/google/images?q=red+panda&num=20&hl=en&gl=us&license=creative_commons" \
  -H "Authorization: Bearer $SERPFAST_KEY"
Node.js 18+
const params = new URLSearchParams({
  "q": "red panda",
  "num": 20,
  "hl": "en",
  "gl": "us",
  "license": "creative_commons"
});
const res = await fetch(`https://serpfast.com/api/v1/google/images?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);
Python
import os, requests

params = {
  "q": "red panda",
  "num": 20,
  "hl": "en",
  "gl": "us",
  "license": "creative_commons"
}
res = requests.get(
    "https://serpfast.com/api/v1/google/images",
    params=params,
    headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
    timeout=120,
)
print(res.json())