GoogleSafeBrowsingAPI

FREE
By dimashirokov
Updated 5 months ago
Machine Learning
1.9/10
Popularity Score
275ms
Latency
100%
Success Rate

GoogleSafeBrowsingAPI API Overview

Connect to the Google Safe Browsing API to identify unsafe websites and notify users. Test an API call in your browser and export the code snippet into your app.

The Google Safe Browsing API is free of charge as of 3/1/2017: https://developers.google.com/safe-browsing/v4/pricing

Contact API Provider
star-blueRate

GoogleSafeBrowsingAPI

GoogleSafeBrowsingAPI Package

The Safe Browsing APIs (v4) let your client applications check URLs against Google's constantly updated lists of unsafe web resources. Examples of unsafe web resources are social engineering sites (phishing and deceptive sites) and sites that host malware or unwanted software. Any URL found on a Safe Browsing list is considered unsafe.

  • Domain: google.com
  • Credentials: apiKey

How to get credentials:

  1. Go to Google Developers Console;
  2. Select a project, or create a new one.
  3. Press Continue to activate API key.
  4. In the sidebar on the left, select Credentials.
  5. If your project has no API key for the server, create it now - Add credentials > API key > Server key;

GoogleSafeBrowsingAPI.checkUrlsSafety

This endpoint allows to check if URLs are included on any of the Safe Browsing lists. If a URL is found on one or more lists, the matching information is returned.

Field Type Description
apiKey credentials Required: API key obtained from Google.
clientId String Required: A client ID that (hopefully) uniquely identifies the client implementation of the Safe Browsing API.
clientVersion String Required: The version of the client implementation.
threatTypes JSON Required: Json array of the threats..
platformTypes JSON Required: Json array of the platforms types..
threatEntryTypes JSON Required: Json array of the threat entries types.
threatEntries JSON Required: Json array of objects. The threats entries.

threatTypes format

["MALWARE", "SOCIAL_ENGINEERING"]

platformTypes format

["WINDOWS"]

threatEntryTypes format

["URL"]

threatEntries format

[
    {"url": "http://www.urltocheck1.org/"},
    {"url": "http://www.urltocheck2.org/"},
    {"url": "http://www.urltocheck3.com/"}
]

GoogleSafeBrowsingAPI.getThreatLists

This endpoint allows to retrieve the names of the Safe Browsing lists

Field Type Description
apiKey credentials Required: API key obtained from Google.

GoogleSafeBrowsingAPI.getThreatListUpdates

This endpoint allows to update the Safe Browsing lists in the local database

Field Type Description
apiKey credentials Required: API key obtained from Google.
clientId String Required: A client ID that (hopefully) uniquely identifies the client implementation of the Safe Browsing API.
clientVersion String Required: The version of the client implementation.
threatType String Required: The type of the threat.
platformType String Required: The type of the platform.
threatEntryType String Required: The type of the threat entry.
state String Required: The current state of the client for the requested list (the encrypted client state that was received from the last successful list update).
maxUpdateEntries String Required: The maximum size in number of entries. The update will not contain more entries than this value. This should be a power of 2 between 210 and 220. If zero, no update size limit is set.
maxDatabaseEntries String Required: Sets the maximum number of entries that the client is willing to have in the local database. This should be a power of 2 between 210 and 220. If zero, no database size limit is set.
region String Required: Requests the list for a specific geographic location. If not set the server may pick that value based on the user's IP address. Expects ISO 3166-1 alpha-2 format.
supportedCompressions JSON Required: Json array. The compression types supported by the client.

supportedCompressions format

["RAW"]

GoogleSafeBrowsingAPI.checkSafetyByHashs

This endpoint allows to check if a URL is on a Safe Browsing list, the client must first compute the hash and hash prefix of the URL

Field Type Description
apiKey credentials Required: API key obtained from Google.
clientId String Required: A client ID that (hopefully) uniquely identifies the client implementation of the Safe Browsing API.
clientVersion String Required: The version of the client implementation.
clientStates JSON Required: Json array. The current client states for each of the client's local threat lists.
threatTypes JSON Required: Json array. The threat types to be checked.
platformTypes JSON Required: Json array. The platform types to be checked.
threatEntryTypes JSON Required: Json array. The entry types to be checked.
threatEntries JSON Required: Json array of objects. The threat entries to be checked.

clientStates format

[
    "ChAIARABGAEiAzAwMSiAEDABEAE=",
    "ChAIAhABGAEiAzAwMSiAEDABEOgH"
]

threatTypes format

["MALWARE", "SOCIAL_ENGINEERING"]

platformTypes format

["WINDOWS"]

threatEntryTypes format

["URL"]

threatEntries format

[
    {"hash": "WwuJdQ=="},
    {"hash": "771MOg=="},
    {"hash": "5eOrwQ=="}
]

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://GoogleSafeBrowsingAPIdimashirokovV1.p.rapidapi.com/checkSafetyByHashs")
.header("X-RapidAPI-Host", "GoogleSafeBrowsingAPIdimashirokovV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication