SOCIAL MEDIA DATA API

Social media data API: one schema for five platforms

Pull public profiles, posts, comments, transcripts and ad library records from Instagram, TikTok, YouTube, X and Facebook with one workspace key. This guide covers authentication, the request models, pagination, credits, errors and the insights endpoints, with a real response broken down field by field.

A laptop with code connected by pipes to five app tiles, with data cubes flowing in
In short
  • Create a workspace key at app.caelario.com/connect and send it as X-API-Key (or a Bearer token) to https://api.caelario.com. Every call is scoped to that workspace's credits, jobs and results.
  • Use POST /v1/extract for one target up to 50 results, POST /v1/jobs for anything larger, POST /v1/batches for up to 100 targets and POST /v1/schedules to repeat a request daily, weekly or monthly.
  • Every platform returns the same field names: like_count, comment_count, share_count, view_count, published_at, content_url. Fields a platform doesn't show come back as null, never as zero.
  • Each operation has a published price per delivered result. You reserve the maximum, pay for what's delivered, and pay nothing for empty or failed requests.
  • The insights endpoints return the same snapshots, comparisons and brand dashboards the Caelario app shows.

Your first request in five steps

You need a Caelario workspace and a terminal. New workspaces start with 200 free credits, valid for 30 days.

  1. 1

    Create a key

    Sign in or create an account at app.caelario.com/connect and create an API key, or open Developers in the dashboard. Name it after the environment that will use it. The full secret is shown once; Caelario stores only a digest, so a lost key is replaced, not recovered.

  2. 2

    Keep it server-side

    Put the key in an environment variable or your secret manager. Never ship it in browser JavaScript, a mobile app or a public repository. Use separate keys for development and production so you can revoke one without touching the other.

  3. 3

    Read the catalog

    GET /v1/platforms returns every operation with its maximum results, credits per result, any flat base cost and an available flag. Build your client from this response rather than hard-coding prices. GET /v1/account and GET /v1/usage/current confirm the key works and show your balance.

  4. 4

    Run one bounded request

    POST /v1/extract with platform, operation, target and limit. It returns the completed result and final billing in the same response, as long as the request asks for 50 results or fewer.

  5. 5

    Go durable for anything bigger

    POST /v1/jobs returns 202 with a job ID straight away. Poll GET /v1/jobs/{job_id} until status is completed, failed or cancelled, then download GET /v1/jobs/{job_id}/export as json, csv or xlsx. Exports of stored results don't cost credits.

Extract, job, batch or schedule: which to use

The request body is the same everywhere: platform, operation, target (or targets) and limit. What changes is how long the work may take and how many targets it covers.

EndpointUse it forWhat you get back
POST /v1/extractOne target, 50 results or fewer, when you want the answer inside the request200 with the completed result and billed credits. Larger limits return 422 limit_exceeds_synchronous_maximum.
POST /v1/jobsOne target of any size, or work that must survive a closed connection202 with a job ID; progress, retries and the result on GET /v1/jobs/{job_id}
POST /v1/batchesThe same operation across up to 100 targets, e.g. 30 competitors' posts202 with a batch ID; each target is its own job that retries or fails alone
POST /v1/schedulesRepeating a job or batch once, daily, weekly or monthly201 with the schedule; each run creates normal jobs you read the usual way

Schedules take an IANA timezone and keep the same local time across daylight-saving changes. Pause, resume, run now and delete are separate endpoints under /v1/schedules/{schedule_id}.

Real example · collected 21 November 2026

A real response, field by field: Red Bull on TikTok

We called tiktok/profile for redbull with include_posts set to 3, which returns the profile and its most recent videos in one result. Below are the fields that matter, with the values that came back and what each means. Media URLs and long captions are trimmed.

24MRed Bull followersRounded by TikTok
27.8MViews on the wingsuit video25 seconds long
1.05%Shares as a share of views290,800 of 27.8 million
4Credits for the call1 profile + 1 per video, 3 videos
Wingsuit video: interactions
Likes
2.0M
Shares
290,800
Saves
112,300
Comments
17,200

Counts as returned. The platform has already rounded the large ones.

See the full table
FieldExample valueMeaning
profile.platform_user_id160822079959736320Stable account ID. Key your database on this, since handles can change.
profile.username / display_nameredbull / Red BullHandle and display name
profile.follower_count24000000Followers as TikTok shows them. Large counts are rounded (24M).
profile.post_count / following_count3237 / 541Public videos and accounts followed
profile.total_likes642500000Lifetime likes. TikTok shows this; platforms that don't return null.
posts[].platform_content_id7706093984610815254The video's ID; content_url is its public link
posts[].published_at2026-11-09T09:00:35ZPublish time, always UTC in ISO 8601
posts[].view_count27800000Views. Reliable on TikTok, YouTube and X; patchy on Facebook and Instagram, where it's often null.
posts[].like_count / comment_count2000000 / 17200Likes (on Facebook, all reactions) and comments
posts[].share_count / save_count290800 / 112300Shares and saves. Null where the platform hides them, such as Instagram shares and saves.
posts[].duration_seconds25Video length
posts[].hashtagspradalinearossa, redbull, givesyouwiiings, wingsuit, catapultParsed from the caption, lowercase, without #
posts[].music.sound_id7706094045835053846The sound used; pass it to sound_videos to see who else used it
posts[].is_pinnedtruePinned to the top of the profile
posts[].is_ad / sponsorsfalse / []TikTok's ad flag, and paid-partnership labels where the platform shows them
billed_credits (job)41 for the profile plus 1 for each of the 3 videos

