Delete a custom content type
See How to delete a content type, programmatically? for the easiest way for your use case. This works for any config entity that doesn't already explicitly depend on your module (those are uninstalled anyway).

The nice thing about that approach is that the user will be informed on the uninstall confirm age that this stuff will be deleted.

To delete using the API, node types are entities, so you delete them like all others: NodeType::load('id')-&gt;delete()