Swetrix Traffic API

Aggregated traffic and pageview analytics

Business capability
Product Usage Analytics BC-4280.30

Operations 6

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /v1/log Get a project's traffic data over time · Get Traffic Log #
Ask an LLM
“How many visitors and pageviews did my site get each day last month?”
“Can I get traffic as a cumulative total instead of per period?”
Tell an agent
Get traffic for project {pid} over {period} grouped by {timeBucket}.
Show {mode} traffic for project {pid} from {from} to {to} by {timeBucket} for {period}.
GET /v1/log/birdseye Compare traffic totals against the previous period · Get Birdseye Traffic Summary #
Ask an LLM
“Is my traffic up or down compared with the previous period?”
“Can I get a quick traffic summary for several projects together?”
Tell an agent
Summarize traffic for project {pid} over {period} versus the prior period.
Give me the birdseye traffic trend for projects {pids} and {pid} for {period}.
GET /v1/log/live-visitors See who is on the site right now · Get Live Visitors #
Ask an LLM
“How many people are on my site right now?”
“What devices and countries are my current live visitors from?”
Tell an agent
Show the live visitors on project {pid}.
List who is currently active on project {pid}.
GET /v1/log/keywords Get search keywords from Google Search Console · Get Search Keywords #
Ask an LLM
“Which Google search keywords are bringing people to my site?”
“Can I see Search Console queries alongside my analytics?”
Tell an agent
Get search keywords for project {pid} over {period}.
Show the Google Search Console keywords for project {pid} from {from} to {to} for {period}.
GET /v1/log/user-flow See how visitors move between pages · Get User Navigation Flow #
Ask an LLM
“Where do visitors usually go after landing on my homepage?”
“Can I get the page-to-page navigation flow for my site?”
Tell an agent
Get the user navigation flow for project {pid} over {period} by {timeBucket}.
Map how visitors move between pages on project {pid} for {period}, bucketed by {timeBucket}.
GET /v1/log/filters List available values for an analytics dimension · Get Available Filter Values #
Ask an LLM
“Which browsers or countries can I filter my analytics by?”
“What values exist for a given dimension like operating system?”
Tell an agent
List the available {type} filter values for project {pid}.
Show which {type} values I can filter project {pid} by.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/swetrix:swetrix-traffic-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

swetrix-traffic-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Swetrix Statistics Traffic API
  description: The Swetrix Statistics API enables querying aggregated analytics data for projects including traffic logs, performance metrics, session details, funnel analysis, user navigation flows, error statistics, keyword data, and feature flag evaluations. All requests require authentication via the X-Api-Key header. Rate limit is 600 requests/hour.
  version: '1.0'
  contact:
    name: Swetrix Support
    url: https://swetrix.com/contact
  termsOfService: https://swetrix.com/privacy
  license:
    name: AGPL-3.0
    url: https://github.com/Swetrix/swetrix-api/blob/main/LICENSE
servers:
- url: https://api.swetrix.com
  description: Swetrix Production API
security:
- ApiKeyAuth: []
tags:
- name: Traffic
  description: Aggregated traffic and pageview analytics
