---
title: "Run Google Ads Gaql"
method: POST
path: "/admin/lsa/gaql"
tags: ["admin", "lsa-admin"]
---

# Run Google Ads Gaql

`POST /admin/lsa/gaql`

## Request

- Base URL: `https://api-docs.upsmith.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api-docs.upsmith.com/admin/lsa/gaql`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Run an arbitrary GAQL query against one of an org's Google Ads customers and return the
rows as dicts.

Authenticates with the org's own per-org OAuth credential by default; pass a
``login_customer_id`` mapped to a shared manager credential to run under that MCC instead
(which reaches only accounts linked under it). ``customer_id`` defaults to the org's single
active LSA account when omitted. Read-only — GAQL only selects, so nothing is written to
Google or our DB; note the per-org credential reaches the customer's *full* Google Ads
account (Search / PMax / Display), not just Local Services. A revoked/expired credential or
a malformed query surfaces as a 400.

Pass ``api_version`` to run this one query on a different Google Ads API version than the
service default — the only way to select a field that exists solely in a newer version.
Selecting a field the chosen version doesn't define is a 400 from Google.

## Headers

- `organization-id` string, nullable
- `timezone` string
- `x-user-id` string, nullable
- `x-actor-email` string, nullable
- `x-request-source` string, nullable
- `x-operation-id` string, nullable
- `x-commit-message` string, nullable
- `x-confirmation-id` string, nullable
- `x-chat-id` string, nullable

## Request body

- GaqlRequest
  - `organization_id` string, required: organization.id (UUID) whose Google Ads credential authenticates the query.
  - `query` string, required: The GAQL SELECT to run, e.g. 'SELECT campaign.id, campaign.name FROM campaign'.
  - `customer_id` string, nullable: Google customer id to query (dashes optional). Omit to use the org's single active LSA account.
  - `login_customer_id` string, nullable: MCC id (dashes optional). When set + mapped to a shared manager credential, uses it; else per-org OAuth.
  - `max_rows` integer: Row cap; the result sets truncated=true if more were available.
  - `api_version` string, nullable: Google Ads API version for this query alone, e.g. 'v25'. Omit to use the service default.

## Response `200`

Successful Response

- GaqlResult: Rows returned by running an arbitrary GAQL query against one Google Ads customer. ``credential_source`` records which OAuth identity authenticated the query: the MCC's shared manager credential (reaches only accounts linked under that MCC) or the org's own per-org credential (reaches the customer's full Google Ads account -- Search / PMax / Display, not just Local Services). Each row is Google's ``GoogleAdsRow`` rendered to a dict with proto field names preserved (e.g. ``{"campaign": {"id": "1", ...}}``).
  - `organization_id` string, required
  - `customer_id` string, required: Google customer id (no dashes) the GAQL ran against.
  - `login_customer_id` string, nullable: MCC set as the login-customer-id header, when the query ran under a manager.
  - `credential_source` 'manager' | 'per_org', required: Which credential authenticated: the MCC's shared manager credential or the org's own per-org OAuth.
  - `api_version` string, required: Google Ads API version the query actually ran on -- which fields exist depends on it.
  - `query` string, required: The GAQL query that was executed, verbatim.
  - `row_count` integer, required: Number of rows returned (after the max_rows cap).
  - `truncated` boolean, required: True if the result was cut off at max_rows and more rows were available.
  - `rows` object[]: Each GoogleAdsRow as a dict; proto field names preserved.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/upsmith/apis/upsmith-api.md) - [All operations](https://skmtc.dev/upsmith/apis/upsmith-api/llms.txt) - [OpenAPI document](https://skmtc.dev/upsmith/apis/upsmith-api/revisions/cce8b07a5787?raw)
