Show examples in:
Javascript HTTP
Endpoint info
Available examples
Content Management API > Record

Validate an existing record

Warning: Experimental API

Please note that this API method is marked as unstable and should be avoided in production environments. Changes may occur at any time without warning, potentially impacting your scripts. We recommend contacting our Support Team to explore alternative approaches that are safer and more reliable!

Checks an update payload for an existing record without saving it. The payload has the same shape as the one for Update a record, and goes through the same checks: the attributes you send are merged with the record's current version, then every field and every nested block is validated against its model.

The response is 204 No Content when the payload is valid, or a 422 with INVALID_FIELD errors when it is not. Nothing is saved.

⚠️ Block records are not accepted

The ID in the URL must belong to a record of a regular model. If it belongs to a block, the endpoint returns 404 NOT_FOUND. A block cannot be validated on its own: validate the payload of the record that contains it instead.

Body parameters

id string Required

RFC 4122 UUID of record expressed in URL-safe base64 format

Example: "hWl-mnkWRYmMCSTq4z_piQ"
type string Required

Must be exactly "item".

relationships.item_type.data Optional

The record's model

relationships.creator.data Optional

The entity (account/collaborator/access token/sso user) who created the record

Examples

POST https://site-api.datocms.com/items/:item_id/validate HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"id": "hWl-mnkWRYmMCSTq4z_piQ",
"type": "item",
"attributes": {
"title": "My first blog post!",
"content": "Lorem ipsum dolor sit amet...",
"category": "24",
"image": {
"upload_id": "WxrWMPl3TjeSJYcl6lNCbg",
"alt": "Alt text",
"title": "Image title",
"custom_data": {}
}
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/items/:item_id/validate' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"id":"hWl-mnkWRYmMCSTq4z_piQ","type":"item","attributes":{"title":"My first blog post!","content":"Lorem ipsum dolor sit amet...","category":"24","image":{"upload_id":"WxrWMPl3TjeSJYcl6lNCbg","alt":"Alt text","title":"Image title","custom_data":{}}}}}'
await fetch("https://site-api.datocms.com/items/:item_id/validate", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
id: "hWl-mnkWRYmMCSTq4z_piQ",
type: "item",
attributes: {
title: "My first blog post!",
content: "Lorem ipsum dolor sit amet...",
category: "24",
image: {
upload_id: "WxrWMPl3TjeSJYcl6lNCbg",
alt: "Alt text",
title: "Image title",
custom_data: {},
},
},
},
}),
});