PHP ESI Curl error

Hello Scripting Master, i need your assitance on a esi.setwaypoint. Im using the code below. I have tried alot of things but none seem to work and give the exact same error over and over.

What am i doing wrong

Error i get:

{"error":"'add_to_beginning' is required, 'clear_other_waypoints' is required, 'destination_id' is required"}

cURL i use for this.

 $url = "https://esi.evetech.net/latest/ui/autopilot/waypoint/";
        
        
        $fields = array (
                'add_to_beginning' => 'true',
                'clear_other_waypoints' => 'true',
                'datasource' => 'tranquility',
                'destination_id' => '30000267'
            );
        
             
        $header = array(
            'Authorization: Bearer '.$accessToken,
            'Accept: application/json'
        );
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        $result = curl_exec($ch); 
        curl_close($ch); 

        //Server response json decode & display

        return $result;