openapi: 3.1.0
info:
title: Google Tag Manager Accounts Versions 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
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: Versions
description: Operations for managing container versions, including publishing and rollback.
paths:
/tagmanager/v2/{parent}/versions:
get:
operationId: listContainerVersionHeaders
summary: Google Tag Manager List All Container Version Headers
description: Lists all Container Version Headers of a GTM Container, providing summary information about each version.
tags:
- Versions
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
- name: includeDeleted
in: query
description: Also retrieve deleted (archived) versions when true.
schema:
type: boolean
example: true
responses:
'200':
description: Successful response containing a list of container version headers.
content:
application/json:
schema:
$ref: '#/components/schemas/ListContainerVersionsResponse'
examples:
Listcontainerversionheaders200Example:
summary: Default listContainerVersionHeaders 200 response
x-microcks-default: true
value:
containerVersionHeader:
- path: example_value
accountId: '500123'
containerId: '500123'
containerVersionId: '500123'
name: Example Title
numTags: example_value
numTriggers: example_value
numVariables: example_value
deleted: true
nextPageToken: example_value
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/tagmanager/v2/{versionPath}:
get:
operationId: getContainerVersion
summary: Google Tag Manager Get a Container Version
description: Gets a Container Version by its resource path.
tags:
- Versions
parameters:
- name: versionPath
in: path
required: true
description: GTM ContainerVersion's API relative path.
schema:
type: string
example: example_value
responses:
'200':
description: Successful response containing the container version.
content:
application/json:
schema:
$ref: '#/components/schemas/ContainerVersion'
examples:
Getcontainerversion200Example:
summary: Default getContainerVersion 200 response
x-microcks-default: true
value:
path: example_value
accountId: '500123'
containerId: '500123'
containerVersionId: '500123'
name: Example Title
description: A sample description.
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:
- {}
tag:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
tagId: '500123'
name: Example Title
type: example_value
liveOnly: true
notes: example_value
scheduleStartMs: example_value
scheduleEndMs: example_value
parameter: {}
fingerprint: example_value
firingTriggerId: {}
blockingTriggerId: {}
setupTag: {}
teardownTag: {}
parentFolderId: '500123'
tagFiringOption: tagFiringOptionUnspecified
tagManagerUrl: https://www.example.com
paused: true
monitoringMetadataTagNameKey: example_value
trigger:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
triggerId: '500123'
name: Example Title
type: eventTypeUnspecified
customEventFilter: {}
filter: {}
autoEventFilter: {}
fingerprint: example_value
parentFolderId: '500123'
tagManagerUrl: https://www.example.com
notes: example_value
parameter: {}
variable:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
variableId: '500123'
name: Example Title
type: example_value
notes: example_value
scheduleStartMs: example_value
scheduleEndMs: example_value
parameter: {}
enablingTriggerId: {}
disablingTriggerId: {}
fingerprint: example_value
parentFolderId: '500123'
tagManagerUrl: https://www.example.com
fingerprint: example_value
tagManagerUrl: https://www.example.com
deleted: true
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
operationId: deleteContainerVersion
summary: Google Tag Manager Delete a Container Version
description: Deletes a Container Version.
tags:
- Versions
parameters:
- name: versionPath
in: path
required: true
description: GTM ContainerVersion's API relative path.
schema:
type: string
example: example_value
responses:
'204':
description: Container version successfully deleted.
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/tagmanager/v2/{versionPath}:publish:
post:
operationId: publishContainerVersion
summary: Google Tag Manager Publish a Container Version
description: Publishes a Container Version, making it the live version served to users.
tags:
- Versions
parameters:
- name: versionPath
in: path
required: true
description: GTM ContainerVersion'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 version in storage.
schema:
type: string
example: example_value
responses:
'200':
description: Successful response containing the published container version.
content:
application/json:
schema:
$ref: '#/components/schemas/PublishContainerVersionResponse'
examples:
Publishcontainerversion200Example:
summary: Default publishContainerVersion 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
compilerError: true
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/tagmanager/v2/{parent}/versions:live:
get:
operationId: getLiveContainerVersion
summary: Google Tag Manager Get the Live Container Version
description: Gets the live (published) container version for a GTM Container.
tags:
- Versions
parameters:
- $ref: '#/components/parameters/parentParam'
responses:
'200':
description: Successful response containing the live container version.
content:
application/json:
schema:
$ref: '#/components/schemas/ContainerVersion'
examples:
Getlivecontainerversion200Example:
summary: Default getLiveContainerVersion 200 response
x-microcks-default: true
value:
path: example_value
accountId: '500123'
containerId: '500123'
containerVersionId: '500123'
name: Example Title
description: A sample description.
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:
- {}
tag:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
tagId: '500123'
name: Example Title
type: example_value
liveOnly: true
notes: example_value
scheduleStartMs: example_value
scheduleEndMs: example_value
parameter: {}
fingerprint: example_value
firingTriggerId: {}
blockingTriggerId: {}
setupTag: {}
teardownTag: {}
parentFolderId: '500123'
tagFiringOption: tagFiringOptionUnspecified
tagManagerUrl: https://www.example.com
paused: true
monitoringMetadataTagNameKey: example_value
trigger:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
triggerId: '500123'
name: Example Title
type: eventTypeUnspecified
customEventFilter: {}
filter: {}
autoEventFilter: {}
fingerprint: example_value
parentFolderId: '500123'
tagManagerUrl: https://www.example.com
notes: example_value
parameter: {}
variable:
- path: example_value
accountId: '500123'
containerId: '500123'
workspaceId: '500123'
variableId: '500123'
name: Example Title
type: example_value
notes: example_value
scheduleStartMs: example_value
scheduleEndMs: example_value
parameter: {}
enablingTriggerId: {}
disablingTriggerId: {}
fingerprint: example_value
parentFolderId: '500123'
tagManagerUrl: https://www.example.com
fingerprint: example_value
tagManagerUrl: https://www.example.com
deleted: true
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
components:
schemas:
PublishContainerVersionResponse:
type: object
description: Publish container version response.
properties:
containerVersion:
$ref: '#/components/schemas/ContainerVersion'
compilerError:
type: boolean
description: Compiler errors or not. True indicates that there were compiler errors.
example: true
ConsentSettings:
type: object
description: Tag consent settings.
properties:
consentStatus:
type: string
description: The tag's consent status.
enum:
- notSet
- notNeeded
- needed
example: notSet
consentType:
$ref: '#/components/schemas/Parameter'
Condition:
type: object
description: Represents a predicate that is evaluated against a data layer value or variable. Used in trigger filter conditions.
properties:
type:
type: string
description: The type of operator for this condition.
enum:
- conditionTypeUnspecified
- equals
- contains
- startsWith
- endsWith
- matchRegex
- greater
- greaterOrEquals
- less
- lessOrEquals
- cssSelector
- urlMatches
example: conditionTypeUnspecified
parameter:
type: array
description: A list of named parameters (key/value), depending on the condition's type. The first parameter is the left-hand operand, the second is the right-hand operand.
items:
$ref: '#/components/schemas/Parameter'
example: []
FormatValue:
type: object
description: Option to convert a variable value to another value.
properties:
caseConversionType:
type: string
description: The option to convert a string-type variable value to either lowercase or uppercase.
enum:
- none
- lowercase
- uppercase
example: none
convertNullToValue:
$ref: '#/components/schemas/Parameter'
convertUndefinedToValue:
$ref: '#/components/schemas/Parameter'
convertTrueToValue:
$ref: '#/components/schemas/Parameter'
convertFalseToValue:
$ref: '#/components/schemas/Parameter'
ContainerVersion:
type: object
description: Represents a version of a Google Tag Manager Container. A container version is a snapshot of all tags, triggers, variables, and configuration at a point in time.
properties:
path:
type: string
description: GTM ContainerVersion's API relative path.
readOnly: true
example: example_value
accountId:
type: string
description: GTM Account ID.
readOnly: true
example: '500123'
containerId:
type: string
description: GTM Container ID.
readOnly: true
example: '500123'
containerVersionId:
type: string
description: The Container Version ID uniquely identifies the GTM Container Version.
readOnly: true
example: '500123'
name:
type: string
description: Container version display name.
example: Example Title
description:
type: string
description: Container version description.
example: A sample description.
container:
$ref: '#/components/schemas/Container'
tag:
type: array
description: The tags in the container that this version was taken from.
items:
$ref: '#/components/schemas/Tag'
example: []
trigger:
type: array
description: The triggers in the container that this version was taken from.
items:
$ref: '#/components/schemas/Trigger'
example: []
variable:
type: array
description: The variables in the container that this version was taken from.
items:
$ref: '#/components/schemas/Variable'
example: []
fingerprint:
type: string
description: The fingerprint of the GTM Container Version as computed at storage time.
readOnly: true
example: example_value
tagManagerUrl:
type: string
format: uri
description: Auto-generated link to the tag manager UI.
readOnly: true
example: https://www.example.com
deleted:
type: boolean
description: A value of true indicates this version has been deleted.
readOnly: true
example: true
ListContainerVersionsResponse:
type: object
description: List Container Versions Response.
properties:
containerVersionHeader:
type: array
description: All container version headers of a GTM Container.
items:
$ref: '#/components/schemas/ContainerVersionHeader'
example: []
nextPageToken:
type: string
description: Continuation token for fetching the next page of results.
example: example_value
ContainerVersionHeader:
type: object
description: Represents a summary of a container version, without the full tag, trigger, and variable details.
properties:
path:
type: string
description: GTM Container Version's API relative path.
readOnly: true
example: example_value
accountId:
type: string
readOnly: true
example: '500123'
containerId:
type: string
readOnly: true
example: '500123'
containerVersionId:
type: string
readOnly: true
example: '500123'
name:
type: string
description: Container version display name.
example: Example Title
numTags:
type: string
description: Number of tags in the container version.
example: example_value
numTriggers:
type: string
description: Number of triggers in the container version.
example: example_value
numVariables:
type: string
description: Number of variables in the container version.
example: example_value
deleted:
type: boolean
readOnly: true
example: true
ContainerFeatures:
type: object
description: Read-only container feature set.
properties:
supportUserPermissions:
type: boolean
readOnly: true
example: true
supportEnvironments:
type: boolean
readOnly: true
example: true
supportWorkspaces:
type: boolean
readOnly: true
example: true
supportGtagConfigs:
type: boolean
readOnly: true
example: true
supportBuiltInVariables:
type: boolean
readOnly: true
example: true
supportClients:
type: boolean
readOnly: true
example: true
supportFolders:
type: boolean
readOnly: true
example: true
supportTags:
type: boolean
readOnly: true
example: true
supportTemplates:
type: boolean
readOnly: true
example: true
supportTriggers:
type: boolean
readOnly: true
example: true
supportVariables:
type: boolean
readOnly: true
example: true
supportVersions:
type: boolean
readOnly: true
example: true
supportZones:
type: boolean
readOnly: true
example: true
supportTransformations:
type: boolean
readOnly: true
example: true
SetupTag:
type: object
description: Represents a setup tag relationship. A setup tag fires before the main tag.
properties:
tagName:
type: string
description: The name of the setup tag.
example: example_value
stopOnSetupFailure:
type: boolean
description: If true, fire the main tag only if the setup tag fires successfully. If false, fire the main tag regardless of setup tag firing status.
example: true
Tag:
type: object
description: Represents a Google Tag Manager Tag. A tag is a snippet of code that executes on a page when certain conditions (triggers) are met.
properties:
path:
type: string
description: GTM Tag's API relative path.
readOnly: true
example: example_value
accountId:
type: string
description: GTM Account ID.
readOnly: true
example: '500123'
containerId:
type: string
description: GTM Container ID.
readOnly: true
example: '500123'
workspaceId:
type: string
description: GTM Workspace ID.
readOnly: true
example: '500123'
tagId:
type: string
description: The Tag ID uniquely identifies the GTM Tag.
readOnly: true
example: '500123'
name:
type: string
description: Tag display name.
example: Example Title
type:
type: string
description: GTM Tag Type. Common types include ua (Universal Analytics), gaawc (Google Analytics GA4 Configuration), gaawe (Google Analytics GA4 Event), awct (Google Ads Conversion Tracking), sp (Custom Script), html (Custom HTML), img (Custom Image), and flc (Floodlight Counter).
example: example_value
liveOnly:
type: boolean
description: If set to true, this tag will only fire in the live environment (not in preview or debug mode).
example: true
priority:
$ref: '#/components/schemas/Parameter'
notes:
type: string
description: User notes on how to apply this tag in the container.
example: example_value
scheduleStartMs:
type: string
format: int64
description: The start timestamp in milliseconds to schedule a tag. The tag will only fire after this time.
example: example_value
scheduleEndMs:
type: string
format: int64
description: The end timestamp in milliseconds to schedule a tag. The tag will stop firing after this time.
example: example_value
parameter:
type: array
description: The tag's parameters, which configure its behavior.
items:
$ref: '#/components/schemas/Parameter'
example: []
fingerprint:
type: string
description: The fingerprint of the GTM Tag as computed at storage time. This value is recomputed whenever the tag is modified.
readOnly: true
example: example_value
firingTriggerId:
type: array
description: Firing trigger IDs. A tag will fire when any of the listed triggers are true and all of its blockingTriggerIds (if any specified) are false.
items:
type: string
example: '500123'
blockingTriggerId:
type: array
description: Blocking trigger IDs. If any of the listed triggers evaluates to true, the tag will not fire.
items:
type: string
example: '500123'
setupTag:
type: array
description: The list of setup tags. Currently, only one setup tag is allowed per tag.
items:
$ref: '#/components/schemas/SetupTag'
example: []
teardownTag:
type: array
description: The list of teardown tags. Currently, only one teardown tag is allowed per tag.
items:
$ref: '#/components/schemas/TeardownTag'
example: []
parentFolderId:
type: string
description: Parent folder ID.
example: '500123'
tagFiringOption:
type: string
description: Option to fire this tag.
enum:
- tagFiringOptionUnspecified
- unlimited
- oncePerEvent
- oncePerLoad
example: tagFiringOptionUnspecified
tagManagerUrl:
type: string
format: uri
description: Auto-generated link to the tag manager UI.
readOnly: true
example: https://www.example.com
paused:
type: boolean
description: Indicates whether the tag is paused, which prevents the tag from firing.
example: true
monitoringMetadata:
$ref: '#/components/schemas/Parameter'
monitoringMetadataTagNameKey:
type: string
description: If non-empty, then the tag display name will be included in the monitoring metadata map using the key specified.
example: example_value
consentSettings:
$ref: '#/components/schemas/ConsentSettings'
required:
- name
- type
TeardownTag:
type: object
description: Represents a teardown tag relationship. A teardown tag fires after the main tag.
properties:
tagName:
type: string
description: The name of the teardown tag.
example: example_value
stopTeardownOnFailure:
type: boolean
description: If true, fire the teardown tag if and only if the main tag fires successfully. If false, fire the teardown tag regardless of main tag firing status.
example: true
Container:
type: object
description: Represents a Google Tag Manager Container, which is a collection of tags, triggers, and variables used on a website or mobile app.
properties:
path:
type: string
description: GTM Container's API relative path.
readOnly: true
example: example_value
accountId:
type: string
description: GTM Account ID.
readOnly: true
example: '500123'
containerId:
type: string
description: The Container ID uniquely identifies the GTM Container.
readOnly: true
example: '500123'
name:
type: string
description: Container display name.
example: Example Title
domainName:
type: array
description: List of domain names associated with the Container. This is used for auto-event tracking and link decoration.
items:
type: string
example: []
publicId:
type: string
description: Container Public ID (e.g., GTM-XXXX).
readOnly: true
example: '500123'
tagIds:
type: array
description: All Tag IDs that refer to this Container.
items:
type: string
readOnly: true
example: []
notes:
type: string
description: Container Notes.
example: example_value
usageContext:
type: array
description: List of Usage Contexts for the Container. Valid values include web, android, ios, and server.
items:
type: string
enum:
- usageContextUnspecified
- web
- android
- ios
- androidSdk5
- iosSdk5
- amp
- server
example: []
fingerprint:
type: string
description: The fingerprint of the GTM Container as computed at storage time. This value is recomputed whenever the container is modified.
readOnly: true
example: example_value
tagManagerUrl:
type: string
format: uri
description: Auto-generated link to the tag manager UI.
readOnly: true
example: https://www.example.com
taggingServerUrls:
type: array
description: List of server-side container URLs for the Container.
items:
type: string
format: uri
example: https://www.example.com
features:
$ref: '#/components/schemas/ContainerFeatures'
required:
- name
- usageContext
Parameter:
type: object
description: Represents a Google Tag Manager Parameter. Parameters are key-value pairs that configure tags, triggers, and variables.
properties:
type:
type: string
description: The parameter type.
enum:
- typeUnspecified
- template
- integer
- boolean
- list
- map
- triggerReference
- tagReference
example: typeUnspecified
key:
type: string
description: The named key that uniquely identifies a parameter. Required for top-level parameters, as well as map values. Ignored for list values.
example: example_value
value:
type: string
description: A parameter's value (may contain variable references) as appropriate to the specified type.
example: example_value
list:
type: array
description: This list parameter's parameters (keys will be ignored). Used when type is list.
items:
$ref: '#/components/schemas/Parameter'
example: []
map:
type: array
description: This map parameter's parameters (must have keys; keys must be unique). Used when type is map.
items:
$ref: '#/components/schemas/Parameter'
example: []
isWeakReference:
type: boolean
description: Whether or not the parameter is a weak reference. Used to determine which parameters should be included in exported containers.
example: true
required:
- type
Variable:
type: object
description: Represents a Google Tag Manager Var
# --- truncated at 32 KB (41 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/google-tag-manager/refs/heads/main/openapi/google-tag-manager-versions-api-openapi.yml