What it tells you

  • All three "recent" videos were pinned, and the third was posted on 1 October 2025. Pinned posts come first, so drop is_pinned items before you calculate posting pace or recent averages.
  • The wingsuit video's caption names Prada and uses #PradaLineaRossa, yet sponsors is empty because TikTok didn't label it as a paid partnership. Read captions and hashtags as well as the sponsors field when you look for brand deals.
  • Counts arrive as integers, but the platform has already rounded large ones (2,000,000 likes, 24,000,000 followers). Don't report false precision.
  • Shares were 1.05% of views on that video (290,800 of 27.8 million), and saves 0.40%. Ratios like these are comparable across accounts of any size.

Collected through the Caelario MCP server, which calls the same /v1/extract endpoint. 4 credits.

Sources: Red Bull on TikTok · Wingsuit video

One schema across Instagram, TikTok, YouTube, X and Facebook

Every content item, from an Instagram reel to an X post to a Facebook Page post, comes back with the same core fields: platform, platform_content_id, username, kind, media_type, caption, published_at, like_count, comment_count, share_count, view_count, save_count, content_url, thumbnail_url, hashtags, is_pinned and collaborator_usernames. Profiles share platform_user_id, username, display_name, biography, follower_count, following_count, post_count, total_likes and verified. Comments share text, like_count, reply_count, published_at and a comment_url you can pass to comment_replies.

Platform-specific fields sit alongside the core ones: YouTube's title, Facebook's reactions breakdown, TikTok's music. Ad library records have their own shape, with started_at, active, publisher_platforms and creative URLs.

The rule that keeps analysis honest: null means the platform doesn't show the number, and 0 means it shows zero. Instagram doesn't publish shares, so share_count is null there. Compute averages over the items that have a value, and never treat null as zero.

A few meanings differ by platform, and the schema can't hide them. Facebook's like_count is the sum of all reactions. YouTube's posts operation mixes long videos and Shorts, newest first. Instagram returns collaborative posts with the primary publisher in username and co-authors in collaborator_usernames. Check these before comparing platforms; the platform guides cover each one.

Pagination and large results

You don't page through the platforms yourself. You set one total limit, up to the operation's maximum (200 TikTok videos, 100 Instagram posts, 500 playlist items and so on), and Caelario walks the platform's pages internally, saving progress as it goes. The job finishes when it reaches your limit or the platform has nothing more to show.

A limit is a maximum, not a promise. If an account has fewer public items, or the platform shows only part of a list, the job completes with fewer results and a notice such as fewer_results or no_results. You pay only for what was delivered. Our request for 20 comments on a Facebook post returned the 10 Facebook displayed and cost 10 credits, not 20.

A completed job's result is stored. GET /v1/jobs/{job_id} returns it, and the export endpoint gives you the whole thing as JSON, CSV or XLSX for batches too. Reading or exporting a stored result never re-runs the extraction. If you work through the MCP server, get_extraction_result pages a large result in slices so it fits an AI model's context.

How credits, estimates and settlement work

Every operation has a published price in GET /v1/platforms. These are the rules that turn a price into a charge.

MetricWhat it meansHow to read it
credits_per_resultThe price of each delivered item. Instagram posts are 1, YouTube videos 1, Meta Ad Library records 2, Facebook Page profiles 1.Multiply by your limit to get the most a request can cost.
base_creditsA flat price for operations sold as a complete collection, such as Instagram stories and highlights (5 each when non-empty).Charged once per non-empty result, whatever the item count.
Transcripts and analyticsOne-result operations with their own price: 10 for a YouTube transcript, 20 for other platforms, 5 for Facebook Page analytics.Check the catalog; these aren't per-item.
ReservationCreating work reserves the maximum: limit × rate (+ any base). A profile with include_posts reserves the profile plus each requested post.If the balance can't cover it, you get 402 insufficient_credits before anything runs.
SettlementWhen the job finishes you're charged for delivered results and the rest of the reservation is released. Empty and failed results cost nothing.billed_credits on the job is the final charge. Our two-brand TikTok batch reserved 32 and billed 17 because one account had no videos.
Plans and packsMonthly plans include research credits (3,000 to 100,000 a month) and the API. Credit packs (5,000 for $19, 20,000 for $39, 50,000 for $79) work with or without a plan and never expire.At 1 credit per post, the $19 pack covers 5,000 Instagram posts.

