Cosmos Node need pass in id when create new item?

Hi All,

For the azure cosmos DB node, when I want to create a new Item, it is require to have an ID see below:

However, when you insert, cosmos DB will auto generate the ID per MS docu:: Create a Document - Azure Cosmos DB REST API | Microsoft Learn

Is this a bug?

HI @iqoOopi

Not a bug. In Azure Cosmos DB for NoSQL, every item must include an id—it’s the only required property when creating a document, and the service enforces it. n8n’s node is reflecting that requirement. (Microsoft’s newer docs say exactly this; the older REST page that claims “ID is automatically added” is outdated/inconsistent.) If you don’t have an id, generate one in your workflow before the Cosmos node—for example, add a Code node and set i.json.id = require('crypto').randomUUID() for each item.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.