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

# Account statistics

> Each account's totals and days in the period, with the period before for comparison. from and to are instants (ISO 8601 with an offset): the period starts at from and stops before to. accounts: some of the workspace's; all when left out. Needs analytics:read.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/analytics
openapi: 3.1.1
info:
  title: Postinger API
  description: >-
    Schedule and publish posts, upload media and read analytics for one
    workspace. Authenticate with an API key from API Keys in the app:
    Authorization: Bearer pst_live_…
  version: v1
servers:
  - url: https://api.postinger.dev
    description: Production
security:
  - apiKey: []
tags:
  - name: Accounts
  - name: Analytics
  - name: Workspace
  - name: Media
  - name: Posts
paths:
  /v1/analytics:
    get:
      tags:
        - Analytics
      summary: Account statistics
      description: >-
        Each account's totals and days in the period, with the period before for
        comparison. from and to are instants (ISO 8601 with an offset): the
        period starts at from and stops before to. accounts: some of the
        workspace's; all when left out. Needs analytics:read.
      parameters:
        - name: from
          in: query
          description: >-
            When the period starts: ISO 8601 with an offset. At most a year
            before to.
          required: true
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          description: 'When it ends, not included: ISO 8601 with an offset.'
          required: true
          schema:
            type: string
            format: date-time
        - name: accounts
          in: query
          description: 'Only these accounts; repeat the parameter for more. Missing: all.'
          schema:
            type: array
            items:
              type: string
              format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsOverviewResponse'
components:
  schemas:
    AnalyticsOverviewResponse:
      required:
        - from
        - to
        - previousFrom
        - totals
        - accounts
      type: object
      properties:
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        previousFrom:
          type: string
          format: date-time
        totals:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MetricTotal'
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/AccountAnalyticsResponse'
    MetricTotal:
      required:
        - value
        - previous
        - accounts
      type: object
      properties:
        value:
          type:
            - 'null'
            - integer
          format: int64
        previous:
          type:
            - 'null'
            - integer
          format: int64
        accounts:
          type: integer
          format: int32
    AccountAnalyticsResponse:
      required:
        - id
        - platform
        - handle
        - displayName
        - avatarUrl
        - isActive
        - sync
        - totals
        - days
      type: object
      properties:
        id:
          type: string
          format: uuid
        platform:
          enum:
            - instagram
            - facebook
            - youtube
            - tiktok
          type: string
        handle:
          type:
            - 'null'
            - string
        displayName:
          type:
            - 'null'
            - string
        avatarUrl:
          type:
            - 'null'
            - string
        isActive:
          type: boolean
        sync:
          $ref: '#/components/schemas/AccountSyncResponse'
        totals:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MetricTotal'
        days:
          type: array
          items:
            $ref: '#/components/schemas/AccountDayResponse'
    AccountSyncResponse:
      required:
        - status
        - lastSyncedAt
        - error
        - errorCode
      type: object
      properties:
        status:
          type: string
        lastSyncedAt:
          type:
            - 'null'
            - string
          format: date-time
        error:
          type:
            - 'null'
            - string
        errorCode:
          type:
            - 'null'
            - string
    AccountDayResponse:
      required:
        - start
        - followers
        - posts
        - views
        - reach
        - engagements
        - likes
        - comments
        - shares
        - saves
        - followersGained
        - followersLost
        - watchMinutes
      type: object
      properties:
        start:
          type: string
          format: date-time
        followers:
          type:
            - 'null'
            - integer
          format: int64
        posts:
          type:
            - 'null'
            - integer
          format: int64
        views:
          type:
            - 'null'
            - integer
          format: int64
        reach:
          type:
            - 'null'
            - integer
          format: int64
        engagements:
          type:
            - 'null'
            - integer
          format: int64
        likes:
          type:
            - 'null'
            - integer
          format: int64
        comments:
          type:
            - 'null'
            - integer
          format: int64
        shares:
          type:
            - 'null'
            - integer
          format: int64
        saves:
          type:
            - 'null'
            - integer
          format: int64
        followersGained:
          type:
            - 'null'
            - integer
          format: int64
        followersLost:
          type:
            - 'null'
            - integer
          format: int64
        watchMinutes:
          type:
            - 'null'
            - integer
          format: int64
  securitySchemes:
    apiKey:
      type: http
      description: A workspace API key (pst_live_…).
      scheme: bearer

````

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