Google Tag Manager API

The Tag Manager API allows clients to access and modify container and tag configuration.

Documentation

Specifications

SDKs

Schemas & Data

Other Resources

OpenAPI Specification

google-tag-manager-api-v2-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Tag Manager API
  description: >-
    The Google Tag Manager API v2 allows clients to access and modify Google Tag
    Manager account, container, workspace, tag, trigger, and variable
    configurations. It provides programmatic management of tag deployment,
    trigger conditions, and variable definitions across web, mobile, and
    server-side containers.
  version: 2.0.0
  termsOfService: https://policies.google.com/terms
  contact:
    name: Google Support
    url: https://support.google.com/tagmanager
  license:
    name: Google APIs Terms of Service
    url: https://developers.google.com/terms
externalDocs:
  description: Google Tag Manager API Documentation
  url: https://developers.google.com/tag-platform/tag-manager/api/v2
servers:
- url: https://tagmanager.googleapis.com
  description: Google Tag Manager API Production Server
security:
- oauth2:
  - tagmanager.readonly
  - tagmanager.edit.containers
  - tagmanager.manage.accounts
  - tagmanager.manage.users
  - tagmanager.publish
  - tagmanager.edit.containerversions
  - tagmanager.delete.containers
tags:
- name: Accounts
  description: Operations for managing Google Tag Manager accounts.
- name: Containers
  description: >-
    Operations for managing containers within a Google Tag Manager account.
- name: Triggers
  description: >-
    Operations for managing triggers within a workspace that control when tags
    fire.
- name: User Permissions
  description: >-
    Operations for managing user permissions on Google Tag Manager accounts.
- name: Variables
  description: >-
    Operations for managing variables within a workspace that provide dynamic
    values to tags and triggers.
- name: Versions
  description: >-
    Operations for managing container versions, including publishing and
    rollback.
- name: Workspaces
  description: >-
    Operations for managing workspaces within a container, including version
    creation and conflict resolution.
