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

# POST /schema

`POST /schema`

Add a new schema definition

## Response `200`

Collection(s)

- 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
- `default`

## Changes

- **2025-10-16** `df7e1a7888ba` — 1 info
  - added the optional property `items/EncryptedIndexes` to the response with the `200` status
- **2025-10-07** `dfcbfe5a5263` — 1 warning, 1 info
  - removed the optional property `items/VersionSources` from the response with the `200` status
  - added the optional property `items/PreviousVersion` to the response with the `200` status
- **2025-10-04** `728b66fe87a3` — 1 warning, 2 info
  - removed the optional property `items/Sources` from the response with the `200` status
  - added the optional property `items/Query` to the response with the `200` status
  - added the optional property `items/VersionSources` to the response with the `200` status
- **2025-08-12** `9b34d7c2f707` — 5 info
  - added the optional property `items/CollectionSet` to the response with the `200` status
  - added the optional property `items/Fields/items/FieldID` to the response with the `200` status
  - added the optional property `items/Fields/items/IsPrimary` to the response with the `200` status
  - added the optional property `items/Fields/items/Typ` to the response with the `200` status
  - …1 more
- **2025-06-02** `60812f5416c5` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/sourcenetwork/apis/defradb-api/changes/schema/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/4a12c8ff8b60/schema)
