404 error of id returned by api

I think this must be a bug because I don’t understand what I could be doing wrong. I have a few records that I want to fill a certain property, so I first look for the records and then use the id of each one to make an update. Here is the code:

async function main() {
    const client = buildClient({ apiToken: X });
    const recommenders = await client.items.list({filter: {type: 2635038}})
    await recommenders
        .filter((item) => item.variant === '')
        .reduce(async (previousPromise, item) => {
        try {
            await previousPromise
            await client.items.update(item.id, {variant: 'discreet'})
        } catch (e) {
    }, Promise.resolve())


This is an example of the response from one of the records:

	"id": "205467339",
	"type": "item",
	"question": "203888330",
	"variant": "",
	"updated_at": "2023-10-03T13:10:01.417+01:00",
	"created_at": "2023-10-03T13:10:01.413+01:00",
	"item_type": {
		"id": "2635038",
		"type": "item_type"
	"meta": {
		"created_at": "2023-10-03T13:10:01.413+01:00",
		"updated_at": "2023-10-03T13:10:01.417+01:00",
		"published_at": "2023-10-03T13:38:17.074+01:00",
		"publication_scheduled_at": null,
		"unpublishing_scheduled_at": null,
		"first_published_at": "2023-10-03T13:38:17.074+01:00",
		"is_valid": false,
		"is_current_version_valid": false,
		"is_published_version_valid": false,
		"status": "published",
		"current_version": "356379725",
		"stage": null

This is the error I receive:

Error: PUT https://site-api.datocms.com/items/205467339: 404 Not Found

    "id": "302048",
    "type": "api_error",
    "attributes": {
      "code": "NOT_FOUND",
      "details": {}

Hi @garoz.daniel , welcome to the forums!

I copied & pasted your code and it seems to work fine in my demo project. Hmm. Are you using the latest version of @datocms/cma-client-node (3.0.2)?

Could you please share your project URL with me so I can take a look? (Feel free to post it here, or if you don’t want it to be public, you can email us at support@datocms.com and CC me at r.tuan@datocms.com)

I have The same error
Node Version 20.11.1
datoCMS version 3.2.0
I’m trying to create to item but throwing a 404 Error

This is my code

const newHero = await client.items.create({
      header: 'Encuentra tu boleto de autobús Script Page Migration Test',
      bg: {
        alt: null,
        title: null,
        custom_data: {},
        focal_point: null,
        upload_id: 'NU7UOklJRVivzlcs9cqJlQ'
      gradient_start: { red: 192, blue: 171, alpha: 255, green: 46 },
      gradient_end: { red: 238, blue: 165, alpha: 255, green: 48 },
      item_type: { id: '2568157', type: 'item_type' },

And this is the Error

Hi @jose.guerra, and welcome to the forum!

It looks like item type 2568157 is a hero block in your project. Blocks cannot be directly created: they aren’t standalone records, but more like reusable fields within a record.

To add a block, you have to create the parent record and then add the block inside it. Documentation here: Create a new record - Record - Content Management API

Also, please check your forum DM for an important message (not related to this issue in particular).