Authorize requests

Your application needs to identify itself every time it sends a request tothe Cloud SQL Admin API, by including anAPI key with eachrequest.

Acquiring and using an API key

To acquire an API key:

  1. Open theCredentials page in the Google Cloud console.
  2. This API supports two types of credentials. Create whichever credentials are appropriate for your project:
    • OAuth 2.0: Whenever your application requests private user data, it must send an OAuth 2.0 token along with the request. Your application first sends a client ID and, possibly, a client secret to obtain a token. You can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.

      Note: Since this API doesn't have any methods that require OAuth 2.0 authorization, you might only need to obtainAPI keys, which are described below. However, if your application calls other APIs that require user authorization, then you still need OAuth 2.0 credentials.

      For more information, see theOAuth 2.0 documentation.

    • API keys: A request that does not provide an OAuth 2.0 token must send an API key. The key identifies your project and provides API access, quota, and reports.

      The API supports several types of restrictions on API keys. If the API key that you need doesn't already exist, then create an API key in the Console by clickingCreate credentials > API key. You can restrict the key before using it in production by clickingRestrict key and selecting one of theRestrictions.

To keep your API keys secure, follow thebest practices forsecurely using API keys.

After you have an API key, your application can append the query parameterkey=yourAPIKey to all request URLs.

The API key is safe for embedding in URLs; it doesn't need any encoding.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-09 UTC.