What operations cost, per delivered result

Published prices quoted above. Multiply by your limit for the most a request can cost.

Credits per delivered result
YouTube videos
1
Facebook Page profiles
1
Instagram posts
1
Meta Ad Library records
2
Facebook Page analytics
5
Transcripts, any platform
10

Instagram stories and highlights are a flat 5 credits when non-empty.

Errors you'll meet, and how to handle each

Errors return a JSON body with an error code, and every response carries an X-Request-ID you can quote to support.

401 missing_authentication or invalid_api_key

The header is missing, or the key was revoked or belongs to another workspace. Rotate by creating a new key, deploying it, then revoking the old one.

402 insufficient_credits

The maximum reservation is more than your balance. Lower the limit, split the targets, or add credits. Nothing was charged.

422 unsupported_operation or limit_exceeds_synchronous_maximum

The operation isn't in the catalog for that platform, or you sent more than 50 results to /v1/extract. Move large requests to /v1/jobs.

429 rate_limit_exceeded or concurrent_job_limit_exceeded

Wait for the Retry-After header, or for running jobs to finish. Your account's limits are in GET /v1/account.

503 operation_unavailable

The operation is temporarily switched off (today, TikTok's single-ad detail) and is rejected before any credits are reserved. Retrying won't help; use an alternative such as TikTok ad search.

Retries that double-charge

If a write times out and you retry, send an Idempotency-Key header and reuse it with the identical body. Caelario returns the original job instead of reserving twice. Reusing a key with a different body returns 409 idempotency_key_conflict.

A completed job with fewer results than you asked for

Not an error. Read the notices array (fewer_results, no_results) and adjust your analysis rather than retrying.

Insights endpoints: snapshots, comparisons and dashboards

Above the raw data, the same key reaches the endpoints that power the Caelario app. They aren't in the public OpenAPI file yet, so treat their response shapes as subject to change.

POST /v1/insights/find-handles takes brand names or websites and returns each brand's likely handle per platform, free. POST /v1/insights/snapshots builds a competitor snapshot: a brand and up to five competitors on up to five platforms, collecting each profile plus 24 recent posts. GET /v1/insights/snapshots/{snapshot_id} returns the scoreboard and actions, and every snapshot has a share link that opens without a login.

For ongoing work, POST /v1/insights/brands starts tracking a brand's handles on a daily or weekly refresh, and GET /v1/insights/brands/{brand_id}/dashboard returns follower growth, engagement rate, posting pace, top posts and suggested actions for 7 to 90 days. POST /v1/insights/comparisons groups a client brand with up to five competitors, and GET /v1/insights/comparisons/{comparison_id}/dashboard returns the side-by-side leaderboard and trends. GET /v1/insights/history/{platform}/{handle} returns a tracked account's follower history, and GET /v1/insights/alerts lists breakout-post, follower-spike and posting alerts. For how agencies use these, see /use-cases/competitor-tracking.

The same data without writing code

Everything the API does is also available in the app and through AI assistants, on the same workspace and balance.

Illustrative example with made-up brands.

Ask AI and templates

Ask a research question in plain English, or start from one of 15 templates in Insights. A question's plan shows each step and its maximum credits before you approve; a template shows its steps and a flat price that includes a basic AI insight. The API equivalents are POST /v1/assistant/plans and /v1/assistant/templates/{template_id}/plans.

MCP server and Claude connector

Let Claude, Codex or Claude Code call the operations for you, with estimates first. See /solutions/social-media-mcp-server.

One workspace

Jobs created by your code appear in the dashboard alongside the team's, on the same balance.

BUILD IT WITH CAELARIO

Social media data API

The same data through the API and the Claude connector, with 200 free credits to start.

QUESTIONS

Common questions.

Which social media platforms does the API cover?

Instagram, TikTok, YouTube, X and Facebook, plus the Meta Ad Library and TikTok's ad library for ads shown in the EU. GET /v1/platforms lists every operation and its availability.

Do I need my own Instagram or TikTok developer account?

No. You need only a Caelario workspace key. The API works from publicly available data and never asks for social network logins.

Can I get private metrics like reach or audience demographics?

No. Reach, impressions, saves on Instagram and demographics are visible only to the account owner, so no outside API can return them for someone else's account.

How much does the API cost?

The API is included in every plan, from $29 a month with 3,000 research credits. You can also use it with credit packs alone ($19 for 5,000 credits). Each operation has a per-result price, from 1 credit for a profile to 10 for a transcript, and new workspaces get 200 free credits.

How do I avoid paying twice when a request times out?

Send an Idempotency-Key header and reuse it with the same body when you retry. Caelario returns the original job instead of creating a new one.

KEEP READING