
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a frustrating error but usually has a straightforward fix! The "An error occurred while attempting to reach the Sanity API" message typically points to a CORS configuration issue, not an actual API outage.
Here's what to try:
Since you just initialized the project, your localhost development URL likely isn't whitelisted yet. You need to add it in your project settings:
http://localhost:3333 (or whatever port your Studio is running on)The "Allow credentials" checkbox is crucial - without it, you'll still get CORS errors even with the origin added.
sanity dev instead of sanity startIn modern Sanity projects (Studio v3+), the recommended command is sanity dev, not sanity start. The dev command starts a development server with live reloading and better performance. Try:
npm run dev
# or
sanity devWhile rare, sometimes there are actual API issues. You can verify the Sanity API status at status.sanity.io to rule out platform-wide problems.
You can also add CORS origins via the CLI:
sanity cors add http://localhost:3333 --credentialsThe --credentials flag is equivalent to checking that "Allow credentials" box in the dashboard.
When you initialize a new project, Sanity doesn't automatically whitelist localhost URLs for security reasons. Your browser blocks the requests because the Studio (running on localhost) is trying to make authenticated requests to the Sanity API without proper CORS configuration.
The CORS settings you configure in the Management Dashboard control which domains can access your project data with credentials, so this is a necessary security step for any new project.
Give the CORS configuration a try first - that fixes this issue 99% of the time!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store