Linking GCP Cloud Billing as a source
This source is currently in alpha. The interface and available tables may change.
Let AI connect your sources for you
Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

The GCP Cloud Billing connector syncs your Google Cloud Platform billing data into the PostHog data warehouse, including billing accounts, projects, subaccounts, services, SKUs, and budgets.
Note: This source is currently in alpha.
Prerequisites
- A Google Cloud service account with billing permissions
- A service account JSON key file
- The Cloud Billing API enabled in your Google Cloud project
- The Cloud Billing Budget API enabled (required for syncing budgets)
Configuring Google Cloud
Step 1: Create a service account
- Go to the Google Cloud Console.
- Navigate to IAM & Admin > Service Accounts.
- Click Create Service Account.
- Provide a descriptive name (e.g.,
posthog-billing-reader) and click Create and continue.
Step 2: Grant billing permissions
Grant the service account the Billing Account Viewer role (roles/billing.viewer) on each billing account you want to sync. This provides read access to billing accounts, linked projects, services, and budgets.
For organization-wide access, grant the role at the organization level. For specific billing accounts, grant the role on each billing account individually.
Alternatively, create a custom role with just these permissions:
billing.accounts.list– list billing accountsbilling.accounts.get– read billing account detailsbilling.resourceAssociations.list– list projects linked to billing accountsbilling.budgets.getandbilling.budgets.list– read budgets
Step 3: Generate a JSON key file
- In IAM & Admin > Service Accounts, click your service account.
- Go to the Keys tab.
- Click Add Key > Create new key, choose JSON, and download the key file.
- Store the key file securely – you can't download it again.
Step 4: Enable the APIs
- Enable the Cloud Billing API.
- Enable the Cloud Billing Budget API.
Adding a data source
- In PostHog, go to the Sources tab of the data pipeline section.
- Click + New source and click Link next to this source.
- Enter your credentials (see Configuration below) and click Next.
- Select the tables you want to sync, choose a sync method and frequency, then click Import.
Once the syncs are complete, you can start querying this data in PostHog.
Import billing accounts, project links, subaccounts, budgets, and the public price catalog from Google Cloud Platform. Upload the service account JSON key file you created above.
You'll be asked for:
- Service account JSON key file – the JSON key file downloaded in the previous step
Sync modes
Each table can be synced in one of several modes, depending on what the source supports:
- Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
- Incremental – only new or updated rows are synced on each run, using a cursor field (such as an
updated_attimestamp). Cheaper than a full refresh, but deletes aren't captured. - Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
- Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.
See sync methods for a full explanation of how each mode works and how to choose between them.
All GCP Cloud Billing tables use full refresh sync. Each sync replaces the contents of the table because the Cloud Billing API doesn't provide timestamp filters for incremental updates.
Configuration
| Option | Type | Required |
|---|---|---|
Service account JSON key file | file-upload | Yes |
Supported tables
| Table | Description | Sync method | Incremental field | Primary key |
|---|---|---|---|---|
billing_accounts | Billing accounts accessible to the service account. | Full refresh | — | — |
projects | Projects linked to each accessible billing account. | Full refresh | — | — |
sub_accounts | Billing subaccounts under each accessible reseller account. | Full refresh | — | — |
services | Google Cloud services in the public price catalog. | Full refresh | — | — |
skus | Public SKUs and their latest prices in USD for each Google Cloud service. | Full refresh | — | — |
budgets | Budget amounts, cost filters, thresholds, and notification settings for each accessible billing account. | Full refresh | — | — |
| Table | Description |
|---|---|
billing_accounts | Billing accounts accessible to the service account |
projects | Projects linked to each accessible billing account |
sub_accounts | Billing subaccounts under each accessible reseller account |
services | Google Cloud services in the public price catalog |
skus | Public SKUs and their latest prices in USD for each service |
budgets | Budget amounts, cost filters, thresholds, and notification settings |
Limitations
- The source imports current public SKU prices in USD only. Historical pricing isn't available.
- Negotiated pricing and committed-use discounts aren't reflected – only public list prices are synced.
- Detailed cost and usage data (line-item spend, usage metrics) isn't available through this source. For that, export your billing data to BigQuery and connect it as a separate BigQuery source.
Troubleshooting
Invalid service account key
If you see an error about an invalid or missing key:
- Ensure you uploaded the complete JSON key file, not a partial copy or a different file type.
- Generate a fresh key from the Google Cloud Console under IAM & Admin > Service Accounts > your account > Keys.
Permission denied
If syncing fails with a 403 error:
- Verify the service account has the Billing Account Viewer role on the billing accounts you want to sync.
- Confirm both the Cloud Billing API and Cloud Billing Budget API are enabled.
- For organization-level access, grant the role at the organization level rather than on individual projects.
No billing accounts found
If no data appears after syncing:
- Verify the service account is associated with at least one billing account.
- Check that the Cloud Billing API is enabled in the Google Cloud project that owns the service account.
Credentials rejected by Google
If you see an error that Google rejected the service account key:
- The key may have been rotated or revoked. Generate a new JSON key file and reconnect the source.
- The service account may have been deleted. Create a new service account and key.
If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.