html id is removed for non admin user?

simplest solution – set the post_author to an admin or editor user.

The reason “id” and other attributes and tags are stripped from the content is to prevent unauthorized users to inject content which might be used to “still” the credentials of other users. Right now you don’t explicitly set the user to which the post is associated which probably cause wordpress to filter the content.