I need help with a CORS problem I’m running into. I’m trying to get information from a public Notion page using their unofficial API endpoint.
The endpoint I’m using is: POST https://www.notion.so/api/v3/loadPageChunk
const requestPayload = {
"pageId": "a7f92b3e-d156-4a89-b2c4-8e91fd045729",
"limit": 100,
"cursor": {
"stack": []
},
"chunkNumber": 0,
"verticalColumns": false
}
When I test this using REST clients like Postman or Insomnia, everything works perfectly and I get the data back. However, when I try to make the same request from my JavaScript code, I keep getting CORS errors.
Since this isn’t an official Notion API endpoint, I’m wondering if there’s a way around this. If REST clients can successfully make these requests from different origins, shouldn’t programmatic requests work too? What am I missing here?
Had this exact problem with Notion’s unofficial endpoints last year. Browsers enforce CORS for security, but Postman doesn’t deal with that since it’s not a browser. I fixed it by creating a simple serverless function on Vercel or Netlify that acts as a proxy. The function takes your request, sends it to Notion’s API, and passes back the response. Clean solution without running a full backend. Just heads up - since you’re using unofficial endpoints, Notion could break or block them anytime. I’d switch to their official API when you can.
totally get ur struggle! CORS can be a pain but it’s just how browsers work. using a backend to handle the requests is the way to go, it’ll help u avoid those nasty errors. good luck!
REST clients like Postman don’t enforce CORS - that’s why they work fine. Browsers do enforce CORS to stop malicious scripts from attacking users. Notion’s unofficial API isn’t set up for cross-origin requests from web apps. You’ll need a proxy server to handle this. I’d go with Express.js - just create an endpoint that forwards your request to Notion’s API and sends the response back. Since your browser only talks to your own domain, CORS won’t be an issue.