CLI

Publish your Scalar Docs project using the Scalar CLI. The CLI uploads your project configuration and content to Scalar's platform, making your documentation available at a custom domain.

Installation

Install the Scalar CLI globally or use it via npx:

npm install -g @scalar/cli

Or use npx without installation:

npx @scalar/cli project publish

Authentication

Authenticate with the Scalar platform before publishing:

scalar auth login

You can login with email and password, or use a personal token:

scalar auth login --email your@email.com --password yourpassword
scalar auth login --token your-personal-token

Verify your current authentication status:

scalar auth whoami

Project Setup

Initialize Configuration

Create a scalar.config.json file in your project root:

scalar project init

This command prompts for a subdomain and creates the configuration file.

Create Project

Create a new project on the Scalar platform:

scalar project create --name "My Documentation" --slug your-docs
Option Type Required Description
--name string No Display name for your project
--slug string No URL-friendly project identifier

Local Preview

Preview your documentation locally before publishing:

scalar project preview

Preview Deployments

Publish in preview mode (e.g. for pull requests) without going live:

scalar project publish --slug your-docs --preview

Publishing

Publish your project to make it live:

scalar project publish

Specify a project slug and config file:

scalar project publish --slug your-docs --config scalar.config.json
Option Type Required Description
--slug string No Project slug identifier
--config string No Path to your scalar.config.json file
--preview boolean No Publish in preview mode (do not go live)

The publish command uploads your project configuration and all referenced content files to Scalar's platform.

Your documentation will be available at https://your-subdomain.apidocumentation.com.