Google Analytics Validation API

The Validation API from Google Analytics — 1 operation(s) for validation.

Operations 1

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /collect/debug Validate events without recording them · Google Analytics Validate Events Without Sending to Google Analytics #
Ask an LLM
“Can I test my Measurement Protocol payload without the events showing up in reports?”
“What validation messages come back when an event payload is malformed?”
Tell an agent
Check events {events} for measurement ID {measurement_id} against the debug endpoint without sending them.
Validate app events {events} for Firebase app {firebase_app_id} using strictness {validation_behavior}.

Documentation

📖
Documentation
https://developers.google.com/analytics/devguides/reporting/data/v1
📖
APIReference
https://developers.google.com/analytics/devguides/reporting/data/v1/rest
📖
GettingStarted
https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart
📖
Authentication
https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries
📖
RateLimits
https://developers.google.com/analytics/devguides/reporting/data/v1/quotas
📖
Documentation
https://developers.google.com/analytics/devguides/config/admin/v1
📖
APIReference
https://developers.google.com/analytics/devguides/config/admin/v1/rest
📖
GettingStarted
https://developers.google.com/analytics/devguides/config/admin/v1/quickstart
📖
Documentation
https://developers.google.com/analytics/devguides/collection/protocol/ga4
📖
APIReference
https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference
📖
GettingStarted
https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events
📖
Troubleshooting
https://developers.google.com/analytics/devguides/collection/protocol/ga4/troubleshooting
📖
Documentation
https://developers.google.com/analytics/devguides/config/userdeletion/v3
📖
APIReference
https://developers.google.com/analytics/devguides/config/userdeletion/v3/reference
📖
Authentication
https://developers.google.com/analytics/devguides/config/userdeletion/v3/authorization
📖
Documentation
https://developers.google.com/analytics/devguides/reporting/core/v4
📖
GettingStarted
https://developers.google.com/analytics/devguides/migration/api/reporting-ua-to-ga4
📖
Documentation
https://developers.google.com/analytics/devguides/config/mgmt/v3
📖
APIReference
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference

Specifications

Code Examples

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/google-analytics:google-analytics-validation-api"
All apis
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.

Get an API 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. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

google-analytics-validation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Google Analytics Measurement Protocol (GA4) Validation API
  description: The Google Analytics Measurement Protocol lets you send events directly to Google Analytics servers via HTTP requests to augment existing GA4 data with server-to-server and offline interactions.
  version: '1.0'
  contact:
    name: Google Analytics
    url: https://developers.google.com/analytics
  license:
    name: Google APIs Terms of Service
    url: https://developers.google.com/analytics/terms
  x-logo:
    url: https://www.google.com/analytics/images/google-analytics-logo.png
servers:
- url: https://www.google-analytics.com/mp
  description: Global endpoint
- url: https://region1.google-analytics.com/mp
  description: EU endpoint
