[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eThis guide outlines the necessary steps to begin using the Cloud Billing Budget API, including prerequisites and setup.\u003c/p\u003e\n"],["\u003cp\u003eA dedicated Google Cloud project is recommended for managing FinOps and billing administration, including the use of the Cloud Billing Budget API.\u003c/p\u003e\n"],["\u003cp\u003eBilling must be enabled on the chosen project, which should be linked to a Cloud Billing account to track costs.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Billing Budget API must be enabled within the designated project, and authentication is required for any client application using the API.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Cloud CLI (gcloud CLI) should be installed and initialized to manage resources and test authentication, and users can use Google supported client libraries, REST, or gRPC to call the API.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\nThis guide provides all required setup steps to start using the\nCloud Billing Budget API.\n\nBefore you begin\n\nYou should do the following before reading this guide:\n\n1. Read [Cloud Billing Budget API Overview](/billing/docs/how-to/budget-api-overview).\n2. Read [Cloud Billing Budget API Prerequisites](/billing/docs/how-to/budget-api-prereqs).\n\nAbout the Google Cloud console\n\nThe Google Cloud console\n([visit documentation](https://support.google.com/cloud/answer/3465889?hl=en&ref_topic=3340599),\n[open console](https://console.cloud.google.com/))\nis a web UI used to provision, configure, manage, and monitor systems that use\nGoogle Cloud products. You use the Google Cloud console to set up and\nmanage Google Cloud and Cloud Billing resources.\n\n1. Select or Create a project\n\nTo use services provided by Google Cloud, you must create a *project* .\nA project organizes all your Google Cloud resources. A project consists\nof a set of collaborators, enabled APIs (and other resources), monitoring tools,\nbilling information, and authentication and access controls. You can create\none project, or you can create multiple projects and use them to organize your\nGoogle Cloud resources in a\n[resource hierarchy](/resource-manager/docs/cloud-platform-resource-hierarchy).\nFor more information on projects, see the\n[Resource Manager documentation](/resource-manager/docs/creating-managing-projects).\n\n**Recommendation about projects** : We recommend that you create and use a\nseparate Google Cloud project to contain all of your FinOps and billing\nadministration needs for a Cloud Billing account, including your use of\nthe Cloud Billing Budget API.\n[Learn more about the benefits to using a FinOps-focused project](/billing/docs/how-to/create-billing-account#set-up-billing-project)\nfor your billing administration use cases.\n\nIn the Google Cloud console, on the project selector page,\nselect or create a Google Cloud project.\n\n[Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n\n2. Enable billing\n\nYou need to make sure that billing is enabled on the project you are using for\ncalling the Cloud Billing Budget API. If you followed the recommendation in the\n[project section](#project),\nthis is your *FinOps or billing administration* Google Cloud project.\n\n\n[Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\nA Cloud Billing account is used to define who pays for a given set of\nGoogle Cloud resources. Resources, such as enabled APIs, are organized\nin projects. A Cloud Billing account can be linked to one or more projects.\nProject usage is charged to the linked billing account.\nIn most cases, you configure billing when you create a project. For more\ninformation, see the\n[Cloud Billing documentation](/billing/docs/concepts).\n\nCost of use\n\nYou set up Cloud Billing budgets to monitor costs incurred in a\nCloud Billing account. The Cloud Billing account you are monitoring can\nbe the same Cloud Billing account that is linked to the project you use to\ncall the Cloud Billing Budget API. Note that the Cloud Billing Budget API is\n[free to use](/billing/v1/pricing)\nfor Google Cloud customers. If you choose to configure\n[programmatic budget notifications](/billing/docs/how-to/budgets-programmatic-notifications),\nyou will be charged the\n[standard Pub/Sub prices](/pubsub/pricing).\n\n3. Enable the API\n\nYou must enable the Cloud Billing Budget API in the project you are using to call\nthe Cloud Billing Budget API. If you followed the recommendation in the\n[project section](#project),\nthis is your *FinOps or billing administration* Google Cloud project.\n\nFor more information on enabling APIs, see the\n[Service Usage documentation](/service-usage/docs/enable-disable).\n\n\nEnable the Cloud Billing Budget API.\n\n\n[Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=billingbudgets.googleapis.com)\n\n4. Set up authentication and authorization\n\nIf you plan to use the Cloud Billing Budget API, you need to set up authentication.\nAny client application that uses the API must confirm its identity by\nauthenticating. For details, see\n[Authenticate to Cloud Billing](/billing/docs/authentication).\n\nYou authenticate as a specific *principal*, such as a Google Account or a\nservice account. That principal must have Identity and Access Management (IAM) roles that\ncontain the required permissions for the Cloud Billing Budget API.\n\n\nTo ensure that the principal has the necessary\npermissions to manage budgets,\n\nask your administrator to grant the principal the\n\n\n[Billing Account Administrator](/iam/docs/roles-permissions/billing#billing.admin) (`roles/billing.admin`)\nIAM role on your billing account.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYour administrator might also be able to give the principal\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nTo learn how to grant roles on a billing account, see\n[Update Cloud Billing permissions](/billing/docs/how-to/billing-access#update-cloud-billing-permissions).\n\n5. Install and initialize the gcloud CLI\n\nIf you plan to use the Cloud Billing Budget API,\nyou need to install and initialize the Google Cloud CLI.\nGoogle Cloud CLI is a set of tools that you can use\nto manage resources and applications hosted on Google Cloud.\nThis includes the [gcloud CLI](/sdk/gcloud).\nThe following link provides instructions:\n\n\n[Install](/sdk/docs/install) the Google Cloud CLI.\n\nAfter installation,\n[initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n```bash\ngcloud init\n```\n\n\nIf you're using an external identity provider (IdP), you must first\n[sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n6. Test the SDK and authentication\n\nIf you have set up authentication in previous steps,\nyou can use the gcloud CLI to test your authentication environment.\nExecute the following command to verify that\nno error occurs and that credentials are returned: \n\n```\ngcloud auth print-access-token\n```\n\nThat command is used by all Cloud Billing Budget API command line REST samples\nto authenticate API calls.\n\n7. Install the Cloud Billing Budget API client library\n\nThe Cloud Billing Budget API is built on HTTP and JSON, so any standard HTTP\nclient can send requests to it and parse the responses.\n\nYou have three options for calling the API:\n\n- [Google supported client libraries](/billing/docs/reference/budget/libraries)\n (recommended)\n\n Client libraries provide better language integration, improved security, and\n support for making calls that require user authorization. The Google supported\n client libraries are available for several popular languages, and these are\n the recommended option.\n- [REST](/billing/docs/reference/budget/rest)\n\n- [gRPC](/billing/docs/reference/budget/rpc)"]]