[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eSecure API keys by implementing best practices during storage and transmission to prevent unauthorized access or unexpected charges.\u003c/p\u003e\n"],["\u003cp\u003eRestrict API key usage to minimize the impact of compromised keys, using the provided resources for more information on restrictions.\u003c/p\u003e\n"],["\u003cp\u003eAvoid including API keys in URLs as query parameters, instead opting for the \u003ccode\u003ex-goog-api-key\u003c/code\u003e HTML parameter or client libraries.\u003c/p\u003e\n"],["\u003cp\u003ePeriodically rotate API keys and delete old ones, while deleting any keys that are not in use to minimize potential exposure.\u003c/p\u003e\n"],["\u003cp\u003eNever include API keys directly in client code or code repositories, instead leveraging server-side logic, and implement monitoring to detect any unauthorized usage.\u003c/p\u003e\n"]]],[],null,["When you use API keys in your applications, ensure that they are kept secure\nduring both storage and transmission. Publicly exposing your API keys can lead\nto unexpected charges on your account or unauthorized access to your data. To\nhelp keep your API keys secure, implement the following best practices.\n\nAdd API key restrictions to your key\n\nBy adding restrictions, you can limit the ways an API key can be used, reducing\nthe impact of a compromised API key.\n\nFor more information, see\n[Apply API key restrictions](/docs/authentication/api-keys#api_key_restrictions).\n\nAvoid using query parameters to provide your API key to Google APIs\n\nProviding your API key to APIs as a query parameter includes your API key in the\nURL, exposing your key to theft through URL scans. Use the\n[`x-goog-api-key` HTTP header](/docs/authentication/api-keys-use#using-with-rest)\nor a [client library](/docs/authentication/api-keys-use#using-with-client-libs)\ninstead.\n\nDelete unneeded API keys to minimize exposure to attacks\n\nRetain only the API keys you are actively using to keep your attack surface as\nsmall as possible.\n\nDon't include API keys in client code or commit them to code repositories\n\nAPI keys hardcoded in the source code or stored in a repository are open to\ninterception or theft by bad actors. The client should pass requests to the\nserver, which can add the credential and issue the request.\n\nDon't use API keys bound to service accounts in production\n\nAPI keys bound to service accounts are designed to accelerate the initial\nexperience for developers exploring Google Cloud APIs. Don't use them in\nproduction environments. Instead,\n[plan to migrate to more secure alternatives](#consider-alternatives) such as\n[Identity and Access Management (IAM)](/iam/docs/grant-role-console) policies and\n[short-lived service account credentials](/iam/docs/service-account-creds#short-lived-credentials),\nfollowing least-privilege security practices.\n\nHere's why you should migrate from using an API key bound to a service account\nto more secure practices as soon as possible:\n\n- API keys are sent alongside requests. This makes it more likely that the key\n might be exposed or logged.\n\n- API keys are bearer credentials. This means that if someone steals an API key\n that's bound to a service account, they can use it to authenticate as that\n service account and access the same resources that service account can.\n\n- API keys bound to service accounts obscure the identity of the end user in\n audit logs. To track the actions of individual users, make sure each user has\n their own set of credentials.\n\nImplement strong monitoring and logging\n\nMonitoring API usage can help alert you to unauthorized usage. For more\ninformation, see\n[Cloud Monitoring overview](/monitoring/docs/monitoring-overview) and\n[Cloud Logging overview](/logging/docs/overview).\n\nIsolate API keys\n\nProvide each team member with their own API key for each application. This can\nhelp control access, provide an audit trail, and reduce the impact of a\ncompromised API key.\n\nRotate your API keys periodically\n\nPeriodically create new API keys, update your applications to use the new API\nkeys, and delete the old keys.\n\nFor more information, see\n[Rotate an API key](/docs/authentication/api-keys#rotate).\n\nConsider a more secure method of authorizing access\n\nFor help with choosing an authentication method, see\n[Authentication methods](/docs/authentication)."]]