Home › Forums › Newsletter Developers › Can't Subscribe using REST API, always "Email address not valid"
Hi!
I’m trying to add Subscribers from my website’s form running on Gatsby.js with WP as CMS.
I send this to http://[website]/wp-json/newsletter/v1/subscribe via POST {"email":"test@example.com","api_key":"[key]"}
{"email":"test@example.com","api_key":"[key]"}
I receive: {"code":-1,"message":"Email address not valid","data":{"status":400}}
{"code":-1,"message":"Email address not valid","data":{"status":400}}
What could be wrong here?
OK, I’ve resolved the issue – trivial mistake in header data
Everything is working as expected now.