Skip to content

Change a collection

PUT
/cms/data/{collection}
curl --request PUT \
--url https://api.example.com/cms/data/matches \
--header 'API-Key: <API-Key>' \
--header 'Content-Type: application/json' \
--data '{ "key": "matches", "name": "Matches", "description": "example", "icon": "example", "titleField": "example", "fields": [ { "key": "kickoff", "name": "Kick-off", "type": "text", "description": "example", "required": true, "multiple": true, "unique": true, "filterable": true, "maxLength": 1, "min": 1, "max": 1, "integer": true, "values": [ "Grass", "Hybrid" ], "target": "record:teams", "default": "example" } ], "settings": { "cacheSeconds": 1, "defaultStatus": "published" } }'

Properties left out keep their value; fields replaces the list. A field’s key and type can’t change; a saved field left out is kept as deprecated. When a field becomes filterable, existing records are indexed in the background (reindexing: true). Requires the “Structured data - Update collection” permission.

collection
required
string

Collection key

Example

matches
Media typeapplication/json
StructuredCollectionInput

A collection as POST /cms/data creates it and PUT /cms/data/{collection} changes it. On PUT, properties left out keep their value; fields replaces the whole list (a saved field left out is kept as deprecated: its data stays, the API stops using it).

object
key

POST only: the key (a lowercase letter, then lowercase letters, numbers and underscores, 64 at most)

string

Example

matches
name

Name

string

Example

Matches
description

Description

string
nullable
icon

Bootstrap Icons class

string
nullable
titleField

The text field that names a record (the first text field when left out)

string
nullable
fields

The fields, in order

Array<object>
StructuredField

A field of a structured data collection. Its key and type never change once saved.

object
key

The field’s name in a record’s data: a lowercase letter, then lowercase letters, numbers and underscores

string

Example

kickoff
name

Name shown in the CMS

string

Example

Kick-off
type

Field type

string
Allowed values: text long_text number boolean date datetime enum geo media reference json

Example

datetime
description

Help for connector developers

string
nullable
required

A value is required in every record

boolean
multiple

The value is a list of items of the type (text, number, date, datetime, enum, media, reference)

boolean
unique

No two records of the collection can hold the same value

boolean
filterable

Can be used in filter[…] and sort when listing records. Lists, references and media always are.

boolean
maxLength

Text: the maximum length

integer
nullable
min

Number: the minimum

number format: float
nullable
max

Number: the maximum

number format: float
nullable
integer

Number: whole numbers only

boolean
nullable
values

Enum: the allowed values

Array<string>
nullable

Example

[
"Grass",
"Hybrid"
]
target

Reference: what it points to, “record:”, “article”, “author” or “category”

string
nullable

Example

record:teams
default

The value a record gets when none is sent

mixed
nullable
settings

Settings

object
cacheSeconds

How long published records may be cached by frontends and the CDN (0–86400, default 60)

integer
defaultStatus

The status of a record written without one (default published)

string
Allowed values: published draft archived

Changed

Media typeapplication/json
object
data
StructuredCollection

A structured data collection: a user-defined shape whose records connectors write and frontends read.

object
id

Collection ID

integer
key

The key used in the API path (/cms/data/{key}). Never changes.

string
name

Name

string
description

Description

string
nullable
icon

Bootstrap Icons class

string
nullable
titleField

The text field whose value is a record’s title

string
nullable
fields

The fields a record’s data can hold

Array<object>
StructuredField

A field of a structured data collection. Its key and type never change once saved.

object
key

The field’s name in a record’s data: a lowercase letter, then lowercase letters, numbers and underscores

string
name

Name shown in the CMS

string
type

Field type

string
Allowed values: text long_text number boolean date datetime enum geo media reference json
description

Help for connector developers

string
nullable
required

A value is required in every record

boolean
multiple

The value is a list of items of the type (text, number, date, datetime, enum, media, reference)

boolean
unique

No two records of the collection can hold the same value

boolean
filterable

Can be used in filter[…] and sort when listing records. Lists, references and media always are.

boolean
maxLength

Text: the maximum length

integer
nullable
min

Number: the minimum

number format: float
nullable
max

Number: the maximum

number format: float
nullable
integer

Number: whole numbers only

boolean
nullable
values

Enum: the allowed values

Array<string>
nullable
target

Reference: what it points to, “record:”, “article”, “author” or “category”

string
nullable
default

The value a record gets when none is sent

mixed
nullable
updatedAt

When the collection last changed

string format: date-time
nullable
jsonSchema

GET /cms/data/{collection} only: the JSON Schema of a record’s data, to validate what a connector sends

object
reindexing
boolean

Example

{
"data": {
"id": 3,
"key": "matches",
"name": "Matches",
"icon": "bi-calendar-event",
"titleField": "label",
"fields": [
{
"key": "kickoff",
"name": "Kick-off",
"type": "text",
"values": [
"Grass",
"Hybrid"
],
"target": "record:teams"
}
]
}
}

Not valid (the message says why)

Needs an API key linked to a CMS user with the Structured data permission

No such collection or record