Custom save message for site information form
It seems you have success with displaying the message but not with saving the value? For this you need to load the editable version of the config, set the value and save:

function api_key_form_submit($form, FormStateInterface $form_state) {
  $config = \Drupal::service('config.factory')-&gt;getEditable('api_key.settings');
  $config-&gt;set('siteapikey', $form_state-&gt;getValue('siteapikey'));
  $config-&gt;save();
}


By the way it's also a good idea to get the value from the editable version because the config might be overridden and you want to fill the form with the original value:

$site_api = \Drupal::service('config.factory')-&gt;getEditable('api_key.settings')-&gt;get('siteapikey');