Skip to main content

Setup

Put them in your environment or .env; Data APIs covers the other ways.

Notes

  • Own-account API: every call acts as the Google user the refresh token belongs to, and only reaches accounts that user can access.
  • Resources nest: account > container > workspace > tags, triggers, variables. Ids are digits; the public GTM-XXXX id is not an API id.
  • Lists page with pageToken/nextPageToken. A publish makes a container version live on the real site; create_version only snapshots a workspace.
  • Per-method OAuth scopes are narrower than one broad token: reads need tagmanager.readonly, creating a version needs tagmanager.edit.containerversions, publishing needs tagmanager.publish.

Endpoints

List Tag Manager accounts

List containers in an account

List workspaces of a container

List tags in a workspace

Get one tag

List triggers in a workspace

List variables in a workspace