CLI
Before running any of the commands below, make sure you are authenticated with the Scalar CLI using your API key.
Publishing API Documents#
To add an API document to the registry, use the publish command:
scalar registry publish ./openapi.yaml --namespace your-team --slug your-apipublish accepts OpenAPI and AsyncAPI documents alike. The format is detected when the document reaches the registry, so the command is the same either way:
scalar registry publish ./asyncapi.yaml --namespace your-team --slug your-events-apiRequired Parameters#
file: Path to your API document--namespace: Your Scalar team namespace--slug: Unique identifier for the registry entry (defaults to title if not specified)
Optional Parameters#
--version: API version (e.g., 0.1.0)--private: Make API private (default: false)--force: Force override an existing version (default: false)
Examples#
# Basic publish
scalar registry publish api/openapi.json --namespace your-team --slug user-api
# Publish with version and make private
scalar registry publish api/openapi.json --namespace your-team --slug user-api --version 1.0.0 --private
# Force update existing version
scalar registry publish api/openapi.json --namespace your-team --slug user-api --forceManaging Registry Documents#
List Documents#
View all registry APIs for your team:
scalar registry list --namespace your-teamUpdate Document Metadata#
Update title and description without re-uploading the file:
scalar registry update your-team your-api --title "New Title" --description "New description"Delete Documents#
Remove a document from the registry:
scalar registry delete your-team your-apiValidation and Quality#
Before publishing, you can validate your API document:
scalar document validate ./openapi.yamlYou can also lint your document using Spectral rules:
scalar document lint ./openapi.yamlAnd use Rules from the Registry:
scalar document lint ./openapi.yaml --rule https://registry.scalar.com/@your-team/rules/your-rule[!NOTE]
scalar document lintalso supports AsyncAPI. It detects the document type and runs Spectral'sspectral:asyncapiruleset instead ofspectral:oas, so linting an AsyncAPI document reports issues that actually apply to it.scalar document validateremains OpenAPI-only — pointed at an AsyncAPI document it stops with a clear message and suggestslintinstead. Publishing an AsyncAPI document to the registry works as normal.Need AsyncAPI support for
validatetoo? Tell us on GitHub or email support@scalar.com.
Team Management#
If you're part of multiple teams, you can manage which team is active:
# List all teams you're part of
scalar team list
# Set active team
scalar team set --team team-uidWorking with Multiple APIs#
For repositories containing multiple APIs, you can use the CLI in scripts or CI/CD pipelines:
# Example: Publish multiple APIs
scalar registry publish ./apis/user-api/openapi.json --namespace your-team --slug user-api
scalar registry publish ./apis/product-api/openapi.json --namespace your-team --slug product-api
scalar registry publish ./apis/order-api/openapi.json --namespace your-team --slug order-apiIntegration with CI/CD#
For automated publishing, you can integrate the CLI with GitHub Actions or other CI/CD systems. See our GitHub Actions guide for detailed examples.
The CLI supports environment variables and can be easily integrated into automated workflows for continuous deployment of your API documentation.