Update Collection Item
Update an existing item in a collection. This performs a full replacement — the item is overwritten to match the request exactly. Any fields not included in the request body will be set to null.
Full replacement
This endpoint replaces the entire item. Fields not included in the request body will be nullified. If you only need to update specific fields, use Patch Item instead.
Request
PUT https://app.ycode.com/api/v1/collections/{collection_id}/items/{item_id}Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_id | string | Yes | Unique identifier for the collection |
item_id | string | Yes | Unique identifier for the collection item |
Headers
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_API_TOKEN |
| Content-Type | application/json |
Request body
Send a JSON object with the collection field names as keys. Include all fields you want to keep — omitted fields will be set to null.
| Field | Type | Description |
|---|---|---|
_draft | boolean | Optional. When true, only the draft item is updated. If omitted and your project is published, the published record is updated by default. Whenever a published record is updated, the draft record is also updated. |
Example request body
{
"Name": "Updated blogpost title",
"Body": "<p>Updated content...</p>",
"Main Image": "https://example.com/new-image.jpg",
"Featured": 0,
"Categories": [
"1669309639520637fa4c77eea7",
"1669309662211637fa4de338d6"
]
}Response
Returns the updated item with all fields.
Example response
{
"_ycode_id": "16687868024636377aa7270ea9",
"ID": 2,
"Name": "Updated blogpost title",
"Created date": "2022-11-18T15:53:22.000Z",
"Updated date": "2022-11-18T15:53:22.000Z",
"Created by": "1669309481596637fa4299184e",
"Updated by": "1669309527456637fa4576f6dc",
"Summary": null,
"Body": "<p>Updated content...</p>",
"Main Image": "https://example.com/new-image.jpg",
"Thumbnail Image": "https://example.com/thumb.jpg",
"Featured": 0,
"Author": null,
"Categories": [
"1669309639520637fa4c77eea7",
"1669309662211637fa4de338d6"
],
"Slug": "updated-blogpost-title"
}Example request
curl -X PUT https://app.ycode.com/api/v1/collections/637781341a6f7/items/16687772264556377850a6f241 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"Name": "Updated blogpost title",
"Body": "<p>Updated content...</p>",
"Featured": 0
}'Last updated on