---
title: "Create Collection"
method: POST
path: "/collections"
tags: ["Collection"]
---

# Create Collection

`POST /collections`

## Request

- Base URL: `https://data.lucid.app`
- URL: `https://data.lucid.app/collections`
- Auth: OAuth 2
  - Authorization code: `https://lucid.app/oauth2/authorize`
  - Token URL: `https://api.lucid.co/oauth2/token` scopes: `data-service.admin`

Creates a new collection for the specified data source. Only succeeds if the user has access to the data source.

## Request body

- object
  - `dataSource` string, required: URI of data source to add collection to
  - `name` string, required: Name of the new collection
  - `schema` object[], required: The schema field takes an array of Field Definition objects
    - `uri` string, required: Link to self
    - `name` string, required: Name of the field
    - `fieldType` string, required: Stores the type of the field. The type does not affect how the data is interpreted in the Data Service; it is for use on the client side. Valid values include `BOOLEAN`, `STRING`, `NUMBER`, and `ANY`.
    - `collection` string, required: Link to the associated collection
    - `isPrimary` boolean, required: Denotes whether the specified field is part of the primary key. The default value is false
    - `order` string: Denotes a default ordering for the fields. This is currently used by the Lucid client to determine the order in which the fields are displayed, unless the context suggests a better ordering.
    - `default` string: Default value for this field
    - `label` string: Override name for field which is used when displaying to users
  - `properties` object, required: The properties field takes an object of key-value pairs

## Response `200`

OK with Collection

- object
  - `uri` string, required: URI of the collection
  - `dataSource` string, required: Link to get parent data source
  - `name` string, required: Name of the collection
  - `lastSync` string, required: Date the collection was last synced with upstream source
  - `versionTimestamp` string, required: Timestamp of the last time the collection, the collection's schema, the collection's contents, one of its collection properties, or anything in any of its metadata collections was changed. It can be used to tell if a copy of the data is out of date and needs to be refreshed.
  - `created` string, required: Date the collection was created
  - `lastModified` string, required: Date the collection was last modified
  - `items` string, required: Link to get items in the collection
  - `schema` string, required: Link to get schema for the collection
  - `properties` string, required: Link to get properties for the collection
  - `metadata` string, required: Link to get metadata for the collection
  - `metadataType` string: If a metadata collection, this specifies what tyep of metadata it contains
  - `parent` string: If a metadata collection, this link will get its parent collection
  - `syncStarted` string: Represents the sync status of the collection. When it is null, there is no sync happening. When it has a DateTime value, that value represents the start time for the sync that is currently happening.
  - `deleted` string: Date the collection was deleted

---

[API](https://skmtc.dev/lucid/apis/lucid-data-api.md) - [All operations](https://skmtc.dev/lucid/apis/lucid-data-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lucid/apis/lucid-data-api/revisions/c14ed29dbeab?raw)
