WordPress REST API help

Hi! I´m developing a react app in wordpress, with a feature that sends automatic emails on user input.
I´m using wp\_mail() function to send the emails but i think something in the endpoint configuration isn´t right (im not well versed in php), the network says that the GET is in OK status , but the POST is 302 found. And the console shows me this error:

`Error sending email: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data`

Also, the response i´m getting is the whole main page code. can somebody give me a hint or help me find documentation to make this right?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer