Analytics

List analytics accounts

Lists the analytics accounts tracked in the workspace: LinkedIn profiles and company pages, and X accounts. Each has a platform. Call first to resolve accountId for every other analytics endpoint.

GET/api/public/analytics/accounts
cURLGET /api/public/analytics/accounts
curl "https://postiv.ai/api/public/analytics/accounts" \
  -H "Authorization: Bearer pk_postiv_..."
200Response
{
  "success": true,
  "accounts": [
    {
      "id": "acc1...",
      "orgId": "9e6397ad-...",
      "integrationId": 1234,
      "accountType": "personal",
      "platform": "linkedin",
      "profileType": "personal",
      "externalRef": "urn:li:person:...",
      "isActive": true,
      "name": "Jan van Musscher",
      "picture": "https://...",
      "username": null,
      "createdAt": "...",
      "lastImport": {
        "source": "api",
        "imported_at": "2026-07-19T06:00:00.000Z"
      }
    },
    {
      "id": "acc2...",
      "orgId": "9e6397ad-...",
      "integrationId": 2345,
      "accountType": "personal",
      "platform": "x",
      "profileType": "x_account",
      "externalRef": "1469...",
      "isActive": true,
      "name": "Jan van Musscher",
      "username": "janvm",
      "picture": "https://...",
      "createdAt": "...",
      "lastImport": {
        "source": "x_analytics_sync",
        "imported_at": "2026-07-19T06:00:00.000Z"
      },
      "tracking": {
        "trackedPosts": 12,
        "measuredPosts": 12,
        "budgetPausedPosts": 0
      },
      "budgetState": "ok"
    }
  ]
}

Authorization

Requires an organization API key with the analytics:read scope, sent as Authorization: Bearer or x-api-key.

Query parameters

channelstring

Narrow the list to one channel. Omit for LinkedIn and X together.

One of:linkedinx
integrationIdint

One connected account (LinkedIn or X integration id). An account decides the channel; a contradicting channel returns 400 channel_mismatch.

Response

Tracked accounts with last-import timestamps.

accounts[].iduuid
accounts[].orgIduuid
accounts[].integrationIdint
accounts[].accountTypestring
accounts[].platformstring

The account's channel.

accounts[].profileTypestring
accounts[].externalRefstring
accounts[].isActiveboolean
accounts[].name / picturemixed
accounts[].usernamestring|null

X handle. Null for LinkedIn.

accounts[].createdAttimestamp
accounts[].lastImportobject|null

Freshness of the stored data: the last LinkedIn import, or for X the last X sync as { source: 'x_analytics_sync', imported_at }. Null when nothing was imported yet.

accounts[].trackingobject

X accounts only: { trackedPosts, measuredPosts, budgetPausedPosts }. Explains an empty or paused account.

accounts[].budgetStatestring

X accounts only: ok, degraded or paused. paused means the account's monthly X read budget is used up until the next month.

Errors

400invalid_channel: channel is not linkedin or x / channel_mismatch: channel contradicts the channel of integrationId
404integration_not_found: integrationId is not an account in this workspace
404analytics_not_set_up: integrationId is an X account that has no analytics yet; metrics appear after the next X analytics sync

Good to know

  • Data is cached, never live: LinkedIn comes from imports and X from the periodic X sync (this endpoint never reads the X API). Freshness is indicated by lastImport.