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

# Add a nesting rule to a shared saved view

> Requires Admin access. Appends one rule ("under `parentType`, show items of `childType`") after the view's other rules, which are kept. A rule is identified by its `parentType` and `childType`: sending a rule the view already has, with the same direction, changes nothing, so a retry is safe; the same pair with another direction answers 409. Returns the view.



## OpenAPI

````yaml /openapi/customer-api.json post /project/{projectId}/views/saved/{viewId}/relationships
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Flow customer API reference. Start with the [quickstart](/api/quickstart)
    and [authentication guide](/api/authentication).
  title: Customer API
  version: 1.0.0
servers:
  - description: Flow API
    url: '{baseUrl}'
    variables:
      baseUrl:
        default: https://backend.branch.flowengineering.com
security: []
tags:
  - name: Audit
  - name: Automations
  - name: Branches
  - name: Comments
  - name: Convert
  - name: Data Model
  - name: Diagrams
  - name: Entities
  - name: Events
  - name: Files
  - name: Import
  - name: Notifications
  - name: Persistent agents
  - name: Projects
  - name: ReqIF
  - name: ReqIF Import
  - name: Review policy
  - name: Shared Access Grants
  - name: User Groups
  - name: Users
  - name: Views
paths:
  /project/{projectId}/views/saved/{viewId}/relationships:
    post:
      tags:
        - Views
      summary: Add a nesting rule to a shared saved view
      description: >-
        Requires Admin access. Appends one rule ("under `parentType`, show items
        of `childType`") after the view's other rules, which are kept. A rule is
        identified by its `parentType` and `childType`: sending a rule the view
        already has, with the same direction, changes nothing, so a retry is
        safe; the same pair with another direction answers 409. Returns the
        view.
      operationId: ViewsController_addSavedViewRelationship
      parameters:
        - in: path
          name: projectId
          required: true
          schema:
            type: string
        - in: path
          name: viewId
          required: true
          schema:
            type: string
        - description: Workspace identifier
          in: header
          name: customer
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SavedViewRelationshipDto'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SharedSavedViewDto'
          description: ''
        '409':
          description: The view already has a rule for this pair with another direction.
      security:
        - api-key: []
        - bearer: []
components:
  schemas:
    SavedViewRelationshipDto:
      properties:
        childType:
          description: Data type id of the items shown under each parent.
          type: string
        direction:
          description: >-
            Which links the view follows from parent to child: `downstream` (the
            parent links to the child), `upstream` (the child links to the
            parent) or `both`. Defaults to `both`.
          enum:
            - upstream
            - downstream
            - both
          type: string
        parentType:
          description: Data type id of the parent.
          type: string
      required:
        - parentType
        - childType
      type: object
    SharedSavedViewDto:
      properties:
        icon:
          $ref: '#/components/schemas/SavedViewIconDto'
        id:
          type: string
        name:
          type: string
        position:
          description: Display order among the shared views.
          type: number
        state:
          additionalProperties: true
          description: >-
            The view configuration: `rootType`, `relationships`, `columns`,
            `filters` and `sort` as written here, plus display options edited in
            Flow.
          type: object
      required:
        - id
        - name
      type: object
    SavedViewIconDto:
      properties:
        colour:
          description: Icon color, as data types use.
          type: string
        icon:
          description: Icon name, as data types use.
          type: string
      required:
        - icon
        - colour
      type: object
  securitySchemes:
    api-key:
      in: header
      name: X-API-Key
      type: apiKey
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````

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