KPIs endpoints

The Kpi endpoints enable you to retrieve, create, update, or delete Gtmhub KPIs. For more information about KPIs check our Create KPIs help article.

🔗
get
/insights/{id}/usages/kpis
Gets all used kpis for the chosen insight
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
Expected response codes
200ok
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/insights/{id}/usages/kpis' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/insights/{id}/usages/kpis", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/insights/{id}/usages/kpis"



requests.get(url, headers = headers)
🔗
get
/kpi-snapshots
Gets KPI snapshots for a given list of KPI unique identifiers (KPI ids).
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
idsstringA comma-separated list of KPI unique identifiers (ids). Ex: 5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
expected in query, sample value:
5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
groupIdsstringA comma-separated list of KPI Groups unique identifiers (ids). Ex: 5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
expected in query, sample value:
string
ungroupedbooleanA true/false value to return all KPIs which the user has access and which don't belong to a group
expected in query
mykpisbooleanA true/false value to return all KPIs which the user is an owner
expected in query
timeZonestringThe time zone for which to calculate snapshot groups.
expected in query, sample value:
UTC-2
groupBystringSpecifies how the snapshots to be grouped by.
expected in query, sample value:
string
fromstringGets the snapshots that start on this date only. Date format: YYYY-MM-DD
expected in query, sample value:
2020-05-02
tostringGets the snapshots that end on this date only. Date format: YYYY-MM-DD
expected in query, sample value:
2020-05-02
Expected response codes
200ok
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/kpi-snapshots?ids=5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365&groupIds=string&ungrouped=undefined&mykpis=undefined&timeZone=UTC-2&groupBy=string&from=2020-05-02&to=2020-05-02' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/kpi-snapshots?ids=5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365&groupIds=string&ungrouped=undefined&mykpis=undefined&timeZone=UTC-2&groupBy=string&from=2020-05-02&to=2020-05-02", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpi-snapshots"



requests.get(url, headers = headers)
🔗
get
/kpis
Loads all kpis using filter, sort and projection expressions coming from the request body
Parameters
NameTypeDescription
Expected response codes
200kpisWithTotalCount
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v2/kpis' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \

var settings = { "url": "https://app.gtmhub.com/api/v2/kpis", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v2/kpis"



requests.get(url, headers = headers)
{}
🔗
get
/kpis/snapshots
Gets KPI snapshots for a given list of KPI unique identifiers (KPI ids).
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
idsstringA comma-separated list of KPI unique identifiers (ids). Ex: 5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
expected in query, sample value:
5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
groupIdsstringA comma-separated list of KPI Groups unique identifiers (ids). Ex: 5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365
expected in query, sample value:
string
ungroupedbooleanA true/false value to return all KPIs which the user has access and which don't belong to a group
expected in query
mykpisbooleanA true/false value to return all KPIs which the user is an owner
expected in query
timeZonestringThe time zone for which to calculate snapshot groups.
expected in query, sample value:
UTC-2
groupBystringSpecifies how the snapshots to be grouped by.
expected in query, sample value:
string
fromstringGets the snapshots that start on this date only. Date format: YYYY-MM-DD
expected in query, sample value:
2020-05-02
tostringGets the snapshots that end on this date only. Date format: YYYY-MM-DD
expected in query, sample value:
2020-05-02
Expected response codes
200ok
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/kpis/snapshots?ids=5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365&groupIds=string&ungrouped=undefined&mykpis=undefined&timeZone=UTC-2&groupBy=string&from=2020-05-02&to=2020-05-02' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis/snapshots?ids=5e8c27e3dcdddaa4addbdee8,5e8ed44adcddda0da9eab365&groupIds=string&ungrouped=undefined&mykpis=undefined&timeZone=UTC-2&groupBy=string&from=2020-05-02&to=2020-05-02", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis/snapshots"



requests.get(url, headers = headers)
🔗
get
/kpis/{kpiId}
Gets an existing KPI by its unique identifier (id).
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
kpiId
*
stringThe unique identifier (id) of the KPI.
expected in path
formattingstringThe formatting used for the description. By default it is returned as 'mentionsMarkup' and it can contain markdown and special markup for mentioned people. Use 'plainText' if you want the response without markdown and special markup.
expected in query, sample value:
string
Expected response codes
200kpi
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v1/kpis/{kpiId}?formatting=string' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis/{kpiId}?formatting=string", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis/{kpiId}"



requests.get(url, headers = headers)
{}
🔗
post
/kpis
Creates a new KPI.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
createKpiRequest
*
This object represents the attributes of a KPI to be created.
expected in body
Expected response codes
201kpi
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/kpis' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"createKpiRequest":undefined}'

var body ='{"createKpiRequest":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/kpis/{kpiId}/snapshots
Creates a new snapshot for an existing KPI.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
kpiId
*
stringThe unique identifier (id) of the KPI.
expected in path
kpiSnapshotRequest
*
This object represents the snapshot of the KPI.
expected in body
Expected response codes
200resource created response
201created
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/kpis/{kpiId}/snapshots' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"kpiSnapshotRequest":undefined}'

var body ='{"kpiSnapshotRequest":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis/{kpiId}/snapshots", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis/{kpiId}/snapshots"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
🔗
put
/users/kpi-virtual-group/favorite
Add/Remove a virtual KPI group to/from favorites of the current user.
Parameters
NameTypeDescription
Expected response codes
200ok
400bad request error message.
401unauthorized
404not found
500internal server error message.

curl -X PUT 'https://app.gtmhub.com/api/v1/users/kpi-virtual-group/favorite' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \

var settings = { "url": "https://app.gtmhub.com/api/v1/users/kpi-virtual-group/favorite", "method": "PUT", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/users/kpi-virtual-group/favorite"



requests.put(url, headers = headers)
🔗
patch
/kpis
Bulk update of KPIs.
Parameters
NameTypeDescription
Expected response codes
204no content
400bad request
401unauthorized
403forbidden
404not found
500internal server error

curl -X PATCH 'https://app.gtmhub.com/api/v1/kpis' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis", "method": "PATCH", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis"



requests.patch(url, headers = headers)
🔗
patch
/kpis/{kpiId}
Partially updates the KPI with the specified unique identifier (id).
Updates the KPI's attributes that are specified in the KPI request body only. The attributes that are not specified in the KPI request body will not be updated.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
kpiId
*
stringThe unique identifier (id) of the KPI.
expected in path
updateKpiRequest
*
This object represents the attributes of a KPI to be updated.
expected in body
Expected response codes
200ok
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X PATCH 'https://app.gtmhub.com/api/v1/kpis/{kpiId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"updateKpiRequest":undefined}'

var body ='{"updateKpiRequest":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis/{kpiId}", "method": "PATCH", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis/{kpiId}"

body = undefined;

requests.patch(url, data=json.dumps(body), headers = headers)
🔗
delete
/kpis/{kpiId}
Deletes an existing KPI and its snapshots.
No request object required.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringThe unique identifier (id) of the Gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
kpiId
*
stringThe unique identifier (id) of the KPI.
expected in path
Expected response codes
200ok
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/kpis/{kpiId}' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/kpis/{kpiId}", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/kpis/{kpiId}"



requests.delete(url, headers = headers)