CreateItem
will create a new item but will fail if there already is an item with the same ID.
ReplaceItem
will replace an existing item with the same ID but will fail if that item doesn't exists.
UpsertItem
combines the above two operations so it will either create or replace any item with the specified ID.
Your use case much closer to UpsertItem instead of ReplaceItem.
In any case you will get a response status for each operation, refer checkhttps://learn.microsoft.com/en-us/rest/api/cosmos-db/replace-a-document#status-codes Plz check if your application is capturing the response status correctly.