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

# Retrieve a View

> Retrieves the details of an existing view.



## OpenAPI

````yaml GET /views/{id}
openapi: 3.1.0
info:
  title: Moonbase REST API
  version: v0
servers:
  - url: https://api.moonbase.ai/v0
security:
  - bearer: []
tags:
  - name: Inboxes
    description: Manage your inboxes, conversations, and messages
  - name: Collections
    description: Manage your collections and items
  - name: Marketing
    description: Manage your marketing campaigns and forms
  - name: Activities
    description: View activities and capture calls
  - name: Library
    description: Manage your meetings, files, and notes
paths:
  /views/{id}:
    get:
      tags:
        - Collections
      summary: Retrieve a view
      description: Retrieves the details of an existing view.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the view to retrieve.
          explode: true
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/View'
              examples:
                Default:
                  summary: Default
                  value:
                    id: 1CLJt2uf2UnqHG2xD5kQvf
                    type: view
                    relation_value_filters: []
                    created_at: '2025-02-17T16:00:00.000Z'
                    updated_at: '2025-02-17T16:00:00.000Z'
                    view_type: board
                    name: Pipeline
                    collection:
                      id: 1CLJt2ue2wzMeQ5XRuS4TZ
                      type: collection
                      ref: deals
                    filter:
                      op: contains
                      field: name
                      value: Acme
                    sort:
                      - '-name'
                    groups:
                      - stage
                    aggregates:
                      - type: field_statistic
                        statistic: sum
                        value: amount
                        group: stage
                    fields:
                      - field: name
                      - field: organization
                      - field: owner
                      - field: amount
                      - field: probability
                      - field: close_date
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '400'
                        title: Bad Request
                        detail: >-
                          The request could not be understood due to malformed
                          syntax or invalid parameters.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '401'
                        title: Unauthorized
                        detail: >-
                          Invalid or missing API key or JWT. You should provide
                          your Moonbase API Key or JWT in the authorization
                          header, in the format: "Authorization: Bearer
                          MOONBASE_API_KEY"
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '403'
                        title: Forbidden
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Not found:
                  summary: Not found
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '404'
                        title: Not Found
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '429'
                        title: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '500'
                        title: Internal Server Error
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
              examples:
                Default:
                  summary: Default
                  value:
                    type: errors
                    errors:
                      - type: error
                        status: '503'
                        title: Service Unavailable
                        detail: >-
                          The service is temporarily unavailable, please try
                          again later.
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Moonbase from '@moonbaseai/sdk';

            const client = new Moonbase({
              apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
            });

            const view = await client.views.retrieve('id');

            console.log(view.id);
        - lang: Python
          source: |-
            import os
            from moonbase import Moonbase

            client = Moonbase(
                api_key=os.environ.get("MOONBASE_API_KEY"),  # This is the default and can be omitted
            )
            view = client.views.retrieve(
                "id",
            )
            print(view.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/moonbaseai/moonbase-sdk-go\"\n\t\"github.com/moonbaseai/moonbase-sdk-go/option\"\n)\n\nfunc main() {\n\tclient := moonbase.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tview, err := client.Views.Get(context.TODO(), \"id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", view.ID)\n}\n"
        - lang: Ruby
          source: |-
            require "moonbase"

            moonbase = Moonbase::Client.new(api_key: "My API Key")

            view = moonbase.views.retrieve("id")

            puts(view)
