Run a table-shaped custom metric
curl --request POST \
--url https://api.mentionlab.io/api/analytics/custom-metrics/table \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"metric": "sample-metric-table",
"filter": {
"from": "2026-01-01",
"to": "2026-01-31",
"limit": 100
}
}
'import requests
url = "https://api.mentionlab.io/api/analytics/custom-metrics/table"
payload = {
"metric": "sample-metric-table",
"filter": {
"from": "2026-01-01",
"to": "2026-01-31",
"limit": 100
}
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric: 'sample-metric-table',
filter: {from: '2026-01-01', to: '2026-01-31', limit: 100}
})
};
fetch('https://api.mentionlab.io/api/analytics/custom-metrics/table', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mentionlab.io/api/analytics/custom-metrics/table",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metric' => 'sample-metric-table',
'filter' => [
'from' => '2026-01-01',
'to' => '2026-01-31',
'limit' => 100
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mentionlab.io/api/analytics/custom-metrics/table"
payload := strings.NewReader("{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mentionlab.io/api/analytics/custom-metrics/table")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/analytics/custom-metrics/table")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"metric": "<string>",
"title": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"type": "text",
"decimals": 123,
"nullLabel": "—",
"tooltip": "<string>",
"hidden": true
}
],
"rows": [
{}
],
"description": "<string>",
"defaultSort": {
"column": "<string>",
"order": "asc"
},
"highlight": {
"column": "<string>",
"rule": "max"
}
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Analytics - Custom Metrics
Run a table-shaped custom metric
Runs the requested table-shaped custom metric for the project and returns its results; the supplied filter is validated and the metric must be granted by your plan.
POST
/
api
/
analytics
/
custom-metrics
/
table
Run a table-shaped custom metric
curl --request POST \
--url https://api.mentionlab.io/api/analytics/custom-metrics/table \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"metric": "sample-metric-table",
"filter": {
"from": "2026-01-01",
"to": "2026-01-31",
"limit": 100
}
}
'import requests
url = "https://api.mentionlab.io/api/analytics/custom-metrics/table"
payload = {
"metric": "sample-metric-table",
"filter": {
"from": "2026-01-01",
"to": "2026-01-31",
"limit": 100
}
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric: 'sample-metric-table',
filter: {from: '2026-01-01', to: '2026-01-31', limit: 100}
})
};
fetch('https://api.mentionlab.io/api/analytics/custom-metrics/table', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mentionlab.io/api/analytics/custom-metrics/table",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metric' => 'sample-metric-table',
'filter' => [
'from' => '2026-01-01',
'to' => '2026-01-31',
'limit' => 100
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mentionlab.io/api/analytics/custom-metrics/table"
payload := strings.NewReader("{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mentionlab.io/api/analytics/custom-metrics/table")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/analytics/custom-metrics/table")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric\": \"sample-metric-table\",\n \"filter\": {\n \"from\": \"2026-01-01\",\n \"to\": \"2026-01-31\",\n \"limit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"metric": "<string>",
"title": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"type": "text",
"decimals": 123,
"nullLabel": "—",
"tooltip": "<string>",
"hidden": true
}
],
"rows": [
{}
],
"description": "<string>",
"defaultSort": {
"column": "<string>",
"order": "asc"
},
"highlight": {
"column": "<string>",
"rule": "max"
}
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}Headers
Project ID to specify the project context
Body
application/json
Metric identifier (matches id returned by GET /analytics/custom-metrics)
Example:
"sample-metric-table"
Filter payload. Schema is metric-specific and validated by the dispatcher against the registered DTO class.
Show child attributes
Show child attributes
Example:
{
"from": "2026-01-01",
"to": "2026-01-31",
"limit": 100
}
Response
Metric id (matches discovery list)
Human-readable card title
Show child attributes
Show child attributes
Row data; keys match columns[].key
Show child attributes
Show child attributes
Short description rendered under the title
Show child attributes
Show child attributes
Row-level highlight rule (e.g. tint the leader row)
Show child attributes
Show child attributes