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"
item_type Optional

The record's model

creator Optional

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

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const itemId = "hWl-mnkWRYmMCSTq4z_piQ";
await client.items.validateExisting(itemId, {
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: {},
},
});
}
run();