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

# List analytics views

> Lists saved views, optionally filtered by family.



## OpenAPI

````yaml https://swagger.flexprice.io get /analytics/views
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /analytics/views:
    get:
      tags:
        - Analytics
      summary: List analytics views
      description: Lists saved views, optionally filtered by family.
      operationId: listAnalyticsViews
      parameters:
        - name: family
          in: query
          description: Filter by view family
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListViewsResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\tflexprice \"github.com/flexprice/go-sdk/v2\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := flexprice.New(\n        flexprice.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n    )\n\n    res, err := s.Analytics.ListAnalyticsViews(ctx, nil)\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.ListViewsResponse != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from flexprice import Flexprice


            with Flexprice(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as f_client:

                res = f_client.analytics.list_analytics_views()

                # Handle response
                print(res)
        - lang: typescript
          label: TypeScript
          source: |-
            import { Flexprice } from "@flexprice/sdk";

            const flexprice = new Flexprice({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await flexprice.analytics.listAnalyticsViews();

              console.log(result);
            }

            run();
components:
  schemas:
    ListViewsResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/ViewResponse'
    errors.ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/errors.ErrorCode'
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    ViewResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        definition:
          $ref: '#/components/schemas/analytics.ViewDefinition'
        id:
          type: string
        name:
          type: string
        updated_at:
          type: string
          format: date-time
        version:
          type: integer
    errors.ErrorCode:
      type: string
      enum:
        - http_client_error
        - system_error
        - internal_error
        - not_found
        - already_exists
        - version_conflict
        - validation_error
        - invalid_operation
        - permission_denied
        - database_error
        - service_unavailable
        - too_many_requests
        - not_implemented
      x-enum-varnames:
        - ErrCodeHTTPClient
        - ErrCodeSystemError
        - ErrCodeInternalError
        - ErrCodeNotFound
        - ErrCodeAlreadyExists
        - ErrCodeVersionConflict
        - ErrCodeValidation
        - ErrCodeInvalidOperation
        - ErrCodePermissionDenied
        - ErrCodeDatabase
        - ErrCodeServiceUnavailable
        - ErrCodeTooManyRequests
        - ErrCodeNotImplemented
      x-speakeasy-name-override: ErrorCode
    analytics.ViewDefinition:
      required:
        - metrics
        - shape
      type: object
      properties:
        compare:
          type: string
          enum:
            - previous_period
            - previous_year
        currency:
          type: string
        dimensions:
          type: array
          items:
            type: string
        display:
          type: string
          enum:
            - chart
            - table
        family:
          $ref: '#/components/schemas/types.Family'
        filters:
          type: array
          items:
            $ref: '#/components/schemas/analytics.Filter'
        limit:
          type: integer
        metrics:
          minItems: 1
          type: array
          items:
            $ref: '#/components/schemas/types.Metric'
        shape:
          $ref: '#/components/schemas/types.Shape'
        sort:
          type: array
          items:
            $ref: '#/components/schemas/analytics.SortSpec'
        time:
          $ref: '#/components/schemas/analytics.TimeSpecRaw'
        variables:
          type: array
          items:
            $ref: '#/components/schemas/analytics.Variable'
    types.Family:
      type: string
      enum:
        - usage
        - billing
        - report
      x-enum-varnames:
        - FamilyUsage
        - FamilyBilling
        - FamilyReport
      x-speakeasy-name-override: Family
    analytics.Filter:
      type: object
      properties:
        field:
          type: string
        op:
          $ref: '#/components/schemas/types.FilterOperatorType'
        optional:
          type: boolean
        value:
          type: array
          items:
            type: string
    types.Metric:
      type: string
      enum:
        - usage_quantity
        - event_count
        - events_volume
        - invoice_total
        - total_receivables
        - receivables_aging
        - days_to_pay
        - arpu
        - arpu_paid
        - credit_consumption
        - credit_topups
        - net_billing
        - invoice_total_issued
        - net_billing_issued
        - active_customers
      x-enum-varnames:
        - MetricUsageQuantity
        - MetricEventCount
        - MetricEventsVolume
        - MetricInvoiceTotal
        - MetricTotalReceivables
        - MetricReceivablesAging
        - MetricDaysToPay
        - MetricARPU
        - MetricARPUPaid
        - MetricCreditConsumption
        - MetricCreditTopups
        - MetricNetBilling
        - MetricInvoiceTotalIssued
        - MetricNetBillingIssued
        - MetricActiveCustomers
      x-speakeasy-name-override: Metric
    types.Shape:
      type: string
      enum:
        - timeseries
        - breakdown
        - scalar
      x-enum-varnames:
        - ShapeTimeseries
        - ShapeBreakdown
        - ShapeScalar
      x-speakeasy-name-override: Shape
    analytics.SortSpec:
      type: object
      properties:
        dir:
          $ref: '#/components/schemas/types.SortDirection'
        field:
          type: string
    analytics.TimeSpecRaw:
      type: object
      properties:
        grain:
          $ref: '#/components/schemas/types.Grain'
        range:
          type: string
    analytics.Variable:
      required:
        - type
      type: object
      properties:
        default:
          type: array
          items:
            type: string
        name:
          type: string
        required:
          type: boolean
        type:
          $ref: '#/components/schemas/types.VariableType'
    types.FilterOperatorType:
      type: string
      enum:
        - eq
        - contains
        - not_contains
        - gt
        - lt
        - gte
        - in
        - not_in
        - before
        - after
      x-enum-varnames:
        - EQUAL
        - CONTAINS
        - NOT_CONTAINS
        - GREATER_THAN
        - LESS_THAN
        - GREATER_THAN_EQUAL
        - IN
        - NOT_IN
        - BEFORE
        - AFTER
      x-speakeasy-name-override: FilterOperatorType
    types.SortDirection:
      type: string
      enum:
        - asc
        - desc
      x-enum-varnames:
        - SortDirectionAsc
        - SortDirectionDesc
      x-speakeasy-name-override: SortDirection
    types.Grain:
      type: string
      enum:
        - hour
        - day
        - week
        - month
      x-enum-varnames:
        - GrainHour
        - GrainDay
        - GrainWeek
        - GrainMonth
      x-speakeasy-name-override: Grain
    types.VariableType:
      type: string
      enum:
        - date_range
        - string
        - string_list
        - number
        - enum
        - boolean
      x-enum-varnames:
        - VariableTypeDateRange
        - VariableTypeString
        - VariableTypeStringList
        - VariableTypeNumber
        - VariableTypeEnum
        - VariableTypeBoolean
      x-speakeasy-name-override: VariableType
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.