API reference/Collections
Make a collection
Try itMakes a content collection: a name, what one record is called, a web address and up to 8 fields. Show it on a page with a "collection" section (content.collection = its slug).
POST
/api/v1/sites/{site_id}/collectionsAuthentication
An API key as Authorization: Bearer or x-api-key. It needs the collections:write scope — make collections and add, change and delete records (live at once).
collections:writeChanges the live siteIdempotency-Key requiredMCP tool: create_collection
Parameters
Named placeholders go in the path; the rest in a JSON body.
site_idstringPath · required- The site's id.1 to 100 characters
namestringBody · required- "Homes for sale".2 to 60 characters
item_namestringBody · required- What ONE record is called ("Home").1 to 40 characters
slugstringBody · optional- The web address (3–48 lowercase letters, numbers, dashes). Omitted = made from the name. Not blog, events, store, cart, privacy or search.At most 48 characters
descriptionstringBody · optional- The intro on the list page.At most 600 characters
fieldsarray of objectBody · optional- Up to 8 fields every record has. Sending fields REPLACES the list (keep keys to keep values).
Response
201 with JSON on success (schema on the right). Errors use the standard envelope; a retry with the same Idempotency-Key gets the first answer back (how retries work).
curl -X POST 'https://websites.workflowcorp.com/api/v1/sites/SITE_ID/collections' \
-H "Authorization: Bearer $WEBSITEBUDDY_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name":"Homes for sale","item_name":"Home","slug":"homes","fields":[{"label":"Price","kind":"price","in_list":true},{"label":"Bedrooms","kind":"number","in_list":true},{"label":"Bathrooms","kind":"number","in_list":true},{"label":"Neighborhood","kind":"text"}]}'{
"site_id": "SITE_ID",
"name": "Homes for sale",
"item_name": "Home",
"slug": "homes",
"fields": [
{
"label": "Price",
"kind": "price",
"in_list": true
},
{
"label": "Bedrooms",
"kind": "number",
"in_list": true
},
{
"label": "Bathrooms",
"kind": "number",
"in_list": true
},
{
"label": "Neighborhood",
"kind": "text"
}
]
}{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"slug": {
"type": "string",
"description": "The web address: /{slug} lists the records, /{slug}/{record} is one."
},
"item_name": {
"type": "string",
"description": "What ONE record is called (\"Home\")."
},
"description": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "Stable key the record's values use."
},
"label": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"text",
"number",
"price",
"date",
"link"
],
"description": "text, number, price (integer cents), date (YYYY-MM-DD) or link."
},
"in_list": {
"type": "boolean",
"description": "Shown on the cards and in lists, not only on the record's page."
}
},
"required": [
"key",
"label",
"kind",
"in_list"
],
"additionalProperties": false
}
},
"records": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"url": {
"type": "string",
"description": "The list on the live site (a site page with the same address wins)."
},
"is_sample": {
"type": "boolean"
},
"created_at": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"required": [
"id",
"name",
"slug",
"item_name",
"description",
"fields",
"records",
"url",
"is_sample",
"created_at",
"updated_at"
],
"additionalProperties": false
}