components:
  schemas:
    View:
      title: View
      description: >-
        A View represents a saved configuration for displaying items in a
        collection, including filters and sorting rules.
      type: object
      properties:
        type:
          description: >-
            String representing the object’s type. Always `view` for this
            object.
          type: string
          const: view
        id:
          description: Unique identifier for the object.
          type: string
        view_type:
          description: The type of view, such as `table` or `board`.
          type: string
          enum:
            - table
            - board
        name:
          description: The name of the view.
          type: string
        collection:
          $ref: '#/components/schemas/CollectionPointer'
          description: The `Collection` this view belongs to.
        filter:
          description: >-
            The filter applied to the view's items, or `null` when the view has
            no filter.
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ItemsFilter'
        sort:
          $ref: '#/components/schemas/ItemsSort'
          description: >-
            Sort items returned by the specified fields. Empty when the view has
            no sort.
        groups:
          $ref: '#/components/schemas/ViewGroups'
          description: >-
            Fields whose values group the view's items. Empty when the view is
            not grouped.
        aggregates:
          description: The metrics computed over the view's items.
          type: array
          items:
            $ref: '#/components/schemas/ViewAggregate'
        fields:
          $ref: '#/components/schemas/ViewFields'
          description: The view's columns, in display order.
        relation_value_filters:
          description: >-
            Filters limiting which related items the view's relation columns
            show.
          type: array
          items:
            $ref: '#/components/schemas/ViewRelationValueFilter'
        created_at:
          description: >-
            Time at which the object was created, as an ISO 8601 timestamp in
            UTC.
          type: string
          format: date-time
        updated_at:
          description: >-
            Time at which the object was last updated, as an ISO 8601 timestamp
            in UTC.
          type: string
          format: date-time
      required:
        - collection
        - name
        - type
        - id
        - view_type
        - filter
        - sort
        - groups
        - aggregates
        - fields
        - relation_value_filters
        - created_at
        - updated_at
    Errors:
      title: Errors
      description: >-
        The Errors object is a container that holds multiple Error objects when
        an API request encounters several validation or processing issues. This
        allows the API to return comprehensive feedback about all problems
        encountered in a single response.
      type: object
      properties:
        type:
          type: string
          const: errors
        errors:
          description: A list of `Error` objects.
          type: array
          items:
            $ref: '#/components/schemas/Error'
      required:
        - type
    CollectionPointer:
      title: CollectionPointer
      description: >-
        A lightweight reference to a `Collection`, containing the minimal
        information needed to identify it.
      type: object
      properties:
        type:
          description: >-
            String representing the object’s type. Always `collection` for this
            object.
          type: string
          const: collection
        id:
          description: Unique identifier of the collection.
          type: string
        ref:
          description: The stable, machine-readable reference identifier of the collection.
          type: string
      required:
        - type
        - id
        - ref
    ItemsFilter:
      title: ItemsFilter
      description: >-
        Return only items that match the filter conditions. Complex filters can
        be created by nesting filters inside of `AND`, `OR`, and `NOT` filters.
      oneOf:
        - $ref: '#/components/schemas/ItemsFilterValueMatches'
          title: Match Value
        - $ref: '#/components/schemas/ItemsFilterValueExists'
          title: Value Exists
        - $ref: '#/components/schemas/ItemsFilterAndGroup'
          title: AND
        - $ref: '#/components/schemas/ItemsFilterOrGroup'
          title: OR
        - $ref: '#/components/schemas/ItemsFilterNotGroup'
          title: NOT
      discriminator:
        propertyName: op
        mapping:
          starts_with:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          ends_with:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          contains:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          not_contains:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          eq:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          not_eq:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          gt:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          lt:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          gte:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          lte:
            $ref: '#/components/schemas/ItemsFilterValueMatches'
          exists:
            $ref: '#/components/schemas/ItemsFilterValueExists'
          and:
            $ref: '#/components/schemas/ItemsFilterAndGroup'
          or:
            $ref: '#/components/schemas/ItemsFilterOrGroup'
          not:
            $ref: '#/components/schemas/ItemsFilterNotGroup'
    ItemsSort:
      description: >-
        Sort items returned by the specified fields, specified directly by
        (`name`) or through relations (`organization.name`,
        `deals.owner.email`). Prefix with a hyphen/minus (`-`) to sort in
        descending order.
      type: array
      items:
        type: string
    ViewGroups:
      description: >-
        Fields whose values bucket the items. Currently only one group is
        supported.
      type: array
      maxItems: 1
      items:
        $ref: '#/components/schemas/FieldPath'
    ViewAggregate:
      title: ViewAggregate
      description: A metric computed over the view's items.
      oneOf:
        - $ref: '#/components/schemas/ViewAggregateItemCount'
          title: Item Count
        - $ref: '#/components/schemas/ViewAggregateFieldStatistic'
          title: Field Statistic
      discriminator:
        propertyName: type
        mapping:
          item_count:
            $ref: '#/components/schemas/ViewAggregateItemCount'
          field_statistic:
            $ref: '#/components/schemas/ViewAggregateFieldStatistic'
    ViewFields:
      description: >-
        The view's columns, in display order. A view must have at least one
        column.
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/ViewField'
    ViewRelationValueFilter:
      title: ViewRelationValueFilter
      description: >-
        Limits which related items a relation column shows: only related items
        matching `filter` appear.
      type: object
      properties:
        field:
          $ref: '#/components/schemas/FieldPath'
          description: The relation column whose related items are filtered.
        filter:
          description: >-
            The filter the related items must match. Field paths are relative to
            the related collection.
          oneOf:
            - $ref: '#/components/schemas/ItemsFilter'
              description: >-
                The filter the related items must match. Field paths are
                relative to the related collection.
      required:
        - field
        - filter
    Error:
      title: Error
      description: >-
        The Error object represents a single error that occurred during API
        request processing. It provides detailed information about what went
        wrong, including a unique identifier, status code, and human-readable
        descriptions to help developers understand and resolve the issue.
      type: object
      properties:
        type:
          type: string
          const: error
        id:
          description: A unique identifier for this specific error instance.
          type: string
        status:
          description: The HTTP status code for this problem, as a string.
          type: string
        code:
          description: An application-specific error code string.
          type: string
        title:
          description: A short, human-readable summary of the problem.
          type: string
        detail:
          description: A human-readable explanation of this specific error.
          type: string
        source:
          $ref: '#/components/schemas/ErrorSource'
          description: >-
            An object containing more specific information about the part of the
            request that caused the error.
        meta:
          type: object
          additionalProperties: true
      required:
        - type
    ItemsFilterValueMatches:
      title: ItemsFilterValueMatches
      description: >-
        Include only items with a value in the given `field` that satisfies the
        `op` condition.
      type: object
      properties:
        op:
          description: The matching operator for this filter.
          type: string
          enum:
            - starts_with
            - ends_with
            - contains
            - not_contains
            - eq
            - not_eq
            - gt
            - lt
            - gte
            - lte
        field:
          $ref: '#/components/schemas/FieldPath'
          description: >-
            The id or key of the field in which values are matched, or a path to
            the field in which values are matched.
        value:
          description: >-
            The value to match against. Use ISO8601 format for dates and
            datetime fields. For date fields, the time portion of the date-time
            will be ignored. For currency fields, the amount should be in the
            smallest unit of currency (eg: cents for USD).
          oneOf:
            - type: string
            - type: number
            - type: boolean
      required:
        - op
        - field
        - value
    ItemsFilterValueExists:
      title: ItemsFilterValueExists
      description: Include only items that have a value in the given `field`.
      type: object
      properties:
        op:
          type: string
          const: exists
        field:
          $ref: '#/components/schemas/FieldPath'
          description: >-
            The id or key of the field for which a value must exist, or a path
            to the field for which a value must exist.
      required:
        - op
        - field
    ItemsFilterAndGroup:
      title: ItemsFilterAndGroup
      description: Include only items that match ALL of the filters in `filters`.
      type: object
      properties:
        op:
          type: string
          const: and
        filters:
          description: >-
            An array of filters, ALL of which must be satisfied for this `and`
            filter to match.
          type: array
          items:
            $ref: '#/components/schemas/ItemsFilter'
      required:
        - op
        - filters
    ItemsFilterOrGroup:
      title: ItemsFilterOrGroup
      description: Include only items that match ANY of the filters in `filters`.
      type: object
      properties:
        op:
          type: string
          const: or
        filters:
          description: >-
            An array of filters, ANY of which must be satisfied for this `or`
            filter to match.
          type: array
          items:
            $ref: '#/components/schemas/ItemsFilter'
      required:
        - op
        - filters
    ItemsFilterNotGroup:
      title: ItemsFilterNotGroup
      description: Include only items that do NOT match the nested `filter`.
      type: object
      properties:
        op:
          type: string
          const: not
        filter:
          description: >-
            A filter which must NOT match in order for this `not` filter to
            match.
          oneOf:
            - $ref: '#/components/schemas/ItemsFilter'
              description: >-
                A nested filter which must NOT match in order for this `not`
                filter to match.
      required:
        - op
        - filter
    FieldPath:
      description: >-
        Identifies a field directly (`name`) or through relations
        (`organization.name`, `deals.owner.email`). Every segment before the
        last is a relation field; the last is the field you want. Keys
        preferred; use ids to disambiguate where there are multiple allowed
        collections.
      type: string
    ViewAggregateItemCount:
      title: ViewAggregateItemCount
      description: Counts the view's items.
      type: object
      properties:
        type:
          type: string
          const: item_count
        group:
          $ref: '#/components/schemas/FieldPath'
          description: An optional field whose values bucket the counts.
      required:
        - type
    ViewAggregateFieldStatistic:
      title: ViewAggregateFieldStatistic
      description: Computes a statistic over the values of a field.
      type: object
      properties:
        type:
          type: string
          const: field_statistic
        statistic:
          description: >-
            The statistic to compute. Scalar statistics (sum, mean, max, min)
            require a number field as `value`.
          type: string
          enum:
            - count
            - sum
            - mean
            - max
            - min
            - filled_percentage
        value:
          $ref: '#/components/schemas/FieldPath'
          description: The field whose values the statistic is computed over.
        group:
          $ref: '#/components/schemas/FieldPath'
          description: An optional field whose values bucket the statistic.
        weight:
          $ref: '#/components/schemas/FieldPath'
          description: >-
            An optional percentage field used to weight the statistic. Only
            supported for scalar statistics.
      required:
        - type
        - statistic
        - value
    ViewField:
      title: ViewField
      description: A column of the view.
      type: object
      properties:
        field:
          $ref: '#/components/schemas/FieldPath'
          description: The field shown in this column.
        display_fields:
          description: >-
            Which fields of the related item to show, relative to the related
            collection. Omitted means the related collection's default display
            fields.
          type: array
          items:
            $ref: '#/components/schemas/FieldPath'
        is_pinned:
          description: Whether the column is pinned.
          type: boolean
        size:
          description: >-
            The column width: a number of pixels, or `fit` (size to content), or
            `flex` (fill available space).
          oneOf:
            - type: number
            - type: string
              enum:
                - fit
                - flex
        is_wrapped:
          description: Whether the column wraps its content.
          type: boolean
      required:
        - field
    ErrorSource:
      title: ErrorSource
      description: >-
        The ErrorSource object provides additional context about the specific
        part of an API request that caused an error. It can point to either a
        field in the request document or a query parameter that contains invalid
        data.
      type: object
      properties:
        pointer:
          description: >-
            A JSON Pointer [RFC6901] to the associated entity in the request
            document.
          type: string
        parameter:
          description: A string indicating which URI query parameter caused the error.
          type: string
      required: []
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: Your Moonbase API key.

````