How can I set a unique ID for entities created via the REST API?

I am creating some entities via the REST API, by setting its state, via

POST /api/states/sensor.my_entity
{
    "state": "oh yeah"
}

The entity is created (return code 201) and its state is correct.

It cannot be edited via the UI, though, because it lacks a unique ID.

How can I provide one? (either via an explicit creation or by adding something to the call).

Or, in other words: how can I create entities via the API, that would be editable through the UI?

I have been also searching without any success the way of creating entities with the API that can be edited in the UI.

Anyone knows what is the field name in the REST/POST request? I have tried lost of stuff :frowning:

I also tried to see all kinds of fields but none was accepted. Interestingly enough, a GET on the state returns the same data independently if a sensor that is editable or not (specifically - there is no ID)

I tried to change the category of the question to “Development” to maybe reach a different population

Looking at the code, the short answer is you can not.

The post rest call will accept state, attributes and force_update as parameters and when you call it, if the entity does not exist, it adds a new entity to the state machine but at no point does it generate a unique id field or create this as an entity belonging to any type of integration.

Thanks. On that case it is more a bug than anything so I will fill an issue and see how it goes.