Get Social Post Analytics
curl --request GET \
--url https://api.example.com/social/post/{post_id}/analyticsimport requests
url = "https://api.example.com/social/post/{post_id}/analytics"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/social/post/{post_id}/analytics', 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.example.com/social/post/{post_id}/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/social/post/{post_id}/analytics"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/social/post/{post_id}/analytics")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/social/post/{post_id}/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodySocial
Get Social Post Analytics
Get normalized analytics for a social post.
GET
/
social
/
post
/
{post_id}
/
analytics
Get Social Post Analytics
curl --request GET \
--url https://api.example.com/social/post/{post_id}/analyticsimport requests
url = "https://api.example.com/social/post/{post_id}/analytics"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/social/post/{post_id}/analytics', 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.example.com/social/post/{post_id}/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/social/post/{post_id}/analytics"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/social/post/{post_id}/analytics")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/social/post/{post_id}/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyReturns analytics for a social post with a fixed normalized shape.
Use the
post_id returned by POST /social/post.
Request
curl -X GET "https://api.mosaic.so/social/post/2d8ca860-f8e0-4f3f-9f2c-337ead6ed91e/analytics" \
-H "Authorization: Bearer mk_your_api_key"
Query Parameters
| Field | Type | Required | Description |
|---|---|---|---|
social_connection_id | string (uuid) | No | Get analytics using one specific connected account. Useful when a post targets multiple accounts on the same platform. |
Response Fields
| Field | Type | Description |
|---|---|---|
analytics.status | string or null | Analytics status. null if the source response does not include it. |
analytics.totals | object | Fixed normalized totals object. Every metric key is always present; the value is a number or null. |
analytics.platforms | array | Per-platform analytics entries. |
analytics.platforms[].platform | string | One of x, linkedin, instagram, facebook, tiktok, youtube. |
analytics.platforms[].platform_post_id | string or null | Native post ID from the destination platform. null if the source response does not include it. |
analytics.platforms[].post_url | string or null | Public post URL. null if the source response does not include it. |
analytics.platforms[].metrics | object | Fixed normalized metric object. Every metric key is always present; the value is a number or null. |
analytics.platforms[].raw_metrics | object | Unnormalized platform-specific analytics payload for clients that need fields outside the normalized contract. |
analytics.metadata | object | Response-level metadata with platform entries removed. |
stats | object | Backward-compatible analytics payload. Prefer analytics for new integrations. |
Metric Object
Everyanalytics.totals and analytics.platforms[].metrics object has exactly these keys:
| Field | Type |
|---|---|
likes | number or null |
comments | number or null |
shares | number or null |
impressions | number or null |
views | number or null |
video_views | number or null |
video_viewers | number or null |
video_watch_time_ms | number or null |
engagement | number or null |
clicks | number or null |
saves | number or null |
bookmarks | number or null |
quotes | number or null |
Response
{
"post_id": "2d8ca860-f8e0-4f3f-9f2c-337ead6ed91e",
"platform": "x",
"social_connection_id": "4df2f2b9-4c5f-4b3a-9581-1bcb8b4f7d01",
"analytics": {
"status": "success",
"totals": {
"likes": 42,
"comments": 7,
"shares": 5,
"impressions": 18420,
"views": 9120,
"video_views": null,
"video_viewers": null,
"video_watch_time_ms": null,
"engagement": null,
"clicks": null,
"saves": null,
"bookmarks": 18,
"quotes": 3
},
"platforms": [
{
"platform": "x",
"platform_post_id": "1901625213503277588",
"post_url": "https://x.com/mosaic_so/status/1901625213503277588",
"metrics": {
"likes": 42,
"comments": 7,
"shares": 5,
"impressions": 18420,
"views": 9120,
"video_views": null,
"video_viewers": null,
"video_watch_time_ms": null,
"engagement": null,
"clicks": null,
"saves": null,
"bookmarks": 18,
"quotes": 3
},
"raw_metrics": {
"likeCount": 42,
"replyCount": 7,
"repostCount": 5,
"impressionCount": 18420,
"viewCount": 9120,
"bookmarkCount": 18,
"quoteCount": 3
}
}
],
"metadata": {}
},
"stats": {
"status": "success",
"x": {
"id": "1901625213503277588",
"analytics": {
"likeCount": 42,
"replyCount": 7,
"repostCount": 5,
"impressionCount": 18420,
"viewCount": 9120,
"bookmarkCount": 18,
"quoteCount": 3
}
}
}
}
Behavior
- Metrics vary by platform and account permissions. Missing normalized metrics are returned as
null, not omitted and not converted to fake zeroes. - For posts with multiple destinations, pass
social_connection_idwhen you need analytics for one connected account. analytics.totalsonly sums metrics returned in this response.
Was this page helpful?
⌘I