Skip to content

Import from Netlify

jiayang import netlify:<site> reads a Netlify site with a token of yours, clones its repository, and sets it up here as a new app. Import from another host covers what every import does.

  1. In Netlify, open User settings, then Applications, then Personal access tokens.
  2. Create a token with a short expiry, and copy it.

The import asks for it at a hidden prompt, or reads NETLIFY_AUTH_TOKEN if it’s set, the variable Netlify’s own CLI reads. It’s sent to Netlify’s API and nowhere else, used for this import only, and never saved.

Terminal window
jiayang import netlify:team-handbook acme/handbook

The site can be named by its name, its domain (team-handbook.netlify.app or a custom one) or its id.

Two requests to Netlify’s API, documented at open-api.netlify.com (read 7 October 2026):

Request For
GET /api/v1/sites/{site} The build command, publish directory, base directory, functions directory and linked repository.
GET /api/v1/accounts/{account}/env?site_id={site} The variables, with each one’s production value, or its value for all contexts.

Netlify’s own read-only variables, like URL, DEPLOY_URL and CONTEXT, are left out. A variable set only for deploy previews, branch deploys or local development stays behind.

A variable marked Contains secret values is write-only on Netlify: its value can’t be read back through the UI, the CLI or the API. None becomes a plain environment variable here. One that’s a key for an API we know becomes a secret, and the import asks for its value or takes it from --env-file. Any other is left for you to store, and the plan says how.

The repository’s netlify.toml is read as well: its build settings, the variables in [build.environment] and [context.production.environment], and the redirects, headers and plugins it sets.

Netlify Here
Base directory The app’s directory inside the clone.
Build command, Publish directory build.command and build.output in jiayang.json.
_redirects and _headers files Work as they are, for a static site, in Cloudflare’s format. A rule that proxies to another site, or matches on a country, a role or a cookie, isn’t supported.
[[redirects]] in netlify.toml The plan prints them as _redirects lines, to put in the folder the build copies to its output.
Netlify Functions and Edge Functions A Worker or a container’s server.
Netlify Forms A Worker or server that takes the post.
Netlify Identity Not needed: everyone signs in through us.
Build plugins Add what they did to your build script.
error: Netlify didn't accept the token, or it can't see site team-handbook. Make a token with access to it and try again.
error: Netlify can't find the site nope with this token. Check the name.

In Apps, select Import, then Netlify. Enter the site and the token. See Import from another host.