Why am I getting a CORS error?

I’m trying to hit the Courier API from my frontend but I’m getting a CORS error.

Here’s the error:

Access to XMLHttpRequest at 'https://api.trycourier.app/send' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

We purposefully prevent the API being called from the front-end. The reason is that you potentially would open up the ability for any user to send arbitrary messages from your e.g. email account, to any other recipient – as you. You will need to call the API from a backend.