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

# POST /view

`POST /view`

Manage database views.

## Request body

- AddViewRequest
  - `Query` string
  - `SDL` string
  - `Transform` unknown

## Response `200`

The created collection and embedded schemas for the added view.

- union
  - CollectionDefinition
    - `schema` object
      - `Fields` object[]
        - `Kind` unknown
        - `Name` string
        - `Typ` integer
      - `Name` string
      - `Root` string
      - `VersionID` string
    - `version` object
      - `CollectionID` string
      - `Fields` object[]
        - `DefaultValue` unknown
        - `Kind` unknown
        - `Name` string
        - `RelationName` unknown
        - `Size` integer
      - `Indexes` object[]
        - `Fields` object[]
          - `Descending` boolean
          - `Name` string
        - `ID` integer
        - `Name` string
        - `Unique` boolean
      - `IsActive` boolean
      - `IsBranchable` boolean
      - `IsEmbeddedOnly` boolean
      - `IsMaterialized` boolean
      - `Name` string
      - `Policy` unknown
      - `Sources` unknown[]
        - unknown
      - `VectorEmbeddings` object[]
        - `FieldName` string
        - `Fields` string[]
        - `Model` string
        - `Provider` string
        - `Template` string
        - `URL` string
      - `VersionID` string
  - CollectionDefinition[]
    - `schema` object
      - `Fields` object[]
        - `Kind` unknown
        - `Name` string
        - `Typ` integer
      - `Name` string
      - `Root` string
      - `VersionID` string
    - `version` object
      - `CollectionID` string
      - `Fields` object[]
        - `DefaultValue` unknown
        - `Kind` unknown
        - `Name` string
        - `RelationName` unknown
        - `Size` integer
      - `Indexes` object[]
        - `Fields` object[]
          - `Descending` boolean
          - `Name` string
        - `ID` integer
        - `Name` string
        - `Unique` boolean
      - `IsActive` boolean
      - `IsBranchable` boolean
      - `IsEmbeddedOnly` boolean
      - `IsMaterialized` boolean
      - `Name` string
      - `Policy` unknown
      - `Sources` unknown[]
        - unknown
      - `VectorEmbeddings` object[]
        - `FieldName` string
        - `Fields` string[]
        - `Model` string
        - `Provider` string
        - `Template` string
        - `URL` string
      - `VersionID` string

## Other responses

- `400` — error
- `default`

## Changes

- **2025-06-02** `60812f5416c5` — 1 breaking, 17 warning, 4 info
  - added `#/components/schemas/collection_definition` to the response body `oneOf` list for the response status `200`
  - removed the request property `TransformCID`
  - removed the optional property `oneOf[subschema #2]/items/CollectionID` from the response with the `200` status
  - removed the optional property `oneOf[subschema #2]/items/CollectionSet` from the response with the `200` status
  - …18 more

[Change 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/46fc37694485/schema)
