API Docs/Reference/Get Analytics
API Reference

Get Analytics

Get aggregate account analytics over a date range. Requires a paid Creator or Lifetime plan.

GEThttps://api.linkedmash.com/v1/analytics

GET /v1/analytics returns account-level LinkedIn performance over a date range: impressions, reactions, comments and reshares as a metrics object, plus the current follower count. date_range takes a shorthand window such as 7d, 30d or 90d.

The numbers come from LinkedIn through the connected account, so they are only as complete as what LinkedIn exposes for that profile, and they reflect the connected account's own posts rather than anything in the saved-posts library.

Example request

Authenticate with a bearer token in the Authorization header. Create a key on the API page in your LinkedMash settings and export it as LINKEDMASH_API_KEY before running this.

curl
curl "https://api.linkedmash.com/v1/analytics?date_range=30d" \
  -H "Authorization: Bearer $LINKEDMASH_API_KEY"

Header parameters

AuthorizationstringRequired

Your secret API key as a Bearer token.

Query parameters

Combine these parameters to narrow your results.

date_rangestringOptional

Date range to summarize, e.g. 7d, 30d, or 90d.

Response

{
  "status": true,
  "data": {
    "metrics": {
      "impressions": 48210,
      "reactions": 1932,
      "comments": 412,
      "reshares": 188
    },
    "followers": 12480
  }
}

Response fields

Every response is wrapped in the same envelope: a status flag and a data payload, with meta present where there is pagination or a plan limit to report.

statusboolean

true on success. Every LinkedMash API response carries this envelope flag alongside data, so a client can branch on it without re-reading the HTTP status.

data.metrics.impressionsinteger

Total impressions across the window.

data.metrics.reactionsinteger

Total reactions of all kinds, not just likes.

data.metrics.commentsinteger

Total comments received.

data.metrics.resharesinteger

Total reposts.

data.followersinteger

Current follower count. This is a point-in-time value at the moment of the request, not a figure for the window.

Closing the loop on a publishing workflow

Analytics is what makes an automated posting pipeline worth running rather than just running.

1

Publish through the API

Create with POST /v1/posts and queue with the schedule route, so every post you want to measure has a known id on your side.

2

Wait before reading

LinkedIn does not report engagement immediately. Reading a post's numbers minutes after publication returns near-zero values that mean nothing.

3

Read the aggregate for the window

date_range takes a relative shorthand such as 7d, 30d or 90d. The window is relative to now, so store the retrieval time with anything you cache.

4

Break it down when the total moves

GET /v1/analytics/posts gives the same window per post, which is where a change in the aggregate is actually explained.

Behaviour and limits

Requires a Creator or Lifetime plan

Everything under /v1/posts, /v1/queue, /v1/schedule, /v1/media and /v1/analytics sits behind one middleware that checks for an unlocked Studio, so a Reader-plan or free key gets 402 with code SUBSCRIPTION_REQUIRED before the handler runs. Bookmark and label reads are on a separate router and are not affected by this gate.

The LinkedIn account has to be connected

Analytics proxy the connected profile's own metrics. An account with no LinkedIn connection has nothing to report, and the upstream failure surfaces as a 500 rather than an empty 200.

Aggregate only

This route gives one set of totals for the window. Use GET /v1/analytics/posts when you need the same period broken down per post.

Windows are relative, so results move

date_range is relative to now, not to a fixed calendar period. Two calls with 30d on different days cover different windows — store the retrieval time alongside anything you cache.

Errors

Failures carry the same envelope as a success, with the reason in message and a stable machine-readable code where the status alone is ambiguous — several distinct conditions share a 402.

Status
Meaning
401Unauthorized
The Authorization header is missing or the key is not a valid LinkedMash API key. Create or rotate keys on the API page in your LinkedMash settings.
402Payment Required
Returned with code SUBSCRIPTION_REQUIRED. The content API requires a Creator or Lifetime plan; Reader and free accounts get this on every /v1/posts, /v1/queue, /v1/schedule, /v1/media and /v1/analytics call.
500Server Error
Something failed on our side. The body carries message "Failed to fetch analytics". Retry once; if it persists the request is not the problem.