如要使用 Cloud API,您也必須擁有 Google 專案。專案等同於開發人員帳戶。做為 Google Cloud 資源的資源容器。專案也提供 Google Cloud 服務用量的隔離界線,因此您可以在專案層級獨立管理配額限制和帳單。用量遙測資料和資訊主頁也會依專案分組。如果您還沒有專案,可以使用 Google Cloud 控制台建立一個。
專案可擁有各種資源,包括 API 金鑰、OAuth 用戶端、服務帳戶、Compute Engine VM、Cloud Storage 值區和 BigQuery 資料集。應用程式呼叫 Cloud API 時,擁有應用程式憑證的專案稱為用戶端專案,擁有目標資源的專案則稱為資源專案。一個 API 要求可能會觸及多個資源,因此會涉及多個資源專案。
如要停止使用 Google Cloud,請前往 Google Cloud 控制台刪除專案。保留期限過後,系統會刪除專案和專案中的所有資源。請注意,不同類型的資料有不同的保留期限。
探索 API
使用任何 Cloud API 之前,請先使用 Google Cloud 控制台
API 程式庫瀏覽可用的 Cloud API,找出最符合您業務需求的 API。如要進一步瞭解特定 Cloud API,請前往公開說明文件網站,例如 Spanner API。
啟用 API
部分 Cloud API 預設為啟用。如要使用預設未啟用的 Cloud API,必須為專案啟用該 API。視應用程式涉及的服務和專案而定 (包括用戶端專案和資源專案),您可能需要為多個專案啟用 API。啟用相依於其他 API 的 API 時,這些 API 也會一併啟用。
啟用 API 時,您必須接受服務條款,並承擔 API 的相關費用。您必須具備專案的 serviceusage.services.enable 權限,才能啟用 API。詳情請參閱「服務使用情形」的存取權控管。
如果您要使用 Cloud API 建構應用程式,建議您使用 Google Cloud 用戶端程式庫 (如有)。用戶端程式庫可處理常見的 API 功能,例如驗證、錯誤處理、重試和酬載驗證,方便您使用。您需要在初始化期間將應用程式憑證傳送至用戶端程式庫,這樣用戶端程式庫才能代表應用程式呼叫Google Cloud API。
[[["容易理解","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 (世界標準時間)。"],[[["\u003cp\u003eThis guide outlines the steps for developers to begin using Google Cloud APIs, starting with experimenting using \u003ccode\u003ecurl\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing Google Cloud APIs necessitates a Google account and a Google project, which serves as a resource container and isolation boundary.\u003c/p\u003e\n"],["\u003cp\u003eBefore using a Cloud API, one must discover it in the API Library and then enable it for the relevant project(s), which may involve accepting terms and billing responsibility.\u003c/p\u003e\n"],["\u003cp\u003eFor using certain APIs and building full applications, a billing account linked to the project and proper authentication credentials, such as Application Default Credentials or API keys, are required.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud Client Libraries are recommended for building applications, as they simplify API interactions by managing authentication, error handling, retries, and payload validation.\u003c/p\u003e\n"]]],[],null,["# Getting started\n\nThis page explains how developers can get started using Google Cloud APIs.\n\nIf you are using Google Cloud APIs for the first time, you can follow\nthe steps in this guide to call the APIs using `curl` commands. You can use\n`curl` commands to experiment with an API before you develop your application.\n\nCreating a Google account\n-------------------------\n\nTo use Google Cloud APIs in your applications, you first need to have a\nGoogle account. This allows you to use Google developer products, including\n[Google Cloud console](https://console.cloud.google.com/),\n[gcloud CLI](/sdk), [Cloud Logging](/logging), and\n[Cloud Monitoring](/monitoring). If you're new to Google Cloud,\n[create an account](https://console.cloud.google.com/freetrial)\nto evaluate how our products perform in real-world scenarios. New customers\nalso get $300 in free credits to run, test, and deploy workloads.\n\nCreating a Google project\n-------------------------\n\nTo use Cloud APIs, you also need to have a Google project. A project is\nequivalent to a developer account. It serves as a resource container for\nyour Google Cloud resources. It also provides an isolation boundary for your\nusage of Google Cloud services, so you can manage quota limits and billing\nindependently at the project level. Usage telemetry and dashboards are grouped\nby projects as well. If you don't already have a project, you can create one\nusing the [Google Cloud console](https://console.cloud.google.com/).\n\nA project can own a wide range of resources, including API keys, OAuth clients,\nservice accounts, Compute Engine VMs, Cloud Storage buckets, and BigQuery\ndatasets. When an\napplication calls a Cloud API, the project that owns the application\ncredentials is called the *client project* , and the project that owns the\ntarget resource is called the *resource project*. One API request may touch\nmultiple resources, hence multiple resource projects are involved.\n\nIf you want to stop using Google Cloud for any reasons, you can use\n[Google Cloud console](https://console.cloud.google.com/) to delete your project. Your\nproject and all resources in the project will be deleted after the retention\nwindow. Note that different types of data have different retention periods.\n\nDiscovering APIs\n----------------\n\nBefore using any Cloud APIs, you should use Google Cloud console\n[API Library](https://console.cloud.google.com/apis/library/browse) to\nbrowse available Cloud APIs and discover the ones that best meet your business\nneeds. For more information about a specific Cloud API, visit its public\ndocumentation site, such as [Spanner API](/spanner).\n\nEnabling APIs\n-------------\n\nSome Cloud APIs are enabled by default. To use a Cloud API that is not enabled\nby default, you must enable it for your project. Depending on which\nservices and which projects are involved from your application, including the\nclient project and resource projects, you may need to enable an API for\nmultiple projects. When you enable an API that depends on other APIs, those APIs\nare also enabled at the same time.\n\nEnabling an API requires you to accept the Terms of Service and billing\nresponsibility for the API. You need permission `serviceusage.services.enable`\non the project to enable APIs. For more information, see Service Usage\n[Access Control](/service-usage/docs/access-control).\n\nIn addition, the service to enable must either be public, or else the service\nowner must grant the user the `servicemanagement.services.bind` permission on\nthe private service. See [Service Management Access Control](/service-infrastructure/docs/service-management/access-control) for more\ninformation.\n\nTo enable an API for a project using the console:\n\n1. Go to the [Google Cloud console API Library](https://console.cloud.google.com/apis/library?project=_).\n2. From the projects list, select the project you want to use.\n3. In the API Library, select the API you want to enable. If you need help finding the API, use the search field and/or the filters.\n4. On the API page, click **ENABLE**.\n\nFrom the same page you can disable an API for your project if you no longer\nuse it to avoid misuse and accidental billing charges. You can also enable\nand disable Cloud APIs using the [gcloud CLI](/sdk/docs) and the\n[Service Usage API](/service-usage/docs/reference/rest/v1/services/enable): \n\n $ gcloud services enable pubsub.googleapis.com\n $ gcloud services disable pubsub.googleapis.com\n\nEnabling billing\n----------------\n\nSome Cloud APIs charge for usage. You need to enable billing for your project\nbefore you can start using these APIs in your project. The API usage in a\nproject is charged to the billing account associated with the project.\n\nIf you don't have a billing account, go to the\n[Google Cloud console billing page](https://console.cloud.google.com/billing)\nand follow the instructions to create one. Then\n[link your billing account](https://console.cloud.google.com/billing/linkedaccount?project=_)\nto your project.\n\nAuthenticating to APIs\n----------------------\n\nHow you authenticate to an API depends on your development environment and what\nauthentication methods the API supports.\n\nSetting up [Application Default Credentials](/docs/authentication/provide-credentials-adc) for use in a variety of\nenvironments is the most common approach, and is recommended for most\napplications. If the API supports [API keys](/docs/authentication/api-keys), that is another option.\nIf your application needs to access Cloud resources owned by your end users, you\n[create an OAuth 2.0 Client ID and use the authentication libraries](https://developers.google.com/identity/protocols/oauth2/web-server).\n\nFor general information about authentication, see\n[Authentication at Google](/docs/authentication).\n\nBuilding applications\n---------------------\n\nIf you are building an application using Cloud APIs, we recommend you to use\n[Google Cloud Client Libraries](/apis/docs/cloud-client-libraries) if\navailable. The client libraries can handle common API features for your\nconvenience, such as authentication, error handling, retry, and payload\nvalidation. You need to pass your application credentials to the client\nlibraries during initialization, so the client libraries can make calls to\nGoogle Cloud APIs on behalf of your application.\n\nSee the following step-by-step guides that use the client libraries for some\npopular APIs:\n\n- [Cloud Billing Budget API with Node.js](https://console.cloud.google.com/?tutorial=billing--budget--billing-budget-api-nodejs).\n- [Cloud Billing Budget API with Python](https://console.cloud.google.com/?tutorial=billing--budget--billing-budget-api-python).\n- [Cloud Logging with Node.js](https://console.cloud.google.com/?tutorial=logging--logging-nodejs).\n- [Cloud Logging with Python](https://console.cloud.google.com/?tutorial=logging--logging-python).\n- [Cloud Logging with Go](https://console.cloud.google.com/?tutorial=logging--logging-go).\n- [Cloud Logging with Java](https://console.cloud.google.com/?tutorial=logging--logging-java).\n- [Speech-to-Text with Node.js](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-nodejs).\n- [Speech-to-Text with Python](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-python).\n- [Speech-to-Text with Go](https://console.cloud.google.com/?tutorial=speech-to-text--speech-to-text-go).\n- [Speech-to-Text with Java](https://console.cloud.google.com/?tutorial=speech-to-text__speech-to-text-java).\n\nFor more information, see\n[Client Libraries Explained](/apis/docs/client-libraries-explained).\n\nMore information\n----------------\n\n- For more information about authentication, see\n [Authentication at Google](/docs/authentication).\n\n- For more information about error handling, see\n [Handling Errors](/apis/design/errors#handling_errors).\n\n- For more information about billing, see\n [Create, modify, or close your billing account](/billing/docs/how-to/manage-billing-account).\n\n- For more information about enabling billing on your project, see\n [Modify a project's billing settings](/billing/docs/how-to/modify-project).\n\n- For more information about enabling and disabling APIs, see\n [Enabling and disabling services](/service-usage/docs/enable-disable)."]]