Using the Submission API

Using the Submission API

This page explains how to use the Submission API to submit URLs that you suspect are unsafe to Safe Browsing for analysis. Any URLs that are confirmed to match the Safe Browsing policies are added to the Safe Browsing service.

Before you begin

Contact our sales team or your customer engineer to obtain access to this feature.

Submitting URLs

To submit a URL, send an HTTP POST request to the projects.submissions.create method.

API request

Before using any of the request data, make the following replacements:

PROJECT_ID: your Google Cloud project ID

HTTP method and URL:

POST https://webrisk.googleapis.com/v1/projects/PROJECT-ID/submissions

Request JSON body:

{
  "uri": "https://www.phishingsite.com/",
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://webrisk.googleapis.com/v1/projects/PROJECT-ID/submissions"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://webrisk.googleapis.com/v1/projects/PROJECT-ID/submissions" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "uri": "https://www.phishingsite.com/",
}