Schematic insights API

The insights API from Schematic — 6 operation(s) for insights.

Documentation

Specifications

SDKs

Schemas & Data

Other Resources

OpenAPI Specification

schematic-insights-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Schematic accesstokens insights API
  version: '0.1'
  description: Schematic API
  x-rules-engine-schema-version: v97288f60
servers:
- url: https://api.schematichq.com
security:
- ApiKeyAuth: []
tags:
- name: insights
paths:
  /insights/activity:
    get:
      operationId: getActivity
      summary: Get activity
      tags:
      - insights
      parameters:
      - name: limit
        in: query
        schema:
          type: integer
          format: int64
          maximum: 50
          minimum: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ActivityResponseResponseData'
                  params:
                    type: object
                    description: Input parameters
                    properties:
                      limit:
                        type: integer
                        format: int64
                        maximum: 50
                        minimum: 1
                    title: GetActivityParams
                required:
                - data
                - params
                title: GetActivityResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /insights/feature-usage-timeseries:
    get:
      operationId: getEnvironmentFeatureUsageTimeSeries
      summary: Get environment feature usage time series
      tags:
      - insights
      parameters:
      - name: end_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: feature_id
        in: query
        required: true
        schema:
          type: string
      - name: granularity
        in: query
        schema:
          $ref: '#/components/schemas/TimeSeriesGranularity'
      - name: start_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/EnvironmentFeatureUsageTimeSeriesResponseData'
                  params:
                    type: object
                    description: Input parameters
                    properties:
                      end_time:
                        type: string
                        format: date-time
                      feature_id:
                        type: string
                      granularity:
                        $ref: '#/components/schemas/TimeSeriesGranularity'
                      start_time:
                        type: string
                        format: date-time
                    title: GetEnvironmentFeatureUsageTimeSeriesParams
                required:
                - data
                - params
                title: GetEnvironmentFeatureUsageTimeSeriesResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /insights/plan-growth:
    get:
      operationId: getPlanGrowth
      summary: Get plan growth
      tags:
      - insights
      parameters:
      - name: months
        in: query
        schema:
          type: integer
          format: int64
          maximum: 24
          minimum: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PlanGrowthResponseData'
                  params:
                    type: object
                    description: Input parameters
                    properties:
                      months:
                        type: integer
                        format: int64
                        maximum: 24
                        minimum: 1
                    title: GetPlanGrowthParams
                required:
                - data
                - params
                title: GetPlanGrowthResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /insights/summary:
    get:
      operationId: getSummary
      summary: Get summary
      tags:
      - insights
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/InsightsSummaryResponseData'
                  params:
                    type: object
                    description: Input parameters
                    title: GetSummaryParams
                required:
                - data
                - params
                title: GetSummaryResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /insights/top-features:
    get:
      operationId: getTopFeaturesByUsage
      summary: Get top features by usage
      tags:
      - insights
      parameters:
      - name: end_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: limit
        in: query
        schema:
          type: integer
          format: int64
          maximum: 20
          minimum: 1
      - name: start_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/TopFeaturesByUsageResponseData'
                  params:
                    type: object
                    description: Input parameters
                    properties:
                      end_time:
                        type: string
                        format: date-time
                      limit:
                        type: integer
                        format: int64
                        maximum: 20
                        minimum: 1
                      start_time:
                        type: string
                        format: date-time
                    title: GetTopFeaturesByUsageParams
                required:
                - data
                - params
                title: GetTopFeaturesByUsageResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
  /insights/trait-usage-timeseries:
    get:
      operationId: getEnvironmentTraitUsageTimeSeries
      summary: Get environment trait usage time series
      tags:
      - insights
      parameters:
      - name: end_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      - name: feature_id
        in: query
        required: true
        schema:
          type: string
      - name: granularity
        in: query
        schema:
          $ref: '#/components/schemas/TimeSeriesGranularity'
      - name: start_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/EnvironmentTraitUsageTimeSeriesResponseData'
                  params:
                    type: object
                    description: Input parameters
                    properties:
                      end_time:
                        type: string
                        format: date-time
                      feature_id:
                        type: string
                      granularity:
                        $ref: '#/components/schemas/TimeSeriesGranularity'
                      start_time:
                        type: string
                        format: date-time
                    title: GetEnvironmentTraitUsageTimeSeriesParams
                required:
                - data
                - params
                title: GetEnvironmentTraitUsageTimeSeriesResponse
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    TimeSeriesGranularity:
      type: string
      enum:
      - daily
      - hourly
      - monthly
      - weekly
    EnvironmentFeatureUsageTimeSeriesResponseData:
      type: object
      properties:
        event_subtype:
          type: string
        feature_id:
          type: string
        points:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentUsagePointResponseData'
          maxItems: 1000
      required:
      - event_subtype
      - feature_id
      - points
      title: EnvironmentFeatureUsageTimeSeriesResponseData
    EnvironmentUsagePointResponseData:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        usage:
          type: integer
          format: int64
      required:
      - timestamp
      - usage
      title: EnvironmentUsagePointResponseData
    MrrResponseData:
      type: object
      properties:
        amount:
          type: integer
          format: int64
        currency:
          type: string
      required:
      - amount
      - currency
      title: MrrResponseData
    TopFeaturesByUsageResponseData:
      type: object
      properties:
        features:
          type: array
          items:
            $ref: '#/components/schemas/TopFeatureByUsageResponseData'
          maxItems: 1000
      required:
      - features
      title: TopFeaturesByUsageResponseData
    EnvironmentTraitUsageTimeSeriesResponseData:
      type: object
      properties:
        feature_id:
          type: string
        points:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentUsagePointResponseData'
          maxItems: 1000
        trait_definition_id:
          type: string
      required:
      - feature_id
      - points
      - trait_definition_id
      title: EnvironmentTraitUsageTimeSeriesResponseData
    ActivityEntryResponseData:
      type: object
      properties:
        actor_name:
          type: string
        method:
          type: string
        resource_name:
          type: string
        resource_type:
          type: string
        timestamp:
          type: string
          format: date-time
        title:
          type: string
      required:
      - actor_name
      - method
      - resource_name
      - resource_type
      - timestamp
      - title
      title: ActivityEntryResponseData
    PlanGrowthResponseData:
      type: object
      properties:
        points:
          type: array
          items:
            $ref: '#/components/schemas/PlanGrowthPointResponseData'
          maxItems: 1000
      required:
      - points
      title: PlanGrowthResponseData
    PlanGrowthPointResponseData:
      type: object
      properties:
        month:
          type: string
          format: date-time
        plan_id:
          type: string
        plan_name:
          type: string
        subscribers:
          type: integer
          format: int64
      required:
      - month
      - plan_id
      - plan_name
      - subscribers
      title: PlanGrowthPointResponseData
    ApiError:
      type: object
      properties:
        error:
          type: string
          description: Error message
      required:
      - error
    ActivityResponseResponseData:
      type: object
      properties:
        entries:
          type: array
          items:
            $ref: '#/components/schemas/ActivityEntryResponseData'
          maxItems: 1000
      required:
      - entries
      title: ActivityResponseResponseData
    TopFeatureByUsageResponseData:
      type: object
      properties:
        change_pct:
          type: number
          nullable: true
        feature_id:
          type: string
        feature_name:
          type: string
        plural_name:
          type: string
          nullable: true
        prior_usage:
          type: integer
          format: int64
        usage:
          type: integer
          format: int64
      required:
      - feature_id
      - feature_name
      - prior_usage
      - usage
      title: TopFeatureByUsageResponseData
    InsightsSummaryResponseData:
      type: object
      properties:
        active_credits:
          type: number
        mrr:
          type: array
          items:
            $ref: '#/components/schemas/MrrResponseData'
          maxItems: 1000
        paid_companies:
          type: integer
          format: int64
        total_companies:
          type: integer
          format: int64
        total_features:
          type: integer
          format: int64
        total_plans:
          type: integer
          format: int64
      required:
      - active_credits
      - mrr
      - paid_companies
      - total_companies
      - total_features
      - total_plans
      title: InsightsSummaryResponseData
  responses:
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ServerError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Schematic-Api-Key