How to import a link from database to Sanity project?

12 repliesLast updated: Nov 29, 2025

Hey guys! I want to import a link from my database to the project. What is the easiest and quickest way to do it?
AI Update

The easiest and quickest way to import data into your Sanity project depends on what you're importing, but here are your main options:

If you have data in NDJSON format (newline-delimited JSON), the CLI import command is your fastest route:

sanity dataset import <file> <targetDataset>

For example:

sanity dataset import my-data.ndjson production

Key things to know:

Useful flags:

Run sanity dataset import --help to see all options.

Alternative: Using a Client Library

If you need more control or are importing from a custom source, you can use the Sanity JavaScript client with methods like client.create() or client.createOrReplace().

Important considerations when using the client:

For a single link/document, you could also just create it directly in Sanity Studio if it's a one-off!

What type of data are you looking to import? That'll help determine the best approach.

Show original thread
12 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions