Troubleshooting API usage Stay organized with collections Save and categorize content based on your preferences.
This page provides application developers an overview of how to troubleshoottheir usage of Google APIs and Google Cloud APIs.
Background
Google APIs are networked APIs provided by Google services. Applicationscan access Google APIs via JSON HTTP and gRPC from different environments.We recommend developers to use Google-provided client libraries in theirapplications. These libraries implement common boilerplate logic, such asauthentication and list pagination, which greatly reduce developmentoverhead and common mistakes.
For more information, seeClient Libraries Explained
Getting started
If you are new to Google APIs, you should follow theGetting Started page to complete thepreparation steps for your application. You should first use thecurl -vcommand to send test requests to Google APIs that you want to use.It lets you experiment with Google APIs without writing any code.You can often resolve many issues before you start real applicationdevelopment.
For more information, seeGetting Started.
Troubleshooting using metrics
Google APIs provide free API metrics that cover common aspects of API usage,including request counts, errors, latencies, request and response sizes. Theyprovide fine-grained dimensions in terms of applications and locations.Developers can discover abnormal API usage, and identify potentialroot causes. For example, higher 400 errors can mean a recentlyupdated application has some logical bugs, or higher request and responsesizes can cause slower application performance.
For more information, seeMonitoring API usage.
Troubleshooting using logs
For security and privacy reasons, Google APIs generally don't provide API logsto application developers. We highly recommend application developers logAPI errors on the client side. You can either log the errors to a local storageor to a remote logging API, such asCloud Logging API.
Logs typically contain more information about errors than metrics, such aserror messages and error details. They are extremely useful and oftennecessary to troubleshoot API errors. When developers notice any issuewith their API usage, they can query the logs to find error messages anderror details, and use the information to resolve the errors or contactthe support.
Cloud Audit Logs
For security sensitive activities, Google Cloud products may generate auditlogs that contain detailed information of the activities. They are a greatsource of information for troubleshooting your usage of Google Cloud APIs.For example,VPC Service Controls dry run featuregenerates audit logs for administrators to evaluate the upcoming policy changes.
For more information, seeCloud Audit Logs.
Resolving errors
If you have issues with your Google API usage and you have found thecorresponding metrics and logs, you can follow API Design GuideErrors page to resolve the errors.
In general, each API error has 3 pieces of information: error code, errormessage, and error details:
- The error code lets applications handle the error at the higher level, suchas retry after
503errors or re-authenticate users after401errors. The error message lets application developers understand the error andfix their application logic.
Warning: Do not code against the error messages; they are subject to changewithout notice.The error details contain additional information the applications can useto handle the error programmatically.
For more information, see theErrors page.
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-12-15 UTC.