Call the following static method\Drupal::service('uuid')->generate() $uuid = \Drupal::service('uuid')->generate(); Tags All Drupal