How to get duplicate id via python api?
If you need the object for further operations it's best to do the duplication without the operator.

data_copy = bpy.data.objects["Cube"].data.copy()
obj_copy = bpy.data.objects["Cube"].copy()
obj_copy.data = data_copy
bpy.data.collections["Collection"].objects.link(obj_copy)
obj_copy.parent = bpy.data.objects["Cube"]