The Search Console API provides programmatic access to most of the functionality of Google Search Console. You can use the API to view, add, or remove properties and sitemaps, and run advanced queries for Google Search results data for the properties that you manage in Search Console.
This API is exposed as an HTTP REST/JSON-RPC service that you can call directly, or using one of our client libraries (recommended).
Before getting started, make sure you have a Google Search Console account set up, and that it includes at least one site of which you are a verified owner. If you currently don't have a website, there are many free options available for creating one, such as Blogger or Google Sites. Keep in mind that there are different permission levels in Search Console that determine the actions that are possible when using Search Console API.
This document describes the things you should do before writing your first client application.
Get a Google Account
You may also want a separate Google Account for testing purposes.
Try out Google Search Console
This API documentation assumes that you've used Google Search Console, and that you're familiar with web programming concepts and web data formats.
If you haven't used Google Search Console, then try out the user interface before starting to code.
Create a project for your client
Before you can send requests to Google Search Console, you need to tell Google about your client and activate access to the API. You do this by using the Google API Console to create a project, which is a named collection of settings and API access information, and register your application.
To get started using Google Search Console API, you need to first use the setup tool, which guides you through creating a project in the Google API Console, enabling the API, and creating credentials.
If you haven't done so already, create your application's API key by clicking Create credentials > API key. Next, look for your API key in the API keys section.
Learn REST basics
There are two ways to invoke the API:
- Sending HTTP requests and parsing the responses.
- Using client libraries.
If you decide not to use client libraries, you'll need to understand the basics of REST.
REST is a style of software architecture that provides a convenient and consistent approach to requesting and modifying data.
The term REST is short for "Representational State Transfer." In the context of Google APIs, it refers to using HTTP verbs to retrieve and modify representations of data stored by Google.
In a RESTful system, resources are stored in a data store; a client sends a request that the server perform a particular action (such as creating, retrieving, updating, or deleting a resource), and the server performs the action and sends a response, often in the form of a representation of the specified resource.
In Google's RESTful APIs, the client specifies an action using an HTTP verb such as
DELETE. It specifies a resource by a globally-unique URI of the following form:
Because all API resources have unique HTTP-accessible URIs, REST enables data caching and is optimized to work with the web's distributed infrastructure.
For more information about REST, you may find the following third-party documents useful:
- Building Web Services the REST Way, which is aimed at service providers but provides a good overview of REST
- HTTP 1.1 method definitions; specification for
REST in the Google Search Console API
The Google Search Console API operations map directly to REST HTTP verbs.
The specific formats for Google Search Console API URIs are:
The full set of URIs used for each supported operation in the API is summarized in the Google Search Console API Reference document.
Learn JSON basics
The Google Search Console API returns data in JSON format.