Skip to main content
POST
/
api
/
v1
/
collections
Create Collection
curl --request POST \
  --url https://api.example.com/api/v1/collections \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "schema": [
    {
      "name": "<string>",
      "type": "<string>",
      "required": false,
      "default": "<unknown>",
      "unique": false,
      "options": {},
      "collection": "<string>",
      "on_delete": "<string>",
      "pii": false,
      "mask_type": "<string>",
      "expression": "<string>",
      "return_type": "<string>"
    }
  ],
  "list_rule": "<string>",
  "view_rule": "<string>",
  "create_rule": "<string>",
  "update_rule": "<string>",
  "delete_rule": "<string>",
  "list_fields": "*",
  "view_fields": "*",
  "create_fields": "*",
  "update_fields": "*"
}
'
{
  "id": "<string>",
  "name": "<string>",
  "table_name": "<string>",
  "schema": [
    {
      "name": "<string>",
      "type": "<string>",
      "required": false,
      "default": "<unknown>",
      "unique": false,
      "options": {},
      "collection": "<string>",
      "on_delete": "<string>",
      "pii": false,
      "mask_type": "<string>",
      "expression": "<string>",
      "return_type": "<string>"
    }
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Body

application/json

Request body for creating a new collection.

name
string
required

Collection name (3-64 chars, alphanumeric + underscores)

Required string length: 3 - 64
schema
FieldDefinition · object[]
required

List of field definitions (at least one required)

Minimum array length: 1
list_rule
string | null

Filter expression for listing records

view_rule
string | null

Filter expression for viewing records

create_rule
string | null

Validation expression for creating records

update_rule
string | null

Filter/validation expression for updates

delete_rule
string | null

Filter expression for deletions

list_fields
string
default:*

Fields visible in list operations

view_fields
string
default:*

Fields visible in view operations

create_fields
string
default:*

Fields allowed in create requests

update_fields
string
default:*

Fields allowed in update requests

Response

Successful Response

Response for a created collection.

id
string
required

Collection ID (UUID)

name
string
required

Collection name

table_name
string
required

Physical table name in database

schema
SchemaFieldResponse · object[]
required

Collection schema

created_at
string<date-time>
required

When the collection was created

updated_at
string<date-time>
required

When the collection was last updated