> ## Documentation Index
> Fetch the complete documentation index at: https://api.onlysocial.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the analytics of an account

> One account's analytics of one `type`. The answer's `tabs` lists the types the account supports, which depend on the network:

| Network | Types |
| --- | --- |
| Instagram | overview, engagement, audience, reach, content, hashtags, insights, competitors (competitors needs an account connected through Facebook) |
| Facebook Page | overview, engagement, video, content, hashtags, insights |
| Google Business Profile | overview, engagement, content, search_terms, reviews |
| Threads, Bluesky, Mastodon, LinkedIn Page | overview, engagement, content, hashtags, insights |
| Pinterest | overview, content, hashtags, insights |
| TikTok, YouTube | overview, content, insights |
| LinkedIn profile | overview, engagement |

Accounts on other networks (X among them) have no analytics and get a `422`. `data` depends on the network and type. `content` lists the period's posts with their metrics, paged (`data.pagination`) and sortable by a metric; `reviews` pages too. `insights` gives the best day, hour, post type and posting frequency, the top post and the engagement trend. While `initial_sync.in_progress` is true, the account's first import is still running and the figures are incomplete.

Read-only. Personal access tokens may call it with any workspace role, viewers included.

**Required permission:** `publishing:analytics:read`



## OpenAPI

````yaml /api-reference/publishing.openapi.json get /{workspace}/analytics/accounts/{account}
openapi: 3.1.0
info:
  title: Publishing API
  version: 1.0.0
  description: >-
    Social accounts, posts, scheduling, approval, tags, media and analytics for
    one workspace.
servers:
  - url: https://app.onlysocial.io/os/api
    description: OnlySocial
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Diagnostics
  - name: Accounts
  - name: Posts
  - name: Media
  - name: Tags
  - name: Analytics
    description: >-
      Followers, reach, engagement and post performance, as the analytics
      dashboard shows them, plus when to post. Dates are UTC days unless a
      `timezone` is sent. Figures compared with the previous period of the same
      length are `{value, change}`, where `change` is a percentage (`100` when
      the previous period was zero, `null` when both are). Time series are lists
      of `{date, value}` points; breakdowns (ages, countries, keywords) are
      lists of `{label, value}`.
paths:
  /{workspace}/analytics/accounts/{account}:
    get:
      tags:
        - Analytics
      summary: Get the analytics of an account
      description: >-
        One account's analytics of one `type`. The answer's `tabs` lists the
        types the account supports, which depend on the network:


        | Network | Types |

        | --- | --- |

        | Instagram | overview, engagement, audience, reach, content, hashtags,
        insights, competitors (competitors needs an account connected through
        Facebook) |

        | Facebook Page | overview, engagement, video, content, hashtags,
        insights |

        | Google Business Profile | overview, engagement, content, search_terms,
        reviews |

        | Threads, Bluesky, Mastodon, LinkedIn Page | overview, engagement,
        content, hashtags, insights |

        | Pinterest | overview, content, hashtags, insights |

        | TikTok, YouTube | overview, content, insights |

        | LinkedIn profile | overview, engagement |


        Accounts on other networks (X among them) have no analytics and get a
        `422`. `data` depends on the network and type. `content` lists the
        period's posts with their metrics, paged (`data.pagination`) and
        sortable by a metric; `reviews` pages too. `insights` gives the best
        day, hour, post type and posting frequency, the top post and the
        engagement trend. While `initial_sync.in_progress` is true, the
        account's first import is still running and the figures are incomplete.


        Read-only. Personal access tokens may call it with any workspace role,
        viewers included.


        **Required permission:** `publishing:analytics:read`
      operationId: analytics.account
      parameters:
        - name: workspace
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Your workspace UUID. Must match the API key's workspace.
        - name: account
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Account UUID.
        - name: type
          in: query
          schema:
            type: string
            enum:
              - overview
              - engagement
              - content
              - hashtags
              - insights
              - audience
              - reach
              - video
              - competitors
              - search_terms
              - reviews
            default: overview
          description: One of the account's `tabs`.
        - name: period
          in: query
          schema:
            type: string
            enum:
              - this_week
              - last_week
              - this_month
              - last_month
              - last_3_months
              - this_year
            default: this_month
          description: >-
            In UTC. Weeks start on Monday. `this_week`, `this_month` and
            `this_year` run up to today; `last_3_months` is the three whole
            months before this one. Ignored when `date_from` and `date_to` are
            both sent.
        - name: date_from
          in: query
          schema:
            type: string
            format: date
            example: '2026-01-01'
          description: Start of a custom range (UTC day). Send with `date_to`.
        - name: date_to
          in: query
          schema:
            type: string
            format: date
            example: '2026-01-31'
          description: >-
            End of a custom range, on or after `date_from`. A range spans at
            most 366 days, both ends included.
        - name: page
          in: query
          schema:
            type: integer
            minimum: 1
            default: 1
          description: '`content` and `reviews` only.'
        - name: per_page
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 50
          description: '`content` and `reviews` only. Defaults to 25 posts or 10 reviews.'
        - name: sort_by
          in: query
          schema:
            type: string
            maxLength: 64
            example: VIEW_COUNT
          description: >-
            `content` only: a metric name, as the keys of a post's `metrics`
            (e.g. `VIEW_COUNT`, `IMPRESSION_COUNT`, `LIKES`). Newest first
            without it.
        - name: sort_dir
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountAnalytics'
        '401':
          description: Missing or invalid credential.
        '403':
          description: The API key does not have `publishing:analytics:read`.
        '404':
          description: Unknown workspace, account or post.
        '422':
          description: >-
            Invalid input. An account without analytics, a `type` the account
            does not support (the message lists its tabs), bad paging, or a bad
            period.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
components:
  schemas:
    AccountAnalytics:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/Account'
        type:
          type: string
          example: overview
        tabs:
          type: array
          items:
            type: string
          example:
            - overview
            - content
            - insights
        period:
          $ref: '#/components/schemas/AnalyticsPeriod'
        initial_sync:
          type: object
          properties:
            in_progress:
              type: boolean
            progress:
              type: integer
              nullable: true
              description: Percent while the first import runs.
        data:
          type: object
          description: >-
            Depends on the network and type. Compared figures are `{value,
            change}`, time series `{date, value}` lists, breakdowns `{label,
            value}` lists, and charts with several series an object of such
            lists.
          example:
            total_followers: 120
            views:
              value: 5400
              change: 12.5
            likes:
              value: 310
              change: -4.2
            audience:
              - date: '2026-01-01'
                value: 118
              - date: '2026-01-02'
                value: 120
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The date range may span at most 366 days.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            date_to:
              - The date range may span at most 366 days.
    Account:
      type: object
      properties:
        id:
          type: integer
          description: Use this in a post's `accounts`.
        uuid:
          type: string
          format: uuid
        name:
          type: string
        username:
          type: string
        image:
          type: string
        provider:
          type: string
          example: instagram
        data:
          type: object
        authorized:
          type: boolean
        created_at:
          type: string
        published_at:
          type: string
          nullable: true
    AnalyticsPeriod:
      type: object
      description: >-
        The range the figures cover, and the previous range of the same length
        every `change` is measured against.
      properties:
        start_date:
          type: string
          format: date
        end_date:
          type: string
          format: date
        previous_start_date:
          type: string
          format: date
        previous_end_date:
          type: string
          format: date
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'A workspace API key: `Authorization: Bearer osk_...`'
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: The same workspace API key in the `x-api-key` header.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.