Google検索API
Google検索APIを使用すると、ウェブ検索を実行し、構造化された結果を受け取ることができます。複数の検索タイプ、ジオターゲティング、デバイスエミュレーション、2つの結果深度モードをサポートしています。
エンドポイント
Bash
POST https://api.scavio.dev/api/v1/googleヘッダー
| ヘッダー | 値 | 必須 |
|---|---|---|
Authorization | Bearer YOUR_API_KEY | はい |
Content-Type | application/json | はい |
リクエスト本文
| パラメータ | 型 | デフォルト | 説明 |
|---|---|---|---|
query | string | -- | 必須。 検索クエリ(1〜500文字)。 |
search_type | string | classic | 次のいずれか: classic, news, maps, images, lens |
country_code | string | -- | ISO 3166-1 alpha-2国コード(例:us, gb, de)。 完全なリストを見る。 |
language | string | -- | ISO 639-1言語コード(例:en, fr, es) |
page | number | 1 | 結果ページ番号(1から始まる) |
device | string | desktop | desktopまたはmobile。ニュース検索はdesktopのみをサポートしています。 |
nfpr | boolean | false | クエリの自動修正を無効にするにはtrueに設定します |
light_request | boolean | 省略(ライト) | ライトモード(1クレジット)の場合は省略します。完全な結果(2クレジット)を得るにはfalseに設定します。ナレッジグラフ、関連検索などが含まれます。 |
クレジットコスト
| シナリオ | クレジット |
|---|---|
light_requestを省略または送信しない | 1 |
"light_request": false | 2 |
最小限の例
curl -X POST 'https://api.scavio.dev/api/v1/google' \
-H 'Authorization: Bearer sk_live_your_key' \
-H 'Content-Type: application/json' \
-d '{"query": "Scavio search API"}'完全な例(すべてのパラメータ付き)
curl -X POST 'https://api.scavio.dev/api/v1/google' \
-H 'Authorization: Bearer sk_live_your_key' \
-H 'Content-Type: application/json' \
-d '{
"query": "AI startups funding",
"search_type": "news",
"country_code": "us",
"language": "en",
"page": 1,
"device": "desktop",
"nfpr": false,
"light_request": false
}'制約事項
search_typeがnewsの場合、deviceはdesktopのみ許可されます。mobileを送信すると400エラーが返ります。- 無効な
search_typeの値(例:shopping、ai_mode)は400バリデーションエラーを返します。 deviceはdesktopまたはmobileのみを受け付けます。tabletはサポートされていません。
レスポンス形式
すべての成功したレスポンスはJSONオブジェクトを返します。一部のフィールドは常に存在しますが、その他は空でない場合にのみ表示されます(通常はフルモード)。
コアフィールド(常に存在)
| フィールド | 型 | 説明 |
|---|---|---|
results | array | オーガニック検索結果オブジェクトの配列 |
results[].title | string | 検索結果ページのタイトル |
results[].url | string | 結果の完全なURL |
results[].content | string | ページからのスニペットまたはメタ説明 |
results[].position | number | 結果内の1から始まる位置 |
query | string | 実行されたクエリ |
page | number | 返されたページ番号 |
country_code | string | 検索に使用された国コード |
language | string | 検索に使用された言語コード |
response_time | number | サーバー側の応答時間(ミリ秒) |
credits_used | number | 消費されたクレジット数(1または2) |
credits_remaining | number | 現在の請求期間に残っているクレジット |
オプションフィールド(空でない場合に存在)
これらは通常フルモード("light_request": false)で返されますが、データが利用可能な場合はライトモードでも表示されることがあります。
| フィールド | 型 | 説明 |
|---|---|---|
top_stories | array | トップストーリーカルーセルのアイテム |
news_results | array | ニュース記事。title, link, source, snippet, date, relative_date, domain, positionを含む |
knowledge_graph | object | ナレッジパネル。title, subtitle, factoids配列を含む |
questions | array | 「他の人はこちらも質問」。questionと answerを含む |
related_searches | array | 関連クエリ。各々がquery, link, type, positionを含む |
total_results | number | クエリの推定総結果数 |
search_url | string | このクエリの元の検索エンジンURL |
ライトモードレスポンス例
JSON
{
"results": [
{
"title": "Scavio - Search API for Developers",
"url": "https://scavio.dev",
"content": "One API to search every platform. Structured JSON results.",
"position": 1,
"displayed_url": "https://scavio.dev",
"domain": "scavio.dev",
"date": null,
"rich_snippet": {},
"sitelinks": []
}
],
"query": "Scavio search API",
"page": 1,
"country_code": "us",
"language": "en",
"response_time": 450,
"credits_used": 1,
"credits_remaining": 999
}フルモードレスポンス例
JSON
{
"results": [
{
"title": "Scavio - Search API for Developers",
"url": "https://scavio.dev",
"content": "One API to search every platform. Structured JSON results.",
"position": 1,
"displayed_url": "https://scavio.dev",
"domain": "scavio.dev",
"date": null,
"rich_snippet": {},
"sitelinks": []
}
],
"query": "Scavio search API",
"page": 1,
"country_code": "us",
"language": "en",
"response_time": 620,
"total_results": 1250000,
"search_url": "https://www.google.com/search?q=...",
"knowledge_graph": {
"title": "Scavio",
"subtitle": "Search API Platform",
"factoids": [
{ "title": "Type", "content": "Developer API" }
]
},
"related_searches": [
{ "query": "scavio api pricing", "link": null, "type": null, "position": 0 },
{ "query": "scavio search api docs", "link": null, "type": null, "position": 1 }
],
"questions": [
{
"question": "What is Scavio?",
"answer": "Scavio is a multi-platform search API..."
}
],
"credits_used": 2,
"credits_remaining": 998
}ニュース結果例
search_typeがnewsの場合、news_resultsフィールドが設定されます:
JSON
{
"news_results": [
{
"title": "AI Startups Raise Record Funding in Q1 2026",
"link": "https://example.com/ai-funding",
"source": "TechCrunch",
"snippet": "AI companies raised over $15B in Q1 2026...",
"date": "2026-03-31T20:00:00.000Z",
"relative_date": "2 hours ago",
"domain": "techcrunch.com",
"position": 1
}
]
}注意事項
results配列は関連性順に並んでいます(位置1が最も関連性が高い)- オプションフィールドは空でない場合のみ存在します。アクセスする前に常に存在を確認してください
- ライトモード(1クレジット)はコア結果を返します。フルモード(2クレジット)はすべてのオプションフィールドを含む場合があります。
関連リンク
- YouTube API -- 検索とメタデータ
- Amazon API -- 商品検索と詳細
- 国コード -- サポートされている国コード
- エラー -- エラーコードと処理