paths:
  /v1/log:
    get:
      operationId: getTrafficLog
      summary: Get Traffic Log
      description: Retrieves aggregated traffic data for a project. Returns the same data shown in the Traffic tab of the dashboard, represented as JSON. Supports periodic or cumulative modes and custom metric objects.
      tags:
      - Traffic
      parameters:
      - $ref: '#/components/parameters/pid'
      - $ref: '#/components/parameters/timeBucket'
      - $ref: '#/components/parameters/period'
      - $ref: '#/components/parameters/from'
      - $ref: '#/components/parameters/to'
      - $ref: '#/components/parameters/timezone'
      - $ref: '#/components/parameters/filters'
      - name: mode
        in: query
        schema:
          type: string
          enum:
          - periodic
          - cumulative
        description: Data aggregation mode
      - name: metrics
        in: query
        schema:
          type: string
        description: Up to 3 custom metric objects (JSON array)
      responses:
        '200':
          description: Traffic log data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrafficLogResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/log/birdseye:
    get:
      operationId: getBirdseyeSummary
      summary: Get Birdseye Traffic Summary
      description: Returns summary traffic data for one or more projects, comparing the current period against the previous period. Useful for dashboards showing traffic trends.
      tags:
      - Traffic
      parameters:
      - name: pids
        in: query
        schema:
          type: string
        description: Comma-separated list of project IDs (use pid or pids)
      - $ref: '#/components/parameters/pid'
      - $ref: '#/components/parameters/period'
      - $ref: '#/components/parameters/from'
      - $ref: '#/components/parameters/to'
      - $ref: '#/components/parameters/timezone'
      - $ref: '#/components/parameters/filters'
      responses:
        '200':
          description: Per-project birdseye summaries
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/log/live-visitors:
    get:
      operationId: getLiveVisitors
      summary: Get Live Visitors
      description: Returns currently active visitors on a project. Each visitor record includes device type, browser, operating system, country, and session ID.
      tags:
      - Traffic
      parameters:
      - $ref: '#/components/parameters/pid'
      responses:
        '200':
          description: Array of active visitor objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LiveVisitor'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/log/keywords:
    get:
      operationId: getKeywords
      summary: Get Search Keywords
      description: Returns search keyword data from Google Search Console integration for the specified project and period.
      tags:
      - Traffic
      parameters:
      - $ref: '#/components/parameters/pid'
      - $ref: '#/components/parameters/period'
      - $ref: '#/components/parameters/from'
      - $ref: '#/components/parameters/to'
      - $ref: '#/components/parameters/timezone'
      responses:
        '200':
          description: Search keyword data
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/log/user-flow:
    get:
      operationId: getUserFlow
      summary: Get User Navigation Flow
      description: Returns user navigation flow diagram data showing how visitors move between pages on the site.
      tags:
      - Traffic
      parameters:
      - $ref: '#/components/parameters/pid'
      - $ref: '#/components/parameters/timeBucket'
      - $ref: '#/components/parameters/period'
      - $ref: '#/components/parameters/from'
      - $ref: '#/components/parameters/to'
      - $ref: '#/components/parameters/timezone'
      - $ref: '#/components/parameters/filters'
      responses:
        '200':
          description: User flow diagram data
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/log/filters:
    get:
      operationId: getFilters
      summary: Get Available Filter Values
      description: Returns available filter values for a specific analytics dimension such as browser, OS, or country code.
      tags:
      - Traffic
      parameters:
      - $ref: '#/components/parameters/pid'
      - name: type
        in: query
        required: true
        schema:
          type: string
          enum:
          - br
          - os
          - cc
          - lc
          - ref
          - so
          - me
          - ca
          - pg
        description: Dimension type to get filter values for
      responses:
        '200':
          description: Available filter values
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    filters:
      name: filters
      in: query
      schema:
        type: string
      description: JSON array of filter objects
    timeBucket:
      name: timeBucket
      in: query
      required: true
      schema:
        type: string
        enum:
        - minute
        - hour
        - day
        - week
        - month
        - year
      description: Time bucket for data aggregation
    to:
      name: to
      in: query
      schema:
        type: string
        format: date
      description: Custom range end date (YYYY-MM-DD)
    timezone:
      name: timezone
      in: query
      schema:
        type: string
        default: Etc/GMT
      description: IANA timezone name (default Etc/GMT)
    pid:
      name: pid
      in: query
      required: true
      schema:
        type: string
      description: Project ID
    from:
      name: from
      in: query
      schema:
        type: string
        format: date
      description: Custom range start date (YYYY-MM-DD)
    period:
      name: period
      in: query
      required: true
      schema:
        type: string
        enum:
        - 1h
        - today
        - yesterday
        - 1d
        - 7d
        - 4w
        - 3M
        - 12M
        - 24M
        - all
      description: Time period for the query
  responses:
    BadRequest:
      description: Bad request - invalid parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    Unauthorized:
      description: Unauthorized - missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
  schemas:
    TrafficLogResponse:
      type: object
      properties:
        params:
          type: object
          description: Query parameters echo
        chart:
          type: object
          description: Chart data grouped by time bucket
        customs:
          type: object
          description: Custom event data
        properties:
          type: object
          description: Page properties data
        appliedFilters:
          type: array
          items:
            type: object
          description: Applied filter objects
    LiveVisitor:
      type: object
      properties:
        sessionId:
          type: string
        device:
          type: string
        browser:
          type: string
        os:
          type: string
        country:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key from Swetrix account settings (https://swetrix.com/user-settings)
externalDocs:
  description: Swetrix Statistics API Documentation
  url: https://swetrix.com/docs/statistics-api