Is there a way to prevent mesh editing when importing via the API?
In general this is possible, but a few conditions must be met to achieve this.

First off, to prevent the end user to accidentally edit the mesh, it has to be linked instead of appended to the file. In order to answer that from a scripting point of view you need to provide more detail on how you handle the appending currently. There are low-level and high level approaches to this, so please add your code to the question. The tricky part is that if you want to edit material assignment, only the mesh data must be linked, but the object must be local. If all tansforms on the incoming object are applied, that would be trivial. You could then create a new mesh object in Python, and use the linked mesh datablock in it. Otherwise, things become more tricky or require end user interaction.

Note that linking the mesh in will also mean that whenever the source mesh in the source file is updated, it will be updated in all files that link it as well on reload.

Second, by default Blender associates the object data datablock with the material. That means, the mesh datablock you have just linked in also defines what materials are assigned to the mesh. Since now the data is linked and unchangeable, you can not change the material any longer. The solution to that is to set the material link to 'Object' instead, like in the answer given here.