Skip to main content
POST
/
v1
/
analytics
/
query
Top posts by views in the last 30 days
import { ParagraphAPI } from "@paragraph-com/sdk"

const api = new ParagraphAPI({ apiKey: "your-api-key" })
const { rows } = await api.analytics.query({
  sql: `SELECT title, total_views
        FROM post_analytics_summary
        WHERE published_at > now() - interval '30 days'
        ORDER BY total_views DESC
        LIMIT 10`,
})
{
  "rows": [
    {}
  ],
  "rowCount": 123,
  "fields": [
    {
      "name": "<string>"
    }
  ],
  "truncated": true
}

Documentation Index

Fetch the complete documentation index at: https://paragraph.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API key for authenticating protected endpoints. Pass as Bearer token in Authorization header.

Body

application/json

Body

sql
string
required

A SELECT or WITH query against the analytics schema. The analytics.* prefix is implicit.

Minimum string length: 1

Response

Query executed successfully

rows
object[]
required

Result rows. Each row is a column-name → value map.

rowCount
integer
required

Number of rows returned (after truncation if any)

fields
object[]
required

Column names in row order

truncated
boolean
required

True if the result was truncated at the 10,000 row limit