GET
/
v1
/
teams
/
{teamId}
/
campaigns
/
{campaignId}
/
stats
TypeScript client
import { OctosparkClient } from '@octospark/sdk'

const client = new OctosparkClient({
  token: process.env.OCTOSPARK_TOKEN
})

const response = await client.campaigns.getCampaignStats({
  teamId: process.env.OCTOSPARK_TEAM_ID ?? "teamId",
  campaignId: process.env.OCTOSPARK_CAMPAIGN_ID ?? "campaignId",
  query: {},
})
{
  "campaignId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "from": "<string>",
  "to": "<string>",
  "totals": {
    "created": 123,
    "scheduled": 123,
    "published": 123,
    "failed": 123,
    "costDecimillicents": 123
  },
  "byAgent": [
    {
      "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created": 123,
      "scheduled": 123,
      "published": 123,
      "failed": 123,
      "costDecimillicents": 123
    }
  ],
  "engagementByAgent": [
    {
      "value": "<string>",
      "postCount": 123,
      "totals": {
        "likeCount": 123,
        "commentCount": 123,
        "shareCount": 123,
        "saveCount": 123,
        "impressionCount": 123,
        "reachCount": 123,
        "postCount": 123,
        "linkClickCount": 123,
        "averageEngagementRate": 123
      },
      "costDecimillicents": 123,
      "engagementPerCredit": 123
    }
  ],
  "engagementByStrategy": [
    {
      "value": "<string>",
      "postCount": 123,
      "totals": {
        "likeCount": 123,
        "commentCount": 123,
        "shareCount": 123,
        "saveCount": 123,
        "impressionCount": 123,
        "reachCount": 123,
        "postCount": 123,
        "linkClickCount": 123,
        "averageEngagementRate": 123
      },
      "costDecimillicents": 123,
      "engagementPerCredit": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

teamId
string
required

Team (workspace) id (UUID). Discover ids via the list teams endpoint or the agent context.

campaignId
string
required

Campaign id (UUID), as returned by the list/create campaigns endpoints.

Query Parameters

from
string

First UTC day (YYYY-MM-DD, inclusive). Defaults to 29 days before to.

Pattern: ^\d{4}-\d{2}-\d{2}$
to
string

Last UTC day (YYYY-MM-DD, inclusive). Defaults to today (UTC). The window is at most 92 days.

Pattern: ^\d{4}-\d{2}-\d{2}$

Response

Read-only campaign aggregates built on the attribution spine: counters from agent_content_daily and engagement from the analytics by-dimension read model.

Read-only campaign aggregates built on the attribution spine: counters from agent_content_daily and engagement from the analytics by-dimension read model.

campaignId
string<uuid>
required

a Universally Unique Identifier

Pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
from
string
required

UTC calendar day, YYYY-MM-DD.

Pattern: ^\d{4}-\d{2}-\d{2}$
to
string
required

UTC calendar day, YYYY-MM-DD.

Pattern: ^\d{4}-\d{2}-\d{2}$
totals
object
required

Pieces created, scheduled, published and failed plus spend across the campaign's agents in the window (trigger-maintained, never self-reported).

byAgent
object[]
required

The same counters per campaign agent.

engagementByAgent
object[]
required

Published-post engagement in the window per campaign agent, with cost and engagement per credit.

engagementByStrategy
object[]
required

Published-post engagement in the window per strategy label used by the campaign's agents.