Ensure the source file(s) are in a GCS bucket accessible to the service account; the service account needs the bigquery.jobs.create and storage.objects.get permissions.
Construct a jobs.insert request body with configuration.load containing sourceUris (gs:// paths), destinationTable (projectId, datasetId, tableId), sourceFormat (e.g. NEWLINE_DELIMITED_JSON or CSV), and writeDisposition.
POST the request to https://bigquery.googleapis.com/bigquery/v2/projects/{projectId}/jobs with an Authorization: Bearer YOUR_ACCESS_TOKEN header.
Capture the jobReference.jobId from the response and poll GET /bigquery/v2/projects/{projectId}/jobs/{jobId} until status.state is DONE.
Check status.errorResult in the completed job response; if present, the load failed and the field contains the error reason.
Known gotchas
GCS bucket and BigQuery dataset must be in the same region or use multi-region buckets that overlap with the dataset location; cross-region loads fail.
CSV files with a header row require skipLeadingRows: 1 in the load config; omitting this causes the header to be inserted as a data row.
Specifying autodetect: true for schema inference works for simple types but may mistype numeric columns as strings; prefer an explicit schema for production loads.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp