How to delete user meta by key

You’re data is stored in a serialized array in the database, per a comment to the question:

... it's stored as the api's working for. It looks like that in the database : `a:3:{i:0;a:1:{s:5:"titre";s:3:"sfg";}i:1;a:1:{s:5:"titre";s:4:"test";}i:2;a:1:{sā€Œā€‹:5:"titre";s:4:"test";}}`

You are trying to remove only part of that serialized array by passing the key to delete_user_meta(). That is not how delete_user_meta() works. It is not going to unserialize() that value and remove the individual piece of the array. It is going to delete the row in the table where the key and the value match exactly. That is not what you want. With serialized data what you end up with is an array which you need to process yourself.

Something like this should work:

//      $id = $_POST['folderId'];
// fake $_POST['folderID']
$id = 'test';
$current_user = wp_get_current_user();
$userid = $current_user->ID;
//         $folder = get_user_meta($userid, 'favoris');
// fake the get_user_meta call
$folder = unserialize('a:3:{i:0;a:1:{s:5:"titre";s:3:"sfg";}i:1;a:1:{s:5:"titre";s:4:"test";}i:2;a:1:{s:5:"titre";s:4:"test";}}');

try {
  foreach ($folder as $k => $m) {
    if ($m['titre'] === $id) {
      unset($folder[$k]);
    }
  }
  update_user_meta($userid, 'favoris', $folder);
} 
catch (Exception $e) {
  echo 'not ok';
  return $e->getMessage();
}

What you need to do is process the array, removing the parts you don’t want, and then re-save it.

Note: As I started writing this code I realized that I was not 100% sure what you were trying to accomplish. The reason behind some of your $_POST data isn’t completely obvious to me. That should get you on the right track though.