tags:
- name: Validation
paths:
  /collect/debug:
    post:
      operationId: validateEvents
      summary: Google Analytics Validate Events Without Sending to Google Analytics
      description: Validates the event payload and returns validation messages without actually sending the events to Google Analytics. Use this endpoint during development to verify your implementation.
      parameters:
      - name: api_secret
        in: query
        required: true
        description: The API Secret generated in the Google Analytics UI.
        schema:
          type: string
        example: secret_abc123
      - name: measurement_id
        in: query
        required: false
        description: The Measurement ID for a web data stream. Required for web streams.
        schema:
          type: string
        example: '123456'
      - name: firebase_app_id
        in: query
        required: false
        description: The Firebase App ID for an app data stream. Required for app streams.
        schema:
          type: string
        example: '123456'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MeasurementPayload'
      responses:
        '200':
          description: Validation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResponse'
      tags:
      - Validation
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    MeasurementPayload:
      type: object
      required:
      - events
      properties:
        client_id:
          type: string
          description: Uniquely identifies a user instance of a web client. Required for web streams.
          example: '123456789.1234567890'
        app_instance_id:
          type: string
          description: Uniquely identifies a user instance of an app. Required for app streams.
          example: '123456'
        user_id:
          type: string
          description: A unique identifier for a user. Enables cross-platform analysis. Must contain only UTF-8 characters.
          example: '123456'
        timestamp_micros:
          type: integer
          format: int64
          description: Unix timestamp in microseconds for the request. Used to backdate events up to 72 hours.
          example: 1713355200000000
        user_properties:
          type: object
          description: User-scoped properties for the measurement.
          additionalProperties:
            $ref: '#/components/schemas/UserPropertyValue'
        user_data:
          type: object
          description: User-provided data for enhanced measurement.
        consent:
          $ref: '#/components/schemas/Consent'
        non_personalized_ads:
          type: boolean
          description: Deprecated. Use consent.ad_personalization instead.
          deprecated: true
          example: true
        user_location:
          $ref: '#/components/schemas/UserLocation'
        ip_override:
          type: string
          description: IP address used to derive geographic information.
          example: '123456'
        device:
          $ref: '#/components/schemas/Device'
        validation_behavior:
          type: string
          description: Controls validation strictness. RELAXED only rejects malformed requests. ENFORCE_RECOMMENDATIONS also rejects invalid types and exceeded limits.
          enum:
          - RELAXED
          - ENFORCE_RECOMMENDATIONS
          default: RELAXED
          example: RELAXED
        events:
          type: array
          description: Array of event objects. Maximum 25 events per request.
          maxItems: 25
          items:
            $ref: '#/components/schemas/Event'
    Consent:
      type: object
      properties:
        ad_user_data:
          type: string
          description: Consent for using user data in advertising.
          enum:
          - GRANTED
          - DENIED
          example: GRANTED
        ad_personalization:
          type: string
          description: Consent for ad personalization.
          enum:
          - GRANTED
          - DENIED
          example: GRANTED
    Event:
      type: object
      required:
      - name
      properties:
        name:
          type: string
          description: The name of the event. Must not use reserved names (ad_click, app_exception, error, session_start, etc.) or reserved prefixes (_, firebase_, ga_, google_, gtag.).
          example: Example Name
        params:
          type: object
          description: Event parameters as key-value pairs. Common parameters include session_id, engagement_time_msec, and timestamp_micros.
          additionalProperties: true
          properties:
            session_id:
              type: string
              description: Session identifier for accurate session metrics.
            engagement_time_msec:
              type: integer
              description: User engagement duration in milliseconds.
            timestamp_micros:
              type: integer
              format: int64
              description: Unix epoch time in microseconds to override event timestamp.
    ValidationMessage:
      type: object
      properties:
        fieldPath:
          type: string
          description: Path to the field that caused the validation error.
          example: /example/path
        description:
          type: string
          description: Description of the validation error.
          example: Example description
        validationCode:
          type: string
          description: A code identifying the type of validation error.
          enum:
          - VALUE_INVALID
          - VALUE_REQUIRED
          - NAME_INVALID
          - NAME_RESERVED
          - VALUE_OUT_OF_BOUNDS
          - EXCEEDED_MAX_ENTITIES
          - NAME_DUPLICATED
          example: VALUE_INVALID
    UserPropertyValue:
      type: object
      properties:
        value:
          oneOf:
          - type: string
          - type: number
          - type: boolean
          description: The value of the user property.
          example: example_value
    Device:
      type: object
      properties:
        category:
          type: string
          description: Device category (e.g., mobile, tablet, desktop).
          example: example_value
        language:
          type: string
          description: Device language setting.
          example: example_value
        screen_resolution:
          type: string
          description: Screen resolution (e.g., 1920x1080).
          example: example_value
        operating_system:
          type: string
          description: Operating system name.
          example: example_value
        operating_system_version:
          type: string
          description: Operating system version.
          example: example_value
        model:
          type: string
          description: Device model.
          example: example_value
        brand:
          type: string
          description: Device brand.
          example: example_value
        browser:
          type: string
          description: Browser name.
          example: example_value
        browser_version:
          type: string
          description: Browser version.
          example: example_value
    ValidationResponse:
      type: object
      properties:
        validationMessages:
          type: array
          items:
            $ref: '#/components/schemas/ValidationMessage'
    UserLocation:
      type: object
      properties:
        city:
          type: string
          description: City name.
          example: example_value
        region_id:
          type: string
          description: Region identifier.
          example: '123456'
        country_id:
          type: string
          description: Country identifier.
          example: '123456'
        subcontinent_id:
          type: string
          description: Subcontinent identifier.
          example: '123456'
        continent_id:
          type: string
          description: Continent identifier.
          example: '123456'
externalDocs:
  description: Measurement Protocol documentation
  url: https://developers.google.com/analytics/devguides/collection/protocol/ga4