How to obtain the machine name and field type of the fields of a content type filtered by those created by the user? I have a content type News to which I added the following fields:

Label | System Name | Type
Image | field_image | Is a image
Related content | field_related_content | is a Paragraph
Date | field_date | Is Datetime type


What I'm trying to do with a custom module is, I want to get the machine names of each field and the type of field that I defined.

Is it possible to obtain data from only those that I generated?
That is, for example, the created fields, or the update field or those that come by default do not appear, in some way filter the ones that I defined as the user in the content type.

For example, after some form of processing the type of content, only result in:

$result = [

  'field_image' =&gt; [
     'type' =&gt; 'image',
   ],
   'field_related_content' =&gt; [
    'type' =&gt; 'paragraph' // i don't know if the type is Entity reference revisions in reality
   ],
   'field_date' =&gt; [
    'type' =&gt; 'datetime'
   ]

];


Thanks.
If you mean the fields configurable in UI, then you can get them through EntityFieldManager::getFieldDefinitions:

$fields = array_filter(
  \Drupal::service('entity_field.manager')-&gt;getFieldDefinitions('node', 'article'),
  function ($fieldDefinition) {
    return $fieldDefinition instanceof \Drupal\field\FieldConfigInterface;
  }
);

$result = [];
foreach ($fields as $key =&gt; $definition) {
  $result[$key] = [
    'type' =&gt; $definition-&gt;getType(),
  ];
  // if the field is a reference field get also the target entity type
  if (in_array($result[$key]['type'], ['entity_reference', 'entity_reference_revisions'])) {
    $result[$key]['target_type'] = $definition-&gt;getSettings()['target_type'];
  }
}


Entities have base fields defined in code and bundle fields defined in configuration. Drupal doesn't keep track whether a bundle field is configured by you or is from another source. A field can be pre-installed by a module, then deleted and added in UI again and Drupal wouldn't be able to tell the difference.