How do I return XML to an API post request

because you don’t return JSON, you can use admin-post.php.

create a hook like that :

add_action("admin_post_nopriv_MY_PLUGIN__answer", function () {
    
    header("Content-type: text/xml");
    
    echo "<abc><def>1</def></abc>";
    exit();
    
});

and then use the url /wp-admin/admin-post.php?action=MY_PLUGIN__answer.

when you do debugging, don’t forget that admin_post_nopriv only answers on unconnected users then you can open the url in another browser.

techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedueduseduedusedueduseduedu