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

# Update pinned deal views

> Set the deal views a user has pinned to the tab bar of the deals table. The ordered list replaces the current one, so a single call pins, unpins and reorders views.

Replaces the deal views a user has pinned to the tab bar of the deals table. Send the full ordered list: a single call pins, unpins and reorders views. `viewIds` must contain at least one view.

A user can pin public views, the private views they can access and built-in default views. The update fails, and nothing changes, if `viewIds` contains duplicates or a view the user cannot access.

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url 'https://api.claap.io/v1/deals/views/pinned?userEmail=jane.doe%40example.com' \
    --header 'Content-Type: application/json' \
    --header 'X-Claap-Key: <api-key>' \
    --data '{
    "viewIds": [
      "Default_MyDeals",
      "Vw3Hc9Lt5Kd1Qp7Zm2Rf6"
    ]
  }'
  ```
</RequestExample>


## OpenAPI

````yaml PUT /v1/deals/views/pinned
openapi: 3.1.0
info:
  title: Claap API
  description: Development documentation
  version: 0.0.0
servers:
  - url: https://api.claap.io/
security:
  - ApiKey: []
paths:
  /v1/deals/views/pinned:
    put:
      description: >-
        Set the deal views a user has pinned to the tab bar of the deals table.
        The ordered list replaces the current one, so a single call pins, unpins
        and reorders views.
      operationId: putV1DealsViewsPinned
      parameters:
        - in: query
          name: userEmail
          schema:
            type: string
            format: email
            description: >-
              Email address of the user whose pinned views are updated. It must
              belong to an active workspace member.
            example: jane.doe@example.com
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                viewIds:
                  type: array
                  items:
                    type: string
                  description: >-
                    Identifiers of the views to pin, in tab bar order. Replaces
                    the current pinned views. Must contain at least one view;
                    each view must be accessible to the user, and must appear
                    only once.
                  minItems: 1
              required:
                - viewIds
            example:
              viewIds:
                - Default_MyDeals
                - Vw3Hc9Lt5Kd1Qp7Zm2Rf6
      responses:
        '200':
          description: Pinned deal views were successfully updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      $ref: '#/components/schemas/DealView'
                required:
                  - result
              example:
                result:
                  - viewId: Default_MyDeals
                    name: My deals
                    visibility: Public
                    icon: ':bust_in_silhouette:'
                    isDefault: true
                    ownerId: '#global'
                    columns:
                      - type: Default
                        columnId: Title
                        isHidden: false
                      - type: Default
                        columnId: OwnerName
                        isHidden: false
                      - type: Default
                        columnId: Stage
                        isHidden: false
                    filters:
                      ownerEmailIn:
                        - type: Me
                    sort:
                      - field: LastInteraction
                        order: Desc
                  - viewId: Vw3Hc9Lt5Kd1Qp7Zm2Rf6
                    name: Enterprise pipeline
                    visibility: Public
                    icon: ':rocket:'
                    isDefault: false
                    ownerId: Xk2Rd7Mv4Bn9Ts1Lq6Wf3
                    columns:
                      - type: Default
                        columnId: Title
                        isHidden: false
                      - type: Default
                        columnId: Stage
                        isHidden: false
                      - type: Default
                        columnId: Amount
                        isHidden: false
                        width: 160
                    filters:
                      statusIn:
                        - Open
                      typeIn:
                        - newbusiness
                    sort:
                      - field: AmountValue
                        order: Desc
        '400':
          description: >-
            `userEmail` is not the email address of an active workspace member,
            `viewIds` is empty or contains duplicates, or a view does not exist
            or is not accessible to the user. Nothing is updated.
        '403':
          description: The workspace plan does not include deals.
components:
  schemas:
    DealView:
      type: object
      properties:
        viewId:
          type: string
          description: The view identifier.
        name:
          type: string
          description: The view name.
        visibility:
          type: string
          enum:
            - Public
            - Private
          description: >-
            The view visibility. `Private` views are only returned by the pinned
            views endpoints; the other endpoints only access `Public` views.
        icon:
          type: string
          description: The view icon.
        isDefault:
          type: boolean
          description: >-
            Whether the view is a built-in default view. Default views cannot be
            updated or deleted.
        ownerId:
          type: string
          description: >-
            Claap user identifier of the view owner, or `#global` for built-in
            default views.
        columns:
          type: array
          items:
            $ref: '#/components/schemas/DealViewColumn'
          description: The columns of the deals table.
        filters:
          $ref: '#/components/schemas/DealViewFilters'
        sort:
          type: array
          items:
            $ref: '#/components/schemas/DealViewSortDimension'
          description: The sort order of the deals table.
      required:
        - viewId
        - name
        - visibility
        - isDefault
        - ownerId
        - columns
        - filters
        - sort
      description: A saved view of the deals table.
    DealViewColumn:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - Default
              description: Discriminates default columns from AI section columns.
            columnId:
              type: string
              description: The built-in column identifier.
            isHidden:
              type: boolean
              description: Whether the column is hidden in the table.
              default: false
            width:
              type: number
              description: The column width, in pixels.
          required:
            - type
            - columnId
          description: A built-in deal column.
        - type: object
          properties:
            type:
              type: string
              enum:
                - AiSection
              description: Discriminates AI section columns from default columns.
            fieldId:
              type: string
              description: >-
                Identifier of the AI field (aka insight) displayed in the
                column.
            title:
              type: string
              description: The column title.
            hasAutogen:
              type: boolean
              description: Whether the insight is automatically generated for new deals.
            isConfigured:
              type: boolean
              description: Whether the section configuration is complete.
            isHidden:
              type: boolean
              description: Whether the column is hidden in the table.
              default: false
            width:
              type: number
              description: The column width, in pixels.
          required:
            - type
            - fieldId
            - title
          description: A column displaying an AI insight for each deal.
      description: >-
        A column of the deals table, either a built-in column (`Default`) or an
        AI insight column (`AiSection`).
    DealViewFilters:
      type: object
      properties:
        aiStatusIn:
          type: array
          items:
            type: string
            enum:
              - Active
              - AtRisk
              - Lost
              - NeedsAction
              - OnTrack
              - Stalled
              - Won
          description: Only include deals with one of these AI statuses.
          default: []
        aiStatusNotIn:
          type: array
          items:
            type: string
            enum:
              - Active
              - AtRisk
              - Lost
              - NeedsAction
              - OnTrack
              - Stalled
              - Won
          description: Exclude deals with one of these AI statuses.
          default: []
        amountCurrencyIn:
          type: array
          items:
            type: string
          description: Only include deals whose amount uses one of these currencies.
          default: []
        amountCurrencyNotIn:
          type: array
          items:
            type: string
          description: Exclude deals whose amount uses one of these currencies.
          default: []
        amountValue:
          $ref: '#/components/schemas/ViewNumericFilter'
          description: Filter on the deal amount.
        closedAfterRelative:
          type: number
          description: >-
            Only include deals closed after this number of days in the past. For
            instance 30 keeps deals closed within the last 30 days.
        closedBeforeRelative:
          type: number
          description: Only include deals closed before this number of days in the past.
        companyIdIn:
          type: array
          items:
            type: string
          description: Only include deals linked to one of these CRM company identifiers.
          default: []
        companyIdNotIn:
          type: array
          items:
            type: string
          description: Exclude deals linked to one of these CRM company identifiers.
          default: []
        contactIdIn:
          type: array
          items:
            type: string
          description: Only include deals linked to one of these CRM contact identifiers.
          default: []
        dealAgeRange:
          type: string
          enum:
            - ZeroDay
            - OneDay
            - LessThan7Days
            - LessThan15Days
            - LessThan30Days
            - LessThan90Days
            - LessThan180Days
            - MoreThan180Days
          description: Only include deals whose age falls in this range.
        hasInteraction:
          type: boolean
          description: >-
            Only include deals with (true) or without (false) at least one
            interaction.
        openedAfterRelative:
          type: number
          description: Only include deals opened after this number of days in the past.
        openedBeforeRelative:
          type: number
          description: Only include deals opened before this number of days in the past.
        ownerEmailIn:
          type: array
          items:
            $ref: '#/components/schemas/ViewEmailFilter'
          description: Only include deals whose owner matches one of these entries.
          default: []
        ownerEmailNotIn:
          type: array
          items:
            $ref: '#/components/schemas/ViewEmailFilter'
          description: Exclude deals whose owner matches one of these entries.
          default: []
        pipelineIdIn:
          type: array
          items:
            type: string
          description: Only include deals belonging to one of these pipelines.
          default: []
        pipelineIdNotIn:
          type: array
          items:
            type: string
          description: Exclude deals belonging to one of these pipelines.
          default: []
        stageIn:
          type: array
          items:
            type: string
          description: Only include deals in one of these stages.
          default: []
        stageNotIn:
          type: array
          items:
            type: string
          description: Exclude deals in one of these stages.
          default: []
        statusIn:
          type: array
          items:
            type: string
            enum:
              - Lost
              - Open
              - Won
          description: Only include deals with one of these statuses.
          default: []
        statusNotIn:
          type: array
          items:
            type: string
            enum:
              - Lost
              - Open
              - Won
          description: Exclude deals with one of these statuses.
          default: []
        typeIn:
          type: array
          items:
            type: string
          description: Only include deals with one of these types.
          default: []
        typeNotIn:
          type: array
          items:
            type: string
          description: Exclude deals with one of these types.
          default: []
        userGroupIn:
          type: array
          items:
            type: string
          description: Only include deals owned by a member of one of these user groups.
          default: []
        userGroupNotIn:
          type: array
          items:
            type: string
          description: Exclude deals owned by a member of one of these user groups.
          default: []
      description: >-
        The filters applied by the view to the deals table. All set filters must
        match.
    DealViewSortDimension:
      type: object
      properties:
        field:
          type: string
          enum:
            - AmountCurrency
            - AmountValue
            - ClosedAt
            - CompanyName
            - ContactName
            - DealAge
            - Insight
            - LastInteraction
            - OpenedAt
            - OwnerName
            - Pipeline
            - Stage
            - Status
            - Title
            - Type
          description: The field to sort deals by.
        insight:
          type: object
          properties:
            fieldId:
              type: string
              description: Identifier of the AI field (aka insight) to sort by.
          required:
            - fieldId
          description: Required when `field` is `Insight`, ignored otherwise.
        order:
          type: string
          enum:
            - Asc
            - Desc
          description: The sort direction.
      required:
        - field
        - order
      description: A sort dimension of the deals table.
    ViewNumericFilter:
      type: object
      properties:
        exists:
          type: boolean
          description: >-
            Set to true to only match items where the value is set, false to
            only match items where it is missing.
        gte:
          type: number
          description: Only match values greater than or equal to this number.
        is:
          type: number
          description: Only match values equal to this number.
        isNot:
          type: number
          description: Only match values different from this number.
        lte:
          type: number
          description: Only match values less than or equal to this number.
      description: >-
        Filter on a numeric value. Combine `gte` and `lte` for ranges, or use
        `is`/`isNot` for exact matches.
    ViewEmailFilter:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - Email
            email:
              type: string
              description: The email address.
          required:
            - type
            - email
          description: Matches a specific email address.
        - type: object
          properties:
            type:
              type: string
              enum:
                - Me
          required:
            - type
          description: >-
            Dynamically matches the user viewing the table in the Claap
            application.
      description: >-
        References either a specific email address or `Me`, which resolves to
        whoever is viewing the table in the Claap application.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Claap-Key

````

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