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

# One row per connected account over the window, including accounts with nothing published



## OpenAPI

````yaml /api-reference/openapi.json get /v1/analytics/accounts
openapi: 3.0.0
info:
  title: PlugKit API
  description: >-
    One API to publish, schedule and message across Instagram, Facebook,
    Threads, WhatsApp, TikTok, Telegram, YouTube, X, LinkedIn and Bluesky — and
    to run Meta and Google ads.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.plugkit.co
security: []
tags: []
paths:
  /v1/analytics/accounts:
    get:
      tags:
        - analytics
      summary: >-
        One row per connected account over the window, including accounts with
        nothing published
      operationId: AnalyticsController_accounts
      parameters:
        - name: profileId
          required: false
          in: query
          description: Restrict to one profile.
          schema:
            type: string
        - name: accountId
          required: false
          in: query
          description: Restrict to one connected account.
          schema:
            type: string
        - name: platform
          required: false
          in: query
          schema:
            type: string
            enum:
              - instagram
              - whatsapp
              - tiktok
              - telegram
              - youtube
              - x
              - facebook
              - meta_ads
              - linkedin
              - threads
              - bluesky
              - google_ads
        - name: source
          required: false
          in: query
          description: >-
            Where the post came from. `plugkit` = published through the API,
            `external` = published natively on the platform. Defaults to all.
          schema:
            enum:
              - all
              - plugkit
              - external
            type: string
        - name: from
          required: false
          in: query
          description: Start of the window (ISO date). Defaults to 30 days ago.
          schema:
            type: string
        - name: to
          required: false
          in: query
          description: End of the window (ISO date). Defaults to now.
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  window:
                    $ref: '#/components/schemas/AnalyticsWindow'
                  accounts:
                    type: array
                    items:
                      $ref: '#/components/schemas/AnalyticsAccountRow'
                required:
                  - window
                  - accounts
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - api-key: []
components:
  schemas:
    AnalyticsWindow:
      type: object
      properties:
        from:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
        to:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
        maxHistoryDays:
          type: integer
          description: History depth allowed by the plan.
        clamped:
          type: boolean
          description: True when `from` was moved forward to fit the plan history.
      required:
        - from
        - to
        - maxHistoryDays
        - clamped
    AnalyticsAccountRow:
      type: object
      properties:
        accountId:
          type: string
        platform:
          type: string
          example: instagram
          enum:
            - instagram
            - whatsapp
            - tiktok
            - telegram
            - youtube
            - x
            - facebook
            - meta_ads
            - linkedin
            - threads
            - bluesky
            - google_ads
        username:
          type: string
        displayName:
          type: string
          nullable: true
        profileId:
          type: string
        profileName:
          type: string
          nullable: true
        connected:
          type: boolean
        posts:
          type: integer
        engagement:
          type: integer
          nullable: true
        likes:
          type: integer
          nullable: true
        comments:
          type: integer
          nullable: true
        shares:
          type: integer
          nullable: true
        saves:
          type: integer
          nullable: true
        views:
          type: integer
          nullable: true
        impressions:
          type: integer
          nullable: true
        reach:
          type: integer
          nullable: true
        clicks:
          type: integer
          nullable: true
        engagementRate:
          type: number
          nullable: true
        followers:
          type: integer
          nullable: true
        followerGrowth:
          type: integer
          nullable: true
        lastSyncAt:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
          nullable: true
      required:
        - accountId
        - platform
        - username
        - displayName
        - profileId
        - profileName
        - connected
        - posts
        - engagement
        - likes
        - comments
        - shares
        - saves
        - views
        - impressions
        - reach
        - clicks
        - engagementRate
        - followers
        - followerGrowth
        - lastSyncAt
    Error:
      type: object
      description: >-
        Every error response has this shape. The request id is returned in the
        `x-request-id` header, not in the body.
      properties:
        error:
          type: string
          description: >-
            Human-readable message (English). Informative only: branch on `type`
            and `code`.
          example: scheduledFor must be a future date.
        type:
          type: string
          description: Error class, for programmatic branching.
          example: invalid_request_error
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - not_found
            - rate_limit_error
            - platform_error
            - billing_error
            - api_error
        code:
          type: string
          description: >-
            Stable machine code for the precise case (e.g. `validation_failed`,
            `post_not_found`, `rate_limited`, `subscription_required`).
          example: scheduled_in_past
        param:
          type: string
          description: Request field at fault, when there is one.
          example: scheduledFor
        platform:
          type: string
          description: >-
            Upstream platform (meta, tiktok, x…) when `type` is
            `platform_error`.
          example: meta
        platformError:
          type: object
          additionalProperties: true
          description: Raw error payload from the platform, passed through verbatim.
        details:
          type: object
          additionalProperties: true
          description: >-
            Extra structured context. Validation errors carry `details.fields`
            (one message per invalid field); billing errors carry
            `details.action_url`; rate limits carry `details.retryAfter`.
      required:
        - error
        - type
        - code
  responses:
    BadRequest:
      description: >-
        Invalid request. `code` is `validation_failed` for body/query validation
        (one message per field in `details.fields`), or a specific code
        (`invalid_reference`, `unsupported_for_platform`…).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 2 validation errors on the request.
            type: invalid_request_error
            code: validation_failed
            details:
              fields:
                - content should not be empty
                - accountIds must be an array
    Unauthorized:
      description: Missing, invalid or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid API key.
            type: authentication_error
            code: unauthorized
    RateLimited:
      description: >-
        Too many requests (PlugKit per-minute quota, or the shared platform
        quota nearly exhausted). Wait `retry-after` seconds.
      headers:
        retry-after:
          description: Seconds to wait before retrying.
          schema:
            type: integer
        x-ratelimit-limit:
          description: Requests allowed per minute in this bucket.
          schema:
            type: integer
        x-ratelimit-remaining:
          schema:
            type: integer
        x-ratelimit-reset:
          description: Unix time (seconds) when the window resets.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Rate limit exceeded: 60 write requests per minute. Retry in 12s.'
            type: rate_limit_error
            code: rate_limited
            details:
              limit: 60
              bucket: write
              retryAfter: 12
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: sk_...
      type: http

````

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