This post details how to register a new WordPress REST API route and endpoint. Once the route is registered and the endpoint is created, you can do whatever you want with it.
Everything "guide" related lives here. Enjoy my archives, but use them wisely, some content might be out of date and very old, always check the post dates. If you have any questions or are concerned about the contents of my posts, feel free to leave a comment on the post.