
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeLooking at the guide you're following, I can help clarify the confusion about file placement and why your documents aren't appearing in Studio.
Where to put your import script:
Your import script (dataCall.js) should NOT go in the schema folder. The schema folder is specifically for defining your content types. Instead, you should:
/scripts folderFor example:
my-sanity-project/ ├── schemas/ │ └── schema.js (your schema definitions only) ├── scripts/ │ └── dataCall.js (your import script) └── sanity.config.js
Why documents aren't showing in Studio:
The most likely issue is that your document _type doesn't match your schema. When you create documents, the _type field must exactly match a document type name defined in your schema. For example:
// In your schema
{
type: 'document',
name: 'catBreed', // This name matters!
fields: [...]
}
// In your import script
{
_id: 'imported-cat-1',
_type: 'catBreed', // Must match the schema name exactly
// ... other fields
}How to properly run the import:
npm install @sanity/client node-fetchscripts/import.js):const sanityClient = require('@sanity/client')
const fetch = require('node-fetch')
const client = sanityClient({
projectId: 'your-project-id',
dataset: 'your-dataset',
token: 'your-write-token',
useCdn: false
})
// Your fetch and transform logic here
// Then use client.createOrReplace() to create documentsnode scripts/import.jsCommon gotchas:
_type in your documents matches your schema exactly (case-sensitive)sanity.config.jssanity dev)The guide you're following shows the complete process - the key is that importing is a separate operation from defining schemas. You define the schema first, then run a standalone script to populate data that conforms to that schema.
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