> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpaygent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpaygent.com/_mcp/server.

# GCP Cost Tracking Setup

Connect your Google Cloud Platform account to track infrastructure costs automatically. Follow these steps to configure billing data access.

> **Info**
>
> **What You'll Need:** GCP project with billing enabled, ability to create service accounts, and BigQuery API access.

---

## Step 1 — Enable BigQuery Export

Configure GCP to export billing data to BigQuery.

1. Go to **GCP Console** → **Billing** → **Billing export**

2. You'll see **Detailed usage cost** export (it will be disabled initially). Click **Edit settings**

   ![GCP Billing Export - Edit Settings](/_fern-img/e742e4f2a71ea7f6faf3bf5fdd4a96ae19bdac3164776c676ebee0f900129faa.webp)

3. Select the **project** you want to track costs for, then create a new BigQuery dataset or use an existing one.

   Note the **dataset name** and **table name** created:

   * Dataset: `billing_export`
   * Table: `gcp_billing_export_v1_XXXXX`

   ![GCP Billing Export - Select Project and Dataset](/_fern-img/531d6135fa6704e99c126a11c04fc0b6f2c6f0bcdcc79c844292a5320176e9c9.webp)

---

## Step 2 — Create Service Account

Create a service account with permissions to read billing data from BigQuery.

1. Go to **IAM & Admin** → **Service Accounts**
2. Click **Create Service Account**
3. Grant the following roles:
   * `BigQuery Data Viewer`
   * `BigQuery Job User`
   * `BigQuery Read Session User`
4. Complete the service account creation
5. Click on the service account → **Keys** → **Add Key** → **Create new key**

> **Warning**
>
> Select **JSON** format and download the key file. Keep it secure!

---

## Step 3 — Upload Credentials to Paygent

In the Paygent dashboard, navigate to **Infra Cost** and select the GCP tab.

1. Click **Choose File** and select the JSON key file downloaded in Step 2
2. Enter the **Billing Dataset** name from Step 1
   * Example: `billing_export`
3. Enter the **Billing Table** name from Step 1
   * Example: `gcp_billing_export_v1_XXXXX_XXXXX_XXXXX`
4. Click **Upload Credentials**

---

> **Success**
>
> **Setup Complete!** Cost data will be available within 24-48 hours. Paygent will automatically sync your GCP billing data daily.

---

## Troubleshooting

#### Invalid JSON file

Ensure you downloaded the service account key in JSON format (not P12). The file should start with `{`.

#### Permission denied errors

Verify the service account has all three required BigQuery roles. Check that the billing export is in the same project as the service account.

#### Dataset or table not found

Double-check the dataset and table names match exactly (case-sensitive). Ensure BigQuery export is enabled and has generated at least one export.

#### No cost data appearing

GCP billing exports are generated daily. Wait 24-48 hours after setup. Ensure your GCP project has actual usage to report.