1. Import posts
Import one post withPOST /api/v2/posts, or up to 20 at once with POST /api/v2/posts/bulk:
200 with one result per URL, in the order you sent them. A URL that can’t be imported doesn’t fail the others:
Use
post.post.id (the post id) or post.link.id (your organization’s link id) to read the post’s history below.
- The request returns once every URL is processed, so a full batch can take a few minutes. Set your HTTP client’s timeout accordingly.
- A URL sent twice in one request is imported once and reported at both positions.
- Each new post counts toward your plan’s monthly post limit. When the limit is reached, the remaining URLs fail with an error; the rest of the batch still completes.
- A request with more than 20 URLs, or more than your plan allows in one import, is rejected with
400before anything is imported.
2. Read a post’s history
UseGET /api/v2/posts/{id}/history with the post id or the link id. To read several posts, call it once per post:
Query parameters
Unknown parameters, unknown metrics, unparseable dates, and
from later than to return 400.
Granularity
Fine-grained history is kept for a limited time, so which bucket widths you can use depends on how long agofrom is, not on how long the range is. The table is the finest each age allows, not a promise of a new measurement in every bucket (see below):
from is rounded down to the start of its bucket first (UTC; 7d buckets start on Mondays), and the age is measured from that rounded value, so a from close to a limit can fall just past it.
Asking for a granularity that isn’t available for your from returns 400. The message and details name the earliest from that granularity accepts and the granularities you can use instead:
granularity, you get the finest available one that fits, so a request without granularity never hits the limit; for example, a from 20 days ago comes back hourly. A granularity you choose that goes over the limit returns 400.
Finer buckets don’t add measurements. A granularity is the finest bucket width you can ask for, and each bucket holds up to one value; it doesn’t mean the post was measured in every bucket. A post is measured on its own refresh schedule (every 48 hours is common, and older posts are refreshed less often). Between measurements the last value is carried forward, so many points repeat the one before: 1h buckets for a post refreshed every 48 hours show the same number for 48 hours. History also thins out as it ages: samples older than a few days are kept one per few hours, then one per day, and so on, down to one per 30 days after six months. When older samples are thinned, the stored buckets are rebuilt from the samples that remain, so a range read today can have fewer distinct values than the same range read last week.
How values are filled
- Each point is the highest count known by the end of its bucket. Buckets with no new sample repeat the previous value.
- Counts never decrease. Platforms occasionally report a lower number for a short time; those readings are ignored, so a real decrease (for example, removed likes) isn’t shown either.
- A count never drops back to
0once a positive value has been seen. Some platforms report0for a metric they don’t track on a given post; those readings are ignored. nullmeans unknown: the platform has never reported that metric for the post (LinkedIn and Threads often don’t report views, for example). Treat it as missing, not as zero.- Points start at the post’s first collected sample. A post imported today has no points before today.
- When
tois now (or left out), the last point includes the post’s most recent refresh, even if that refresh happened minutes ago.
Errors
See Responses and errors for the error body.