Billing Profiles

Anton Kovalsky
  • Updated

This article includes instructions on using API commands through the Swagger UI. All instructions related to Swagger require you to first authenticate yourself whenever you’ve opened a window with the Swagger UI. Click “Authorize” near the top of the page, check all of the boxes in the pop up and hit “Authorize” again, and then input the appropriate credentials to authenticate. Make sure you close the subsequent pop up without clicking the “Sign Out” button. You should now be able to execute the commands below by clicking the “Try it out” button next to the command of your choice. For a more detailed description of this authentication step, see this article on Authenticating in Swagger.



1. Creating a Billing Profile


Before you can begin doing anything billable in the Terra Data Repo (adding datasets, ingesting data, or creating snapshots through Swagger) you’ll need to create a “Billing Profile”. A Billing profile UUID is needed to link your actions to a billing source in the Google Cloud Platform. A Billing profile can be reused across datasets, and a single dataset can use multiple profiles to bill for different snapshots of data. The steps below outline how to create Billing profiles, list them, and share them with others.


1.1. Set up a Google Billing Account

Firstly, you will of course need to have access to a Google Cloud Billing account in order to create a Billing profile. Instructions to create a Google Cloud Billing Account and how to manage it. Note that you need to have the Billing Account User role available on that Cloud Billing Account.

1.2. Add the Data Repo service account as a user on your account

To give the Data Repo access to your billing, go to your GCP Billing page to grant the Data Repository Service account ( the Billing Account User role on the account as shown here:



If you are working in the alpha environment, you’ll need to grant the following Data Repository Service account access as well:


1.3. Create a Billing Profile via Swagger API

Once the service account has access to a billing source, you’ll be able to use the createProfile API endpoint to create a new Billing profile. Click on the title as shown below (or just go directly to the endpoint via this url: and click “Try it out” to unlock it:




If you're properly authenticated, you'll now be able to edit any input fields, such as the main request body, and you'll see an execute button somewhere below that field. Modify the request body with the appropriate code as shown below, and then click "Execute".

"applicationDeploymentName": "string",
"biller": "direct",
  "billingAccountId": "/*The Google Billing Account ID you can find on your GCP Billing page*/",
"cloudPlatform": "gcp",
"description": "string",
"id": "/*a string object with a regex pattern*/",
"profileName": "string"


Some relevant points:

  • The "biller" field should generally be set to "direct"

  • The "billingAccountId" field should be set to the Google Billing Account ID that you can find on your GCP Billing page.

  • The "id" field must be a regex string, which is a string that follows this pattern:[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}. This might be auto-generated by the Swagger UI, but if for some reason, the UI isn't generating a new unique regex string here you may have to do it yourself. This can be done using a library like uuidgen or uuid and ensuring it is lower case. This Id will be required for most of the downstream steps that require creation of resources -- such as creating datasets, ingesting files, creating snapshots and more. (don't worry, the section below explains how to look it up if you lose track of it).  If you need to generate a regex string, just use the following command in a terminal:
uuidgen | tr 'A-Z' 'a-z'
  • Wherever the above example code says "string", you can put whatever arbitrary set of characters you like to help you keep track of things. The ProfileName can be useful if you use multiple billing accounts. As you'll see below, when you're looking up Billing profile information, having a clearly named Billing profile saves you a lot of trouble if you're trying to remember which Billing profile ID goes with which Billing Account ID.


2. Looking up Billing profile information

If you lose track of your Billing profile ID, you can always find it again by using the enumerateProfiles API endpoint to list out all of the profiles to which you have access. So long as you've properly authenticated using the "Authorize" button near the top of the page, clicking "Execute" on this endpoint will list all Billing profiles associated with the credentials you used to log in. The info for each Billing profile will appear in the response body that appears beneath the request body after you've executed. The relevant information in most cases is the number corresponding to the "id" field:





3. Sharing your Billing profile with someone else

Another way to gain access to a Billing profile (or to give someone else access) is to use the addProfilePolicyMember API endpoint to add a person via their email to a Billing profile to which you have access. For this, all you'll need is the Billing profile ID (as found above) and the target user's email address:






Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request



Please sign in to leave a comment.