CLI reference
CORS CLI command reference
Interact with CORS-entries for your project
npx sanity cors --help
pnpm dlx sanity cors --help
yarn dlx sanity cors --help
bunx sanity cors --help
Commands
add
USAGE
$ sanity cors add ORIGIN [-p <id>] [--credentials]
ARGUMENTS
ORIGIN Origin to allow (e.g., https://example.com)
FLAGS
--credentials Allow credentials (token/cookie) to be sent from this origin
OVERRIDE FLAGS
-p, --project-id=<id> Project ID to add CORS origin to (overrides CLI configuration)
DESCRIPTION
Allow a new origin to use your project API through CORS
EXAMPLES
Interactively add a CORS origin
$ sanity cors add
Add a localhost origin without credentials
$ sanity cors add http://localhost:3000 --no-credentials
Add a production origin with credentials allowed
$ sanity cors add https://myapp.com --credentials
Add a CORS origin for a specific project
$ sanity cors add https://myapp.com --project-id abc123delete
USAGE
$ sanity cors delete [ORIGIN] [-p <id>]
ARGUMENTS
[ORIGIN] Origin to delete (will prompt if not provided)
OVERRIDE FLAGS
-p, --project-id=<id> Project ID to delete CORS origin from (overrides CLI configuration)
DESCRIPTION
Delete an existing CORS origin from your project
EXAMPLES
Interactively select and delete a CORS origin
$ sanity cors delete
Delete a specific CORS origin
$ sanity cors delete https://example.com
Delete a CORS origin from a specific project
$ sanity cors delete --project-id abc123list
USAGE
$ sanity cors list [-p <id>]
OVERRIDE FLAGS
-p, --project-id=<id> Project ID to list CORS origins for (overrides CLI configuration)
DESCRIPTION
List all origins allowed to access the API for this project
EXAMPLES
List CORS origins for the current project
$ sanity cors list
List CORS origins for a specific project
$ sanity cors list --project-id abc123