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

# Read Metrics

> Totals and averages across an account's posts in a window, plus the posts themselves. For YOUR OWN connected channel prefer `GET /analytics/{integration}` — it answers the same question over the channel's OAuth token, for free.

## Use Platform Analytics for your own channel

This endpoint and [`GET /analytics/{integration}`](/public-api/analytics/platform) answer the
same question — "what performed well?" — through different doors:

|               | Platform Analytics               | Read Metrics                   |
| ------------- | -------------------------------- | ------------------------------ |
| Whose account | only a channel **you connected** | **any** public account         |
| Reads with    | that channel's OAuth token       | the server's data-provider key |
| Cost          | free                             | metered per upstream call      |

So: **your own account → Platform Analytics.** Read Metrics earns its cost when the account is
not yours, or has no connected channel — cases Platform Analytics cannot see at all.

## `averages` is `null`, not zero

When no posts fall inside the window, `sample_size` is `0` and `averages` is `null` — an
average over zero posts is undefined, **not** "zero engagement". Widen `since` before
concluding anything about the account.

```bash theme={null}
curl -H "Authorization: your-api-key" \
  "https://api.groniz.com/public/v1/reads/x/metrics?username=elonmusk&since=30d"
```

`since` accepts a duration (`30d`, `12h`), a date (`2026-07-01`), or an ISO timestamp, and
defaults to `30d`. An unparseable value returns `400` rather than silently dropping the window.


## OpenAPI

````yaml GET /reads/{platform}/metrics
openapi: 3.1.0
info:
  title: Groniz Public API
  description: >-
    API for managing social media posts, integrations, and media uploads in
    Groniz.


    ## Authentication


    All endpoints require an API key passed in the `Authorization` header:


    ```

    Authorization: your-api-key

    ```


    Get your API key from Groniz Settings.


    ## Rate Limits


    There is a limit of **30 requests per hour**.


    ## Terminology


    The UI uses `channel`, but the API uses `integration`. They refer to the
    same thing.


    ## Supported Platforms (27)


    **Social Platforms:** X (Twitter), LinkedIn, LinkedIn Page, Facebook,
    Instagram, Instagram Standalone, Threads, Bluesky, Mastodon, Warpcast
    (Farcaster), Nostr, VK


    **Video Platforms:** YouTube, TikTok


    **Community Platforms:** Reddit, Lemmy, Discord, Slack, Telegram


    **Design Platforms:** Pinterest, Dribbble


    **Blogging Platforms:** Medium, Dev.to, Hashnode, WordPress


    **Business:** Google My Business (GMB), Listmonk (newsletters)
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.groniz.com/public/v1
    description: Groniz Cloud
  - url: https://{your-domain}/api/public/v1
    description: Self-hosted
    variables:
      your-domain:
        default: localhost:5000
        description: Your Groniz instance domain
security:
  - ApiKeyAuth: []
tags:
  - name: Integrations
    description: Manage connected social media channels
  - name: Posts
    description: Create, list, and delete posts
  - name: Uploads
    description: Upload media files
  - name: Notifications
    description: View organization notifications
  - name: Analytics
    description: View analytics for integrations and posts
  - name: Video Generation
    description: Generate videos with AI
  - name: Reads
    description: >-
      Read public data from a platform. Unlike Analytics, these require NO
      connected channel: the server reads with its own data-provider key, so
      they work for ANY public account. Metered per upstream call. Only `x` is
      supported today.
paths:
  /reads/{platform}/metrics:
    get:
      tags:
        - Reads
      summary: Aggregate post performance over a window
      description: >-
        Totals and averages across an account's posts in a window, plus the
        posts themselves. For YOUR OWN connected channel prefer `GET
        /analytics/{integration}` — it answers the same question over the
        channel's OAuth token, for free.
      operationId: readMetrics
      parameters:
        - name: platform
          in: path
          required: true
          description: Platform to read from. Only `x` is supported today.
          schema:
            type: string
            enum:
              - x
          example: x
        - name: username
          in: query
          required: false
          description: >-
            Account handle, without the @. Either `username` or `user_id` is
            required.
          schema:
            type: string
          example: elonmusk
        - name: user_id
          in: query
          required: false
          description: >-
            Platform user id. Cheaper than `username` (skips the handle lookup).
            Either `username` or `user_id` is required.
          schema:
            type: string
          example: '44196397'
        - name: limit
          in: query
          required: false
          description: Maximum items to return. Default 50, capped at 200.
          schema:
            type: integer
            default: 50
            maximum: 200
        - name: since
          in: query
          required: false
          description: >-
            Lookback window: a duration (`30d`, `12h`, `45m`, `30s`), a date
            (`2026-07-01`), or an ISO timestamp. Anything else returns 400 — the
            window is never silently ignored. Defaults to `30d`.
          schema:
            type: string
          example: 7d
      responses:
        '200':
          description: The aggregate
          content:
            application/json:
              schema:
                type: object
                properties:
                  user_id:
                    type: string
                  window:
                    type: object
                    properties:
                      since:
                        type: string
                      until:
                        type: string
                  sample_size:
                    type: integer
                    description: Posts in the window
                  metrics:
                    type: array
                    items:
                      $ref: '#/components/schemas/NormalizedPostMetrics'
                  posts:
                    type: array
                    items:
                      $ref: '#/components/schemas/NormalizedPost'
                  totals:
                    $ref: '#/components/schemas/PostMetrics'
                  averages:
                    allOf:
                      - $ref: '#/components/schemas/PostMetrics'
                    nullable: true
                    description: >-
                      null when sample_size is 0 — an average over zero posts is
                      undefined, NOT zero engagement. Widen `since`.
              example:
                user_id: '44196397'
                window:
                  since: '2026-06-17T00:00:00.000Z'
                  until: '2026-07-17T00:00:00.000Z'
                sample_size: 2
                totals:
                  impressions: 400
                  likes: 30
                  replies: 3
                  reposts: 5
                  bookmarks: 1
                  quotes: 0
                averages:
                  impressions: 200
                  likes: 15
                  replies: 1.5
                  reposts: 2.5
                  bookmarks: 0.5
                  quotes: 0
        '400':
          description: >-
            Unsupported platform, missing target (`username`/`user_id`), or an
            unparseable `since`
        '404':
          description: Account or post not found
        '429':
          description: The read data provider rate-limited this server; retry later
        '503':
          description: Reads are not configured on this server (no read provider key)
components:
  schemas:
    NormalizedPostMetrics:
      type: object
      properties:
        post_id:
          type: string
        created_at:
          type: string
        metrics:
          $ref: '#/components/schemas/PostMetrics'
    NormalizedPost:
      type: object
      properties:
        id:
          type: string
          example: '1234567890123456789'
        text:
          type: string
        created_at:
          type: string
        author_id:
          type: string
        conversation_id:
          type: string
        in_reply_to_user_id:
          type: string
        lang:
          type: string
          example: en
        referenced_tweets:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              id:
                type: string
        metrics:
          $ref: '#/components/schemas/PostMetrics'
    PostMetrics:
      type: object
      properties:
        impressions:
          type: integer
          example: 15000
        likes:
          type: integer
          example: 320
        replies:
          type: integer
          example: 45
        reposts:
          type: integer
          example: 88
        bookmarks:
          type: integer
          example: 21
        quotes:
          type: integer
          example: 7
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Your Groniz API key

````