Usage

Base URL

Prior to using the Gtmhub REST API you must determine your REST API base URL.

The base URL for using the Gtmhub REST API varies based on where your account is located. Before using the API you must determine in which data center your Gtmhub account lives. It can be either EU or US.

Once you’ve determined your API base URL, you can work with each public endpoint documented here by appending its name to the base URL.

This API reference use the following convention for the endpoint URLs https://app.(us.)gtmhub.com. You must determine the correct API base URL based on your data center. It can either be https://app.gtmhub.com/api/v1/ or https://app.us.gtmhub.com/api/v1/.

Example:

The Tasks API endpoint URL is /tasks. To work with the Tasks API you must use the following URL:

  • EU: https://app.gtmhub.com/api/v1/tasks
  • US: https://app.us.gtmhub.com/api/v1/tasks

V2 Endpoints

The endpoints documented in the v2 section of this API reference have their Base URL as:

Account ID

Any request to the Gtmhub REST API requires you to specify your account Id. You must pass it as a HTTP header with the following properties:

  • Name: gtmhub-accountid
  • Value: your account Id
curl: "api_endpoint_here" \
  -H "gtmhub-accountid: 5dd52936b1d01a0001ecb1b5" 

For more information on finding your account Id, check this article: <a href="https://help.gtmhub.com/en/articles/1273148-gtmhub-api-quickstart">API Quickstart</a>

Authentication

All Gtmhub REST API endpoints are protected and require you to pass an API token so you can authenticate your request. For more information on generating your API token, check API Quickstart. You must pass the API token as an HTTP header with the following properties:

  • Name: Authorization

  • Value: Bearer your API token value, for example "Bearer apiToken"

curl: "api_endpoint_here" \
  -H 'Authorization: Bearer apiToken'

You must replace apiToken with your personal API key.