Welcome

The Kantar TGI API makes it easier for you to take advantage of TGI’s unique capabilities as a cloud-based web service.

If you are developing a custom application/platform and need to integrate TGI Data, we can provide a number of APIs to assist you, depending on your specific requirements.

For example, we can provide you with a “Crosstab” API that allows you to specify TGI target audiences within your own application and obtain the corresponding aggregated sample size, weighted population and index from the underlying data.

Terms and Conditions

Currently the Kantar TGI APIs are available only to existing TGI subscribers in certain territories. Please contact us if you need more information.

Getting Started

Here’s how to get started:
  1. You must have an active valid TGI subscription.
  2. Request an API key from your TGI account manager.
  3. Read the API documentation.
  4. Experiment calling the API from your own code using the demo account.

TGI API documentation

JSON Download YAML Download

TGI API documentation will provide you with the information you need to use the TGI API in your own applications. The TGI API is a RESTful service returning JSON results, which provides methods for browsing the full range of variables available in a TGI survey and querying the TGI data. The available API methods and their use are explained below.

Surveys API

The starting point for all applications working with the TGI API is the TGI survey and wave. Use the following methods to get the survey and waves that you subscribe to. There are 2 API methods for accessing surveys:

  1. Get Surveys
  2. Get Surveys Info


Dictionaries API

The variables for a TGI Survey are organised into a classification structure called a dictionary. A TGI dictionary provides a hierarchical tree grouping individual questions and answers (variables) in a logical structure. The structure varies from Survey to Survey and as such care should be taken when making assumptions in code that rely on a given structure. There are 3 methods available for querying the dictionary structure:

  1. Get Hierarchy
  2. Get Question
  3. Dictionary Search

As a TGI API user, you will also be given access to Target Export. Target export allows you to browse the TGI dictionary, create targets and export these targets in either JSON or text format. The export will provide you with the keywords you need to call the data from the TGI API. For further information on Target export, please speak to your TGI account manager or refer to the Target Export Quick Guide.


Crosstab API

An individual question JSON object provides details of the available answers. Each answer is assigned a unique keyword which can be used to process the survey data.

Alternatively browse the dictionary using our Target Export App to get the unique keywords for the variables you would like to call.

There are 3 methods available for querying (processing) TGI data:
  1. Process Expression
  2. Process Crosstab Report
  3. Process CrossTab Report (Tab Separated)

Expressions

Expressions are used to define a specific audience definition in TGI. An expression uses answer keywords returned in the question JSON objects. These keywords can be used on their own or combined together in complex ways to create specific audience definitions, some examples are shown below:
Description Expression
All Men DBSEXLME
All Men Aged 15-24 (DBSEXLME) AND (DBAGE152)
All Men Aged 15-44 DBSEXLME AND (DBAGE152 OR DBAGE253 OR DBAGE354)
Average Cinema visits among visitors. MeanScoreNoNull(GLCIFNAW,5,GLCIF23M,2.5,GLCIF1AM,1,GLCIFM23,0.3,GLCIF23Y,0.2,GLCIFLOF,0.1)
The full range of available operators and functions are shown below:
Operator Type Action
AND Binary Bitwise Boolean logical AND
OR Binary Bitwise Boolean logical OR
XOR Binary Bitwise Boolean logical XOR
NOT Unary Bitwise Boolean logical NOT
() Brackets for controlling order of precedence.
MEANSCORE(<keyword>,<midpoint>,<keyword>,<midpoint>…) Function Calculates the arithmetic mean of a variable using mid-points assigned to each value. Denominator is total base.
MEANSCORENONULL(<keyword>,<midpoint>,<keyword>,<midpoint>…) Function Calculates the arithmetic mean of a variable using mid-points assigned to each value. Denominator is total base who have a value including zero.
MEANSCORENOZERO(<keyword>,<midpoint>,<keyword>,<midpoint>…) Function Calculates the arithmetic mean of a variable using mid-points assigned to each value. Denominator is total base who have a value greater than 0.
MEANSCORENOZERO(<keyword>,<midpoint>,<keyword>,<midpoint>…) Function Calculates the arithmetic mean of a variable using mid-points assigned to each value. Denominator is total base who have a value greater than 0.
More information and help on expressions can be provided, please contact your TGI account manager.

Authentication

Only authorised client applications are allowed to make calls to the API. To call the API you must first have a valid API key. The API key is unique for each client and is valid for the duration of a valid TGI data subscription.

User IDs

Each call must also be associated with a named user at the client. The userid will need to be sent along with each call to the API. The userid is generated by registering users with TGI against a specific API key. The User Id and API key will be supplied to you by the TGI client service team once you have been given access to the TGI API.

Security

Every API request requires authentication via a pre-registered API key. This key will be provided to you once you have been given access to the TGI API. This key is unique and is associated with named users. As mentioned above, a valid key and a valid user id are required to make calls to the TGI API.

Demo Account

This guide uses the demo API account, which is free to use. The example calls provided have been pre-populated with the required key and user id.


Authentication for Client-Side Applications

Requests can be made from client-side applications but must originate from a pre-authorised web site or browser extension URL associated with a given API key. Each client-side call must include both a valid apikey and a valid userid.