Safe Browsing Lookup API(v4)
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
概要
Lookup API を使用すると、クライアント アプリケーションからセーフ ブラウジングにリクエストを送信できます。
をチェックして、その URL がセーフ ブラウジング リストに含まれているかどうかを確認します。1 つまたは複数のコンテナで URL が見つかった場合
その他のリストの場合は、一致する情報が返されます。
URL の確認
URL がセーフ ブラウジング リストに含まれているかどうかを確認するには、HTTP POST
リクエストを
threatMatches.find
メソッド:
- HTTP
POST
リクエストには、最大 500 個の URL を含めることができます。有効な URL を入力してください
(RFC 2396 を参照)。
正規化またはエンコードする必要はありません。
- HTTP
POST
レスポンスは、一致する URL とキャッシュの期間を返します。
例: threatMatches.find
HTTP POST リクエスト
次の例では、2 つのセーフ ブラウジング リストと 3 つの URL がサーバーに送信され、
一致の有無を判断します。
リクエスト ヘッダーには、リクエスト URL とコンテンツ タイプが含まれます。以下を置き換えてください。
URL の API_KEY
の API キー。
POST https://safebrowsing.googleapis.com/v4/threatMatches:find?key=API_KEY HTTP/1.1
Content-Type: application/json
リクエスト本文
リクエストの本文には、クライアント情報(ID とバージョン)と脅威情報が含まれる
(リスト名と URL)。詳しくは、
threatMatches.find リクエスト本文
コードサンプルに続く説明を確認します
{
"client": {
"clientId": "yourcompanyname",
"clientVersion": "1.5.2"
},
"threatInfo": {
"threatTypes": ["MALWARE", "SOCIAL_ENGINEERING"],
"platformTypes": ["WINDOWS"],
"threatEntryTypes": ["URL"],
"threatEntries": [
{"url": "http://www.urltocheck1.org/"},
{"url": "http://www.urltocheck2.org/"},
{"url": "http://www.urltocheck3.com/"}
]
}
}
clientID
フィールドと clientVersion
フィールドは、クライアント実装を一意に識別する必要があります。
できます。(クライアント情報は、サーバーサイドのロギングとアカウンティングに使用されます。以下を選択できます。
クライアント ID には任意の名前を付けることができますが、実際の ID を表す名前を選択することをおすすめします。
(会社名などのクライアント名を 1 語で表記してすべて小文字で表記)
セーフ ブラウジング リスト
threatType
、platformType
、threatEntryType
フィールド
これらを組み合わせてセーフ ブラウジング リストを識別(名前)します。この例では、2 つのリストが特定されています。
MALWARE/WINDOWS/URL と SOCIAL_ENGINEERING/WINDOWS/URL の 2 種類があります。リクエストを送信する前に、Terraform が
指定した組み合わせが有効なものである(セーフ ブラウジング リストをご覧ください)。
脅威 URL
この例では、threatEntries
配列に 3 つの URL(urltocheck1.org、urltocheck2.org、
urltocheck3.org など)のリストが照合され、2 つのセーフ ブラウジング リストと照合されます。
注: Lookup API と threatMatches
メソッドでは常に URL
フィールドを使用する必要があります。
hash
フィールドはありません(ThreatEntry をご覧ください)。
HTTP POST レスポンス
次の例では、レスポンスは一致を返します。URL で指定された 3 つの URL のうちの 2 つ
2 つのセーフ ブラウジング リストのいずれかで検出されます。
レスポンス ヘッダーには、HTTP ステータス コードが含まれます。
コンテンツタイプを指定します
HTTP/1.1 200 OK
Content-Type: application/json
レスポンスの本文
レスポンスの本文には一致情報(リスト名と、
メタデータ(利用可能な場合)、キャッシュ期間など)が含まれます。詳しくは、
threatMatches.find レスポンス本文
コードサンプルに続く説明を確認します
注: 一致する URL がない場合(つまり、指定された URL のいずれもない場合)は、
含まれる場合、HTTP POST
レスポンス。
レスポンスの本文で空のオブジェクトを返します。
{
"matches": [{
"threatType": "MALWARE",
"platformType": "WINDOWS",
"threatEntryType": "URL",
"threat": {"url": "http://www.urltocheck1.org/"},
"threatEntryMetadata": {
"entries": [{
"key": "malware_threat_type",
"value": "landing"
}]
},
"cacheDuration": "300.000s"
}, {
"threatType": "MALWARE",
"platformType": "WINDOWS",
"threatEntryType": "URL",
"threat": {"url": "http://www.urltocheck2.org/"},
"threatEntryMetadata": {
"entries": [{
"key": "malware_threat_type",
"value": "landing"
}]
},
"cacheDuration": "300.000s"
}]
}
一致
matches
オブジェクトは、セーフ ブラウジング リストの名前と URL(
あります。この例では、2 つの URL(urltocheck1.org と urltocheck2.org)が次のいずれかで見つかりました。
セーフ ブラウジング リスト(マルウェア/Windows/URL)と一致すると、一致する情報が返されます。3 番目の URL
(urltocheck3.org)はいずれのリストでも見つからないため、この URL の情報は返されません。
threatEntryMetadata
フィールドは省略可能であり、次の追加情報を提供します。
脅威との一致を検出できます。現在、マルウェア/Windows/URL のセーフ ブラウジング リストについてメタデータを利用できます。
(メタデータをご覧ください)。
キャッシュ期間
cacheDuration
フィールドは、その URL が安全でないと判断される期間を示します。
(キャッシュ保存を参照)。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eThe Lookup API allows client applications to send requests to Safe Browsing servers to check if URLs are on any Safe Browsing lists, returning matching information if found.\u003c/p\u003e\n"],["\u003cp\u003eTo check URLs, send an HTTP \u003ccode\u003ePOST\u003c/code\u003e request to the \u003ccode\u003ethreatMatches.find\u003c/code\u003e method, including up to 500 URLs in the request body with desired threat types and platform types.\u003c/p\u003e\n"],["\u003cp\u003eThe API response returns an empty object if no matches are found, or a \u003ccode\u003ematches\u003c/code\u003e object containing matching URLs, list names, metadata (if available), and cache durations.\u003c/p\u003e\n"],["\u003cp\u003eClient applications should uniquely identify themselves using \u003ccode\u003eclientId\u003c/code\u003e and \u003ccode\u003eclientVersion\u003c/code\u003e fields in the request body for server-side logging and accounting.\u003c/p\u003e\n"],["\u003cp\u003eThe API uses the \u003ccode\u003eURL\u003c/code\u003e field for threat entries and currently provides metadata for the MALWARE/WINDOWS/URL Safe Browsing list.\u003c/p\u003e\n"]]],["The Lookup API checks URLs against Safe Browsing lists via HTTP `POST` requests to the `threatMatches.find` method, which can include up to 500 URLs. Requests specify client and threat information, including threat types, platform types, and URLs. The response indicates matches, providing the list names, matching URLs, optional metadata, and cache duration. If no matches are found, the response returns an empty object. Client information must uniquely identify client implementations.\n"],null,["# Safe Browsing Lookup API (v4)\n\nOverview\n--------\n\nThe Lookup API lets your client applications send requests to the Safe Browsing\nservers to check if URLs are included on any of the Safe Browsing lists. If a URL is found on one or\nmore lists, the matching information is returned.\n\nChecking URLs\n-------------\n\nTo check if a URL is on a Safe Browsing list, send an HTTP `POST` request to the\n[threatMatches.find](/safe-browsing/reference/rest/v4/threatMatches/find)\nmethod:\n\n- The HTTP `POST` request can include up to 500 URLs. The URLs must be valid (see [RFC 2396](http://www.ietf.org/rfc/rfc2396.txt)) but they do not need to be canonicalized or encoded.\n- The HTTP `POST` response returns the matching URLs along with the cache duration.\n\nExample: threatMatches.find\n---------------------------\n\n### HTTP POST request\n\nIn the following example, two Safe Browsing lists and three URLs are sent to the server to\ndetermine if there is a match.\n\n#### Request header\n\nThe request header includes the request URL and the content type. Remember to substitute\nyour API key for `API_KEY` in the URL. \n\n```scdoc\n POST https://safebrowsing.googleapis.com/v4/threatMatches:find?key=API_KEY HTTP/1.1\n Content-Type: application/json\n \n```\n\n#### Request body\n\nThe request body includes the client information (ID and version) and the threat information\n(the list names and the URLs). For more details, see the\n[threatMatches.find request body](/safe-browsing/reference/rest/v4/threatMatches/find#request-body)\nand the explanations that follow the code example. \n\n```scdoc\n {\n \"client\": {\n \"clientId\": \"yourcompanyname\",\n \"clientVersion\": \"1.5.2\"\n },\n \"threatInfo\": {\n \"threatTypes\": [\"MALWARE\", \"SOCIAL_ENGINEERING\"],\n \"platformTypes\": [\"WINDOWS\"],\n \"threatEntryTypes\": [\"URL\"],\n \"threatEntries\": [\n {\"url\": \"http://www.urltocheck1.org/\"},\n {\"url\": \"http://www.urltocheck2.org/\"},\n {\"url\": \"http://www.urltocheck3.com/\"}\n ]\n }\n }\n```\n\n###### Client information\n\nThe `clientID` and `clientVersion` fields should uniquely identify a client implementation, not an\nindividual user. (Client information is used for server-side logging and accounting. You can choose\nany name for the client ID, but we suggest you choose a name that represents the true identity of the\nclient, such as your company name, presented as all one word, in all-lowercase letters.)\n\n###### Safe Browsing lists\n\nThe `threatType`, `platformType`, and `threatEntryType` fields\nare combined to identify (name) Safe Browsing lists. In the example, two lists are identified:\nMALWARE/WINDOWS/URL and SOCIAL_ENGINEERING/WINDOWS/URL. Before sending a request, make sure the type\ncombinations you specify are valid (see [Safe Browsing Lists](/safe-browsing/v4/lists)).\n\n###### Threat URLs\n\nIn the example, the `threatEntries` array contains three URLs (urltocheck1.org, urltocheck2.org,\nand urltocheck3.org) that will be checked against the two Safe Browsing lists.\n\n**Note:** The Lookup API and the `threatMatches` method should always use the `URL` field,\nnever the `hash` field (see [ThreatEntry](/safe-browsing/reference/rest/v4/ThreatEntry)).\n\n### HTTP POST response\n\nIn the following example, the response returns a match; two of the three URLs specified in the\nrequest are found on one of the two Safe Browsing lists specified in the request.\n\n#### Response header\n\nThe response header includes the [HTTP status code](/safe-browsing/v4/status-codes)\nand the content type. \n\n```http\nHTTP/1.1 200 OK\nContent-Type: application/json\n```\n\n#### Response body\n\nThe response body includes the match information (the list names and the URLs found on\nthose lists, the metadata, if available, and the cache durations). For more details, see the\n[threatMatches.find response body](/safe-browsing/reference/rest/v4/threatMatches/find#response-body)\nand the explanations that follow the code example.\n\n**Note:** If there are no matches (that is, if *none* of the URLs specified\nin the request are found on *any* of the lists specified in a request), the HTTP `POST` response\nsimply returns an empty object in the response body. \n\n```carbon\n{\n \"matches\": [{\n \"threatType\": \"MALWARE\",\n \"platformType\": \"WINDOWS\",\n \"threatEntryType\": \"URL\",\n \"threat\": {\"url\": \"http://www.urltocheck1.org/\"},\n \"threatEntryMetadata\": {\n \"entries\": [{\n \"key\": \"malware_threat_type\",\n \"value\": \"landing\"\n }]\n },\n \"cacheDuration\": \"300.000s\"\n }, {\n \"threatType\": \"MALWARE\",\n \"platformType\": \"WINDOWS\",\n \"threatEntryType\": \"URL\",\n \"threat\": {\"url\": \"http://www.urltocheck2.org/\"},\n \"threatEntryMetadata\": {\n \"entries\": [{\n \"key\": \"malware_threat_type\",\n \"value\": \"landing\"\n }]\n },\n \"cacheDuration\": \"300.000s\"\n }]\n}\n```\n\n###### Matches\n\nThe `matches` object lists the names of the Safe Browsing lists and the URLs---if\nthere is match. In the example, two URLs (urltocheck1.org and urltocheck2.org) were found on one of\nthe Safe Browsing lists (MALWARE/WINDOWS/URL) so the matching information is returned. The third URL\n(urltocheck3.org) was not found on either list, so no information is returned for this URL.\n\n###### Metadata\n\nThe `threatEntryMetadata` field is optional and provides additional information about\nthe threat match. Currently, metadata is available for the MALWARE/WINDOWS/URL Safe Browsing list\n(see [Metadata](/safe-browsing/v4/metadata)).\n\n###### Cache durations\n\nThe `cacheDuration` field indicates the amount of time the URL must be considered unsafe\n(see [Caching](/safe-browsing/v4/caching))."]]