openapi: 3.1.0
info:
title: Google Tag Manager Accounts Workspaces 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: Workspaces
description: Operations for managing workspaces within a container, including version creation and conflict resolution.
paths:
/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
components:
parameters:
parentParam:
name: parent
in: path
required: true
description: GTM parent resource's API relative path, e.g. accounts/{accountId} for listing containers.
schema:
type: string
schemas:
MergeConflict:
type: object
description: Represents a merge conflict between workspace and version.
properties:
entityInWorkspace:
$ref: '#/components/schemas/Entity'
entityInBaseVersion:
$ref: '#/components/schemas/Entity'
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
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
Trigger:
type: object
description: Represents a Google Tag Manager Trigger. A trigger defines conditions under which tags should fire, such as page views, clicks, form submissions, or custom events.
properties:
path:
type: string
description: GTM Trigger'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'
triggerId:
type: string
description: The Trigger ID uniquely identifies the GTM Trigger.
readOnly: true
example: '500123'
name:
type: string
description: Trigger display name.
example: Example Title
type:
type: string
description: Defines the data layer event that causes this trigger.
enum:
- eventTypeUnspecified
- pageview
- domReady
- windowLoaded
- customEvent
- triggerGroup
- init
- consentInit
- serverPageview
- always
- firebaseAppException
- firebaseAppUpdate
- firebaseCampaign
- firebaseFirstOpen
- firebaseInAppPurchase
- firebaseNotificationDismiss
- firebaseNotificationForeground
- firebaseNotificationOpen
- firebaseNotificationReceive
- firebaseOsUpdate
- firebaseSessionStart
- firebaseUserEngagement
- formSubmission
- click
- linkClick
- jsError
- historyChange
- timer
- ampClick
- ampTimer
- ampScroll
- ampVisibility
- youTubeVideo
- scrollDepth
- elementVisibility
example: eventTypeUnspecified
customEventFilter:
type: array
description: Used in the case of custom event, which is fired if and only if all Conditions are true.
items:
$ref: '#/components/schemas/Condition'
example: []
filter:
type: array
description: The trigger will only fire if and only if all Conditions are true.
items:
$ref: '#/components/schemas/Condition'
example: []
autoEventFilter:
type: array
description: Used in the case of auto event tracking for filtering events.
items:
$ref: '#/components/schemas/Condition'
example: []
waitForTags:
$ref: '#/components/schemas/Parameter'
checkValidation:
$ref: '#/components/schemas/Parameter'
waitForTagsTimeout:
$ref: '#/components/schemas/Parameter'
uniqueTriggerId:
$ref: '#/components/schemas/Parameter'
eventName:
$ref: '#/components/schemas/Parameter'
interval:
$ref: '#/components/schemas/Parameter'
limit:
$ref: '#/components/schemas/Parameter'
fingerprint:
type: string
description: The fingerprint of the GTM Trigger as computed at storage time. This value is recomputed whenever the trigger is modified.
readOnly: true
example: example_value
parentFolderId:
type: string
description: Parent folder ID.
example: '500123'
selector:
$ref: '#/components/schemas/Parameter'
intervalSeconds:
$ref: '#/components/schemas/Parameter'
maxTimerLengthSeconds:
$ref: '#/components/schemas/Parameter'
verticalScrollPercentageList:
$ref: '#/components/schemas/Parameter'
horizontalScrollPercentageList:
$ref: '#/components/schemas/Parameter'
visibilitySelector:
$ref: '#/components/schemas/Parameter'
visiblePercentageMin:
$ref: '#/components/schemas/Parameter'
visiblePercentageMax:
$ref: '#/components/schemas/Parameter'
continuousTimeMinMilliseconds:
$ref: '#/components/schemas/Parameter'
totalTimeMinMilliseconds:
$ref: '#/components/schemas/Parameter'
tagManagerUrl:
type: string
format: uri
description: Auto-generated link to the tag manager UI.
readOnly: true
example: https://www.example.com
notes:
type: string
description: User notes on how to apply this trigger in the container.
example: example_value
parameter:
type: array
description: Additional parameters for the trigger.
items:
$ref: '#/components/schemas/Parameter'
example: []
required:
- name
- type
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'
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'
Entity:
type: object
description: A workspace entity that can represent a tag, trigger, variable, or folder that has been changed.
properties:
tag:
$ref: '#/components/schemas/Tag'
trigger:
$ref: '#/components/schemas/Trigger'
variable:
$ref: '#/components/schemas/Variable'
changeStatus:
type: string
description: The status of the entity change.
enum:
- changeStatusUnspecified
- none
- added
- deleted
- updated
example: changeStatusUnspecified
CreateContainerVersionRequestVersionOptions:
type: object
description: Options for new container versions.
properties:
name:
type: string
description: The name of the container version to be created.
example: Example Title
notes:
type: string
description: The notes of the container version to be created.
example: example_value
Variable:
type: object
description: Represents a Google Tag Manager Variable. A variable provides dynamic values that can be used in tags and triggers, such as page URL, click text, or custom JavaScript values.
properties:
path:
type: string
description: GTM Variable'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'
variableId:
type: string
description: The Variable ID uniquely identifies the GTM Variable.
readOnly: true
example: '500123'
name:
type: string
description: Variable display name.
example: Example Title
type:
type: string
description: GTM Variable Type. Common types include v (Data Layer Variable), j (1st Party Cookie), k (Custom JavaScript), jsm (Custom JavaScript Variable), u (URL), c (Constant), and e (DOM Element).
example: example_value
notes:
type: string
description: User notes on how to apply this variable in the container.
example: example_value
scheduleStartMs:
type: string
format: int64
description: The start timestamp in milliseconds to schedule a variable.
example: example_value
scheduleEndMs:
type: string
format: int64
description: The end timestamp in milliseconds to schedule a variable.
example: example_value
parameter:
type: array
description: The variable's parameters, which configure its behavior.
items:
$ref: '#/components/schemas/Parameter'
example: []
enablingTriggerId:
type: array
description: For mobile containers only. A list of trigger IDs for enabling conditional variables. The variable is enabled if one of the enabling triggers is true while all of the disabling triggers are false.
items:
type: string
example: '500123'
disablingTriggerId:
type: array
description: For mobile containers only. A list of trigger IDs for disabling conditional variables.
items:
type: string
example: '500123'
fingerprint:
type: string
description: The fingerprint of the GTM Variable as computed at storage time. This value is recomputed whenever the variable is modified.
readOnly: true
example: example_value
parentFolderId:
type: string
description: Parent folder ID.
example: '500123'
tagManagerUrl:
type: string
format: uri
description: Auto-generated link to the tag manager UI.
readOnly: true
example: https://www.example.com
formatValue:
$ref: '#/components/schemas/FormatValue'
required:
- name
- type
ListWorkspacesResponse:
type: object
description: List Workspaces Response.
properties:
workspace:
type: array
description: All Workspaces of a GTM Container.
items:
$ref: '#/components/schemas/Workspace'
example: []
nextPageToken:
type: string
description: Continuation token for fetching the next page of results.
example: example_value
SyncStatus:
type: object
description: The status of a workspace after syncing.
properties:
mergeConflict:
type: boolean
description: Synchornization operation detected a merge conflict.
example: true
syncError:
type: boolean
description: An error occurred during the sync operation.
example: true
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: []
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
# --- truncated at 32 KB (43 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/google-tag-manager/refs/heads/main/openapi/google-tag-manager-workspaces-api-openapi.yml