curl --request GET \
--url https://postonce.to/api/public/v1/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://postonce.to/api/public/v1/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://postonce.to/api/public/v1/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://postonce.to/api/public/v1/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://postonce.to/api/public/v1/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://postonce.to/api/public/v1/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://postonce.to/api/public/v1/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"range": {
"days": 123,
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"accounts": [
{
"id": "<string>",
"platform": "<string>",
"username": "<string>",
"metrics_status": "<string>",
"posts_with_views": 123,
"median_views": 123,
"followers": 123,
"followers_observed_at": "2023-11-07T05:31:56Z"
}
],
"posts": [
{
"id": "<string>",
"title": "<string>",
"caption": "<string>",
"thumbnail_url": "<string>",
"media_url": "<string>",
"media_type": "video",
"published_at": "2023-11-07T05:31:56Z",
"origin": "<string>",
"destinations": [
{
"platform": "<string>",
"account_id": "<string>",
"username": "<string>",
"url": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"views": 123,
"likes": 123,
"comments": 123,
"shares": 123,
"saves": 123,
"engagement_rate": 123,
"views_vs_account_median": 123
}
]
}
],
"truncated": true,
"refreshing": true,
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "workflow_limit_reached",
"message": "You have reached the maximum number of workflows for your plan.",
"hint": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key.",
"hint": "<string>"
}
}{
"error": {
"code": "workflow_limit_reached",
"message": "You have reached the maximum number of workflows for your plan.",
"hint": "<string>"
}
}Get post analytics
Views, likes, comments, shares and saves for each post the connected TikTok, Instagram, YouTube and Facebook accounts published in the last 7, 30 or 90 days, including posts made outside PostOnce. Each platform copy is compared with its account’s median views (views_vs_account_median: 2 means twice the account’s usual views), so above- and below-average posts can be found and compared. Numbers are cached and refreshed about every 10 minutes; refreshing is true while some are still loading. A metric is null when the platform does not report it. Partner accounts must pass external_user_id or account_id, and get one end user’s posts per call. For one post, use GET /v1/posts/{id}/analytics.
curl --request GET \
--url https://postonce.to/api/public/v1/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://postonce.to/api/public/v1/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://postonce.to/api/public/v1/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://postonce.to/api/public/v1/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://postonce.to/api/public/v1/analytics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://postonce.to/api/public/v1/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://postonce.to/api/public/v1/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"range": {
"days": 123,
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"accounts": [
{
"id": "<string>",
"platform": "<string>",
"username": "<string>",
"metrics_status": "<string>",
"posts_with_views": 123,
"median_views": 123,
"followers": 123,
"followers_observed_at": "2023-11-07T05:31:56Z"
}
],
"posts": [
{
"id": "<string>",
"title": "<string>",
"caption": "<string>",
"thumbnail_url": "<string>",
"media_url": "<string>",
"media_type": "video",
"published_at": "2023-11-07T05:31:56Z",
"origin": "<string>",
"destinations": [
{
"platform": "<string>",
"account_id": "<string>",
"username": "<string>",
"url": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"views": 123,
"likes": 123,
"comments": 123,
"shares": 123,
"saves": 123,
"engagement_rate": 123,
"views_vs_account_median": 123
}
]
}
],
"truncated": true,
"refreshing": true,
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "workflow_limit_reached",
"message": "You have reached the maximum number of workflows for your plan.",
"hint": "<string>"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key.",
"hint": "<string>"
}
}{
"error": {
"code": "workflow_limit_reached",
"message": "You have reached the maximum number of workflows for your plan.",
"hint": "<string>"
}
}Authorizations
Scoped API key issued in PostOnce Settings. OAuth authorization grants are not currently supported.
Query Parameters
Range in days. One of 7, 30 or 90. Defaults to 30.
Partner accounts only. Report on this end user's accounts. Partners must pass this or account_id.
Report on one connected account.
Response
Analytics returned successfully.
Show child attributes
Show child attributes
