---
title: "POST /view"
method: POST
path: "/view"
tags: ["view"]
---

# POST /view

`POST /view`

Manage database views.

## Request body

- AddViewRequest
  - `Query` string
  - `SDL` string
  - `TransformCID` unknown

## Response `200`

The added collection and embedded schemas for the added view.

- union
  - Collection
    - `CollectionID` string
    - `CollectionSet` unknown
    - `EncryptedIndexes` object[]
      - `FieldName` string
      - `Type` string
    - `Fields` object[]
      - `DefaultValue` unknown
      - `FieldID` string
      - `IsPrimary` boolean
      - `Kind` unknown
      - `Name` string
      - `RelationName` unknown
      - `Size` integer
      - `Typ` integer
    - `Indexes` object[]
      - `Fields` object[]
        - `Descending` boolean
        - `Name` string
      - `ID` integer
      - `Name` string
      - `Unique` boolean
    - `IsActive` boolean
    - `IsBranchable` boolean
    - `IsEmbeddedOnly` boolean
    - `IsMaterialized` boolean
    - `IsPlaceholder` boolean
    - `Name` string
    - `Policy` unknown
    - `PreviousVersion` unknown
    - `Query` unknown
    - `VectorEmbeddings` object[]
      - `FieldName` string
      - `Fields` string[]
      - `Model` string
      - `Provider` string
      - `Template` string
      - `URL` string
    - `VersionID` string
  - Collection[]
    - `CollectionID` string
    - `CollectionSet` unknown
    - `EncryptedIndexes` object[]
      - `FieldName` string
      - `Type` string
    - `Fields` object[]
      - `DefaultValue` unknown
      - `FieldID` string
      - `IsPrimary` boolean
      - `Kind` unknown
      - `Name` string
      - `RelationName` unknown
      - `Size` integer
      - `Typ` integer
    - `Indexes` object[]
      - `Fields` object[]
        - `Descending` boolean
        - `Name` string
      - `ID` integer
      - `Name` string
      - `Unique` boolean
    - `IsActive` boolean
    - `IsBranchable` boolean
    - `IsEmbeddedOnly` boolean
    - `IsMaterialized` boolean
    - `IsPlaceholder` boolean
    - `Name` string
    - `Policy` unknown
    - `PreviousVersion` unknown
    - `Query` unknown
    - `VectorEmbeddings` object[]
      - `FieldName` string
      - `Fields` string[]
      - `Model` string
      - `Provider` string
      - `Template` string
      - `URL` string
    - `VersionID` string

## Other responses

- `400` — error

## Changes

- **2025-12-18** `efaa6f29c460` — 1 warning, 1 info
  - removed the request property `Transform`
  - added the new optional request property `TransformCID`
- **2025-10-16** `df7e1a7888ba` — 2 info
  - added the optional property `oneOf[#/components/schemas/collection]/EncryptedIndexes` to the response with the `200` status
  - added the optional property `oneOf[subschema #2]/items/EncryptedIndexes` to the response with the `200` status
- **2025-10-07** `dfcbfe5a5263` — 2 warning, 2 info
  - removed the optional property `oneOf[#/components/schemas/collection]/VersionSources` from the response with the `200` status
  - removed the optional property `oneOf[subschema #2]/items/VersionSources` from the response with the `200` status
  - added the optional property `oneOf[#/components/schemas/collection]/PreviousVersion` to the response with the `200` status
  - added the optional property `oneOf[subschema #2]/items/PreviousVersion` to the response with the `200` status
- …earlier changes not shown

[Full history](https://skmtc.dev/sourcenetwork/apis/defradb-api/changes/view/post.md)

---

[API](https://skmtc.dev/sourcenetwork/apis/defradb-api.md) · [All operations](https://skmtc.dev/sourcenetwork/apis/defradb-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/sourcenetwork/defradb-api/revisions/bf2e90fa690e/schema)