paths:
  /tagmanager/v2/accounts:
    get:
      operationId: listAccounts
      summary: List All Google Tag Manager Accounts
      description: >-
        Lists all GTM Accounts that a user has access to. Returns a list of
        Account resources.
      tags:
      - Accounts
      parameters:
      - name: pageToken
        in: query
        description: Continuation token for fetching the next page of results.
        schema:
          type: string
        example: example_value
      - name: includeGoogleTags
        in: query
        description: >-
          Also retrieve accounts associated with Google Tag when true.
        schema:
          type: boolean
        example: true
      responses:
        '200':
          description: Successful response containing a list of accounts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAccountsResponse'
              examples:
                Listaccounts200Example:
                  summary: Default listAccounts 200 response
                  x-microcks-default: true
                  value:
                    account:
                    - path: example_value
                      accountId: '500123'
                      name: Example Title
                      shareData: true
                      fingerprint: example_value
                      tagManagerUrl: https://www.example.com
                    nextPageToken: example_value
        '401':
          description: Authentication required.
        '403':
          description: Insufficient permissions.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{path}:
    get:
      operationId: getAccount
      summary: Get a Google Tag Manager Account
      description: Gets a GTM Account by its resource path.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/pathParam'
      responses:
        '200':
          description: Successful response containing the account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
              examples:
                Getaccount200Example:
                  summary: Default getAccount 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    name: Example Title
                    shareData: true
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
                    features:
                      supportUserPermissions: true
                      supportMultipleContainers: true
        '404':
          description: Account not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: updateAccount
      summary: Update a Google Tag Manager Account
      description: Updates a GTM Account.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/pathParam'
      - name: fingerprint
        in: query
        description: >-
          When provided, this fingerprint must match the fingerprint of the
          account in storage.
        schema:
          type: string
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Account'
            examples:
              UpdateaccountRequestExample:
                summary: Default updateAccount request
                x-microcks-default: true
                value:
                  path: example_value
                  accountId: '500123'
                  name: Example Title
                  shareData: true
                  fingerprint: example_value
                  tagManagerUrl: https://www.example.com
                  features:
                    supportUserPermissions: true
                    supportMultipleContainers: true
      responses:
        '200':
          description: Successful response containing the updated account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
              examples:
                Updateaccount200Example:
                  summary: Default updateAccount 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    name: Example Title
                    shareData: true
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
                    features:
                      supportUserPermissions: true
                      supportMultipleContainers: true
        '400':
          description: Invalid request.
        '409':
          description: Fingerprint mismatch indicating a conflict.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{parent}/containers:
    get:
      operationId: listContainers
      summary: Google Tag Manager List Containers in an Account
      description: Lists all Containers that belongs to a GTM Account.
      tags:
      - Containers
      parameters:
      - $ref: '#/components/parameters/parentParam'
      - name: pageToken
        in: query
        description: Continuation token for fetching the next page of results.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing a list of containers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListContainersResponse'
              examples:
                Listcontainers200Example:
                  summary: Default listContainers 200 response
                  x-microcks-default: true
                  value:
                    container:
                    - path: example_value
                      accountId: '500123'
                      containerId: '500123'
                      name: Example Title
                      domainName: {}
                      publicId: '500123'
                      tagIds: {}
                      notes: example_value
                      usageContext: {}
                      fingerprint: example_value
                      tagManagerUrl: https://www.example.com
                      taggingServerUrls: {}
                    nextPageToken: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createContainer
      summary: Google Tag Manager Create a Container
      description: Creates a Container within a GTM Account.
      tags:
      - Containers
      parameters:
      - $ref: '#/components/parameters/parentParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Container'
            examples:
              CreatecontainerRequestExample:
                summary: Default createContainer request
                x-microcks-default: true
                value:
                  path: example_value
                  accountId: '500123'
                  containerId: '500123'
                  name: Example Title
                  domainName:
                  - example_value
                  publicId: '500123'
                  tagIds:
                  - example_value
                  notes: example_value
                  usageContext:
                  - usageContextUnspecified
                  fingerprint: example_value
                  tagManagerUrl: https://www.example.com
                  taggingServerUrls:
                  - https://www.example.com
                  features:
                    supportUserPermissions: true
                    supportEnvironments: true
                    supportWorkspaces: true
                    supportGtagConfigs: true
                    supportBuiltInVariables: true
                    supportClients: true
                    supportFolders: true
                    supportTags: true
                    supportTemplates: true
                    supportTriggers: true
                    supportVariables: true
                    supportVersions: true
                    supportZones: true
                    supportTransformations: true
      responses:
        '200':
          description: Successful response containing the created container.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Container'
              examples:
                Createcontainer200Example:
                  summary: Default createContainer 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    name: Example Title
                    domainName:
                    - example_value
                    publicId: '500123'
                    tagIds:
                    - example_value
                    notes: example_value
                    usageContext:
                    - usageContextUnspecified
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
                    taggingServerUrls:
                    - https://www.example.com
                    features:
                      supportUserPermissions: true
                      supportEnvironments: true
                      supportWorkspaces: true
                      supportGtagConfigs: true
                      supportBuiltInVariables: true
                      supportClients: true
                      supportFolders: true
                      supportTags: true
                      supportTemplates: true
                      supportTriggers: true
                      supportVariables: true
                      supportVersions: true
                      supportZones: true
                      supportTransformations: true
        '400':
          description: Invalid request.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{containerPath}:
    get:
      operationId: getContainer
      summary: Google Tag Manager Get a Container
      description: Gets a Container by its resource path.
      tags:
      - Containers
      parameters:
      - name: containerPath
        in: path
        required: true
        description: >-
          GTM Container's API relative path, e.g.
          accounts/{accountId}/containers/{containerId}.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing the container.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Container'
              examples:
                Getcontainer200Example:
                  summary: Default getContainer 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    name: Example Title
                    domainName:
                    - example_value
                    publicId: '500123'
                    tagIds:
                    - example_value
                    notes: example_value
                    usageContext:
                    - usageContextUnspecified
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
                    taggingServerUrls:
                    - https://www.example.com
                    features:
                      supportUserPermissions: true
                      supportEnvironments: true
                      supportWorkspaces: true
                      supportGtagConfigs: true
                      supportBuiltInVariables: true
                      supportClients: true
                      supportFolders: true
                      supportTags: true
                      supportTemplates: true
                      supportTriggers: true
                      supportVariables: true
                      supportVersions: true
                      supportZones: true
                      supportTransformations: true
        '404':
          description: Container not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: updateContainer
      summary: Google Tag Manager Update a Container
      description: Updates a Container.
      tags:
      - Containers
      parameters:
      - name: containerPath
        in: path
        required: true
        description: >-
          GTM Container's API relative path.
        schema:
          type: string
        example: example_value
      - name: fingerprint
        in: query
        description: >-
          When provided, this fingerprint must match the fingerprint of the
          container in storage.
        schema:
          type: string
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Container'
            examples:
              UpdatecontainerRequestExample:
                summary: Default updateContainer request
                x-microcks-default: true
                value:
                  path: example_value
                  accountId: '500123'
                  containerId: '500123'
                  name: Example Title
                  domainName:
                  - example_value
                  publicId: '500123'
                  tagIds:
                  - example_value
                  notes: example_value
                  usageContext:
                  - usageContextUnspecified
                  fingerprint: example_value
                  tagManagerUrl: https://www.example.com
                  taggingServerUrls:
                  - https://www.example.com
                  features:
                    supportUserPermissions: true
                    supportEnvironments: true
                    supportWorkspaces: true
                    supportGtagConfigs: true
                    supportBuiltInVariables: true
                    supportClients: true
                    supportFolders: true
                    supportTags: true
                    supportTemplates: true
                    supportTriggers: true
                    supportVariables: true
                    supportVersions: true
                    supportZones: true
                    supportTransformations: true
      responses:
        '200':
          description: Successful response containing the updated container.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Container'
              examples:
                Updatecontainer200Example:
                  summary: Default updateContainer 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    name: Example Title
                    domainName:
                    - example_value
                    publicId: '500123'
                    tagIds:
                    - example_value
                    notes: example_value
                    usageContext:
                    - usageContextUnspecified
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
                    taggingServerUrls:
                    - https://www.example.com
                    features:
                      supportUserPermissions: true
                      supportEnvironments: true
                      supportWorkspaces: true
                      supportGtagConfigs: true
                      supportBuiltInVariables: true
                      supportClients: true
                      supportFolders: true
                      supportTags: true
                      supportTemplates: true
                      supportTriggers: true
                      supportVariables: true
                      supportVersions: true
                      supportZones: true
                      supportTransformations: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deleteContainer
      summary: Google Tag Manager Delete a Container
      description: Deletes a Container.
      tags:
      - Containers
      parameters:
      - name: containerPath
        in: path
        required: true
        description: >-
          GTM Container's API relative path.
        schema:
          type: string
        example: example_value
      responses:
        '204':
          description: Container successfully deleted.
        '404':
          description: Container not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{parent}/workspaces:
    get:
      operationId: listWorkspaces
      summary: Google Tag Manager List Workspaces in a Container
      description: Lists all Workspaces that belong to a GTM Container.
      tags:
      - Workspaces
      parameters:
      - $ref: '#/components/parameters/parentParam'
      - name: pageToken
        in: query
        description: Continuation token for fetching the next page of results.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing a list of workspaces.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListWorkspacesResponse'
              examples:
                Listworkspaces200Example:
                  summary: Default listWorkspaces 200 response
                  x-microcks-default: true
                  value:
                    workspace:
                    - path: example_value
                      accountId: '500123'
                      containerId: '500123'
                      workspaceId: '500123'
                      name: Example Title
                      description: A sample description.
                      fingerprint: example_value
                      tagManagerUrl: https://www.example.com
                    nextPageToken: example_value
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createWorkspace
      summary: Google Tag Manager Create a Workspace
      description: Creates a Workspace within a GTM Container.
      tags:
      - Workspaces
      parameters:
      - $ref: '#/components/parameters/parentParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Workspace'
            examples:
              CreateworkspaceRequestExample:
                summary: Default createWorkspace request
                x-microcks-default: true
                value:
                  path: example_value
                  accountId: '500123'
                  containerId: '500123'
                  workspaceId: '500123'
                  name: Example Title
                  description: A sample description.
                  fingerprint: example_value
                  tagManagerUrl: https://www.example.com
      responses:
        '200':
          description: Successful response containing the created workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
              examples:
                Createworkspace200Example:
                  summary: Default createWorkspace 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    workspaceId: '500123'
                    name: Example Title
                    description: A sample description.
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{workspacePath}:
    get:
      operationId: getWorkspace
      summary: Google Tag Manager Get a Workspace
      description: Gets a Workspace by its resource path.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: >-
          GTM Workspace's API relative path, e.g.
          accounts/{accountId}/containers/{containerId}/workspaces/{workspaceId}.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing the workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
              examples:
                Getworkspace200Example:
                  summary: Default getWorkspace 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    workspaceId: '500123'
                    name: Example Title
                    description: A sample description.
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: updateWorkspace
      summary: Google Tag Manager Update a Workspace
      description: Updates a Workspace.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: >-
          GTM Workspace's API relative path.
        schema:
          type: string
        example: example_value
      - name: fingerprint
        in: query
        description: >-
          When provided, this fingerprint must match the fingerprint of the
          workspace in storage.
        schema:
          type: string
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Workspace'
            examples:
              UpdateworkspaceRequestExample:
                summary: Default updateWorkspace request
                x-microcks-default: true
                value:
                  path: example_value
                  accountId: '500123'
                  containerId: '500123'
                  workspaceId: '500123'
                  name: Example Title
                  description: A sample description.
                  fingerprint: example_value
                  tagManagerUrl: https://www.example.com
      responses:
        '200':
          description: Successful response containing the updated workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workspace'
              examples:
                Updateworkspace200Example:
                  summary: Default updateWorkspace 200 response
                  x-microcks-default: true
                  value:
                    path: example_value
                    accountId: '500123'
                    containerId: '500123'
                    workspaceId: '500123'
                    name: Example Title
                    description: A sample description.
                    fingerprint: example_value
                    tagManagerUrl: https://www.example.com
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deleteWorkspace
      summary: Google Tag Manager Delete a Workspace
      description: Deletes a Workspace.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: >-
          GTM Workspace's API relative path.
        schema:
          type: string
        example: example_value
      responses:
        '204':
          description: Workspace successfully deleted.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{workspacePath}:create_version:
    post:
      operationId: createWorkspaceVersion
      summary: Google Tag Manager Create a Container Version From a Workspace
      description: >-
        Creates a Container Version from the entities present in the workspace,
        deletes the workspace, and sets the base container version to the newly
        created version.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: GTM Workspace's API relative path.
        schema:
          type: string
        example: example_value
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContainerVersionRequestVersionOptions'
            examples:
              CreateworkspaceversionRequestExample:
                summary: Default createWorkspaceVersion request
                x-microcks-default: true
                value:
                  name: Example Title
                  notes: example_value
      responses:
        '200':
          description: >-
            Successful response containing the created container version.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateContainerVersionResponse'
              examples:
                Createworkspaceversion200Example:
                  summary: Default createWorkspaceVersion 200 response
                  x-microcks-default: true
                  value:
                    containerVersion:
                      path: example_value
                      accountId: '500123'
                      containerId: '500123'
                      containerVersionId: '500123'
                      name: Example Title
                      description: A sample description.
                      tag:
                      - {}
                      trigger:
                      - {}
                      variable:
                      - {}
                      fingerprint: example_value
                      tagManagerUrl: https://www.example.com
                      deleted: true
                    newWorkspacePath: example_value
                    compilerError: true
                    syncStatus:
                      mergeConflict: true
                      syncError: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{workspacePath}/status:
    get:
      operationId: getWorkspaceStatus
      summary: Google Tag Manager Get the Status of a Workspace
      description: >-
        Finds conflicting and modified entities in the workspace. Returns status
        information about the workspace including workspace changes and
        conflicts.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: GTM Workspace's API relative path.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing workspace status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetWorkspaceStatusResponse'
              examples:
                Getworkspacestatus200Example:
                  summary: Default getWorkspaceStatus 200 response
                  x-microcks-default: true
                  value:
                    workspaceChange:
                    - changeStatus: changeStatusUnspecified
                    mergeConflict:
                    - {}
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{workspacePath}:sync:
    post:
      operationId: syncWorkspace
      summary: Google Tag Manager Sync a Workspace to the Latest Container Version
      description: >-
        Syncs a workspace to the latest container version by updating all
        unmodified workspace entities and displaying conflicts for modified
        entities.
      tags:
      - Workspaces
      parameters:
      - name: workspacePath
        in: path
        required: true
        description: GTM Workspace's API relative path.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing the sync status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncWorkspaceResponse'
              examples:
                Syncworkspace200Example:
                  summary: Default syncWorkspace 200 response
                  x-microcks-default: true
                  value:
                    mergeConflict:
                    - {}
                    syncStatus:
                      mergeConflict: true
                      syncError: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /tagmanager/v2/{parent}/tags:
    get:
      operationId: listTags
      summary: Google Tag Manager List Tags in a Workspace
      description: Lists all GTM Tags of a GTM Container Workspace.
      tags: []
      parameters:
      - $ref: '#/components/parameters/parentParam'
      - name: pageToken
        in: query
        description: Continuation token for fetching the next page of results.
        schema:
          type: string
        example: example_value
      responses:
        '200':
          description: Successful response containing a list of tags.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTagsResponse'
             

# --- truncated at 32 KB (162 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/google-tag-manager/refs/heads/main/openapi/google-tag-manager-api-v2-openapi.yml