XeoRank Google Analytics API
The google-analytics API from XeoRank — 8 operation(s) for google-analytics.
The google-analytics API from XeoRank — 8 operation(s) for google-analytics.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/xeorank-com:xeorank-com-google-analytics-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: SEO Intelligence Engine Google Analytics API
version: 0.1.0
tags:
- name: google-analytics
paths:
/ga/auth-url:
get:
tags:
- google-analytics
summary: Ga Auth Url
description: 'Return the Google OAuth URL for GA4 analytics.readonly scope.
Before generating the URL the endpoint checks the user''s billing
plan to ensure they haven''t exceeded their ``ga_connections.count``
cap.'
operationId: ga_auth_url_ga_auth_url_get
security:
- APIKeyHeader: []
parameters:
- name: return_to
in: query
required: false
schema:
type: string
default: ''
title: Return To
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID to connect GA4 to
title: Site Id
description: Site UUID to connect GA4 to
- name: origin
in: query
required: false
schema:
type: string
description: Frontend origin to return to after auth (e.g. https://xeorank.com)
default: ''
title: Origin
description: Frontend origin to return to after auth (e.g. https://xeorank.com)
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Auth Url Ga Auth Url Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/callback:
get:
tags:
- google-analytics
summary: Ga Callback
description: 'Handle the Google OAuth callback for GA4.
Exchanges the authorization code for tokens, creates (or updates)
a ``GaConnection`` record, and redirects the user back to the
frontend.'
operationId: ga_callback_ga_callback_get
parameters:
- name: code
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: OAuth authorization code
title: Code
description: OAuth authorization code
- name: state
in: query
required: true
schema:
type: string
description: Encoded state from auth-url
title: State
description: Encoded state from auth-url
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/status:
get:
tags:
- google-analytics
summary: Ga Status
description: Check whether GA4 is connected for the given site.
operationId: ga_status_ga_status_get
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Status Ga Status Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/selection:
get:
tags:
- google-analytics
summary: Ga Selection Options
description: List accessible properties and streams, including the saved selection.
operationId: ga_selection_options_ga_selection_get
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
- name: property_id
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Property to load streams for
title: Property Id
description: Property to load streams for
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Selection Options Ga Selection Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
put:
tags:
- google-analytics
summary: Save Ga Selection
description: Validate and persist the exact GA4 property and data stream to report.
operationId: save_ga_selection_ga_selection_put
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GaSelectionRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Save Ga Selection Ga Selection Put
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/disconnect:
post:
tags:
- google-analytics
summary: Ga Disconnect
description: Disconnect GA4 for the given site (sets is_active = False).
operationId: ga_disconnect_ga_disconnect_post
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Disconnect Ga Disconnect Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/traffic-sources:
get:
tags:
- google-analytics
summary: Ga Traffic Sources
description: 'Traffic by source/channel with AI-assistant referral detection.
Compares the last `days` window to the prior one and surfaces sessions
from ChatGPT / Perplexity / Claude / Gemini / Copilot etc.'
operationId: ga_traffic_sources_ga_traffic_sources_get
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
- name: days
in: query
required: false
schema:
type: integer
description: Window length in days (compared to the prior window)
default: 28
title: Days
description: Window length in days (compared to the prior window)
- name: start_date
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Start date (YYYY-MM-DD)
title: Start Date
description: Start date (YYYY-MM-DD)
- name: end_date
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: End date (YYYY-MM-DD)
title: End Date
description: End date (YYYY-MM-DD)
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Traffic Sources Ga Traffic Sources Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/metrics:
get:
tags:
- google-analytics
summary: Ga Metrics
description: Fetch GA4 analytics metrics for a connected site.
operationId: ga_metrics_ga_metrics_get
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: site_id
in: query
required: true
schema:
type: string
description: Site UUID
title: Site Id
description: Site UUID
- name: days
in: query
required: false
schema:
type: integer
description: Number of days to look back
default: 30
title: Days
description: Number of days to look back
- name: start_date
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Start date (YYYY-MM-DD)
title: Start Date
description: Start date (YYYY-MM-DD)
- name: end_date
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: End date (YYYY-MM-DD)
title: End Date
description: End date (YYYY-MM-DD)
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Metrics Ga Metrics Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/ga/metrics-by-domain:
get:
tags:
- google-analytics
summary: Ga Metrics By Domain
description: Fetch GA4 metrics by domain (for CLI usage).
operationId: ga_metrics_by_domain_ga_metrics_by_domain_get
security:
- APIKeyHeader: []
parameters:
- name: email
in: query
required: true
schema:
type: string
description: Signed-in user email
title: Email
description: Signed-in user email
- name: domain
in: query
required: true
schema:
type: string
description: Site domain
title: Domain
description: Site domain
- name: days
in: query
required: false
schema:
type: integer
description: Number of days to look back
default: 30
title: Days
description: Number of days to look back
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Ga Metrics By Domain Ga Metrics By Domain Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
GaSelectionRequest:
properties:
property_id:
type: string
maxLength: 64
minLength: 1
title: Property Id
data_stream_id:
type: string
maxLength: 64
minLength: 1
title: Data Stream Id
confirm_mismatch:
type: boolean
title: Confirm Mismatch
default: false
type: object
required:
- property_id
- data_stream_id
title: GaSelectionRequest
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
securitySchemes:
APIKeyHeader:
type: apiKey
in: header
name: X-Agent-Key