Authorization header. API keys are tied to specific scopes that control which operations they can perform, giving you fine-grained control over what each integration is permitted to do. Before you can make your first request, you need to generate a key from your account settings — a process that takes under a minute and only needs to be done once per integration.
Generate an API Key
You can create as many API keys as you need — one per application, environment, or integration is a recommended practice. Follow the steps below to generate your first key.1
Open API Key Settings
Log in to your Google account and navigate to Settings → API Keys in the left-hand sidebar. This page lists all active keys associated with your account along with their creation date, last-used timestamp, and assigned scopes.
2
Create a New Key
Click New Key to open the key creation dialog. Give your key a descriptive name (for example,
production-search-service or dev-local) so you can identify it later. Then select the scopes this key requires — choose only the scopes your integration actually needs to follow the principle of least privilege. Available scopes are read, write, and admin.3
Copy Your Key Immediately
After clicking Create, your full API key is displayed exactly once. Copy it to your clipboard right away — once you close or navigate away from this dialog, the key value is no longer retrievable and you will need to generate a new one if you lose it.
4
Store the Key Securely
Paste your key into your application’s environment configuration. In local development, use a
.env file (and ensure .env is listed in your .gitignore). In production, use your platform’s secret management tooling. Never hardcode the key value directly in your source code.Using Your API Key
Pass your API key as a Bearer token in theAuthorization header of every request. The header value must follow this exact format:
API Key Scopes
When you create an API key, you assign it one or more scopes that determine which API operations it is permitted to perform. Requests made with a key that lacks the required scope for an operation will receive a403 Forbidden response.
The
write scope implicitly includes all read permissions. Similarly, admin encompasses both read and write. You only need to select the highest scope your integration requires — there is no need to add lower scopes separately.Authentication Errors
If authentication fails, the API returns one of two status codes depending on the nature of the problem. Understanding the distinction helps you diagnose issues quickly.401 Unauthorized
Your request is missing an
Authorization header, the header is malformed, or the API key value is invalid (for example, it was deleted or never existed). Double-check that the header is formatted as Bearer YOUR_API_KEY and that the key value matches what was generated in your settings.403 Forbidden
Your API key is valid and recognized, but it does not have the scope required to perform the requested operation. Review the scopes assigned to your key in Settings → API Keys and regenerate the key with the correct scopes if needed.