How do I get a list of bundles? In Drupal 8 how do I programmatically get a list of bundles for an entity type, for example the list of content types. Specifically, I'm looking for the machine names.
To get the bundles for an entity type, use the entity_type.bundle.info service, like this:

\Drupal::service('entity_type.bundle.info')-&gt;getBundleInfo('ENTITY_TYPE')

or use dependency injection to inject the service.

See the documentation for getBundleInfo for more information.