Swetrix Views API

Manage saved dashboard views (segments)

Operations 5

GET /v1/project/{pid}/views List Project Views #
POST /v1/project/{pid}/views Create Project View #
GET /v1/project/{pid}/views/{viewId} Get Project View #
PATCH /v1/project/{pid}/views/{viewId} Update Project View #
DELETE /v1/project/{pid}/views/{viewId} Delete Project View #

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-views-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 email required.

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

OpenAPI Specification

swetrix-views-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Swetrix Admin Annotations Views API
  description: The Swetrix Admin API manages analytics projects, funnels, annotations, project views (segments), and organisations. Supports full CRUD operations for all Swetrix account resources. 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: Views
  description: Manage saved dashboard views (segments)
paths:
  /v1/project/{pid}/views:
    get:
      operationId: listViews
      summary: List Project Views
      description: Returns all saved dashboard views (segments) for a project. Optional X-Password header for password-protected projects.
      tags:
      - Views
      parameters:
      - name: pid
        in: path
        required: true
        schema:
          type: string
        description: Project ID
      responses:
        '200':
          description: Array of saved views
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProjectView'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createView
      summary: Create Project View
      description: Creates a new saved dashboard view (segment) for a project.
      tags:
      - Views
      parameters:
      - name: pid
        in: path
        required: true
        schema:
          type: string
        description: Project ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateViewRequest'
      responses:
        '201':
          description: View created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectView'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/project/{pid}/views/{viewId}:
    get:
      operationId: getView
      summary: Get Project View
      description: Retrieves a single saved dashboard view configuration.
      tags:
      - Views
      parameters:
      - name: pid
        in: path
        required: true
        schema:
          type: string
      - name: viewId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: View configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectView'
        '401':
          $ref: '#/components/responses/Unauthorized'
    patch:
      operationId: updateView
      summary: Update Project View
      description: Updates an existing saved view's name, filters, or custom events.
      tags:
      - Views
      parameters:
      - name: pid
        in: path
        required: true
        schema:
          type: string
      - name: viewId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateViewRequest'
      responses:
        '200':
          description: Updated view
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectView'
        '401':
          $ref: '#/components/responses/Unauthorized'
    delete:
      operationId: deleteView
      summary: Delete Project View
      description: Removes a saved dashboard view.
      tags:
      - Views
      parameters:
      - name: pid
        in: path
        required: true
        schema:
          type: string
      - name: viewId
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: View deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    UpdateViewRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 20
        filters:
          type: array
          items:
            type: object
        customEvents:
          type: array
          items:
            type: string
    ProjectView:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
          - traffic
          - performance
        filters:
          type: array
          items:
            type: object
        customEvents:
          type: array
          items:
            type: string
    CreateViewRequest:
      type: object
      required:
      - name
      - type
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 20
        type:
          type: string
          enum:
          - traffic
          - performance
        filters:
          type: array
          items:
            type: object
        customEvents:
          type: array
          items:
            type: string
          maxItems: 3
  responses:
    Unauthorized:
      description: Unauthorized - missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
    BadRequest:
      description: Bad request - malformed body or missing required fields
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                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 Admin API Documentation
  url: https://swetrix.com/docs/admin-api