ServiceNow SDK CLI

  • Release version: Zurich
  • Updated March 12, 2026
  • 13 minutes to read
  • Use the ServiceNow SDK command-line interface (CLI) to manage changes between a local application and the application on an instance.

    From the command-line tool on your system, enter now-sdk to start the CLI and return a list of available commands or now-sdk [command] to begin using the ServiceNow SDK.

    Note:
    If you use npx to install the ServiceNow SDK in application rather than globally, you must use npx @servicenow/sdk [command] rather than now-sdk [command] with the ServiceNow SDK CLI.

    The CLI includes the following commands and global options:

    Table 1. Global options
    Option Description
    --version, -v Return the version of the CLI.
    --help, -h Return information about commands, sub-commands, and parameters.
    --debug, -d Return the debug logs generated with a command.

    auth

    Authenticate to an instance and store, update, or view user credentials for accessing an instance on your system.

    The auth command has parameters for adding credentials, deleting credentials, listing credentials, and setting credentials to use by default. To use non-interactive authentication in CI/CD pipelines, see the install command.

    For more information, see Authenticating to a ServiceNow instance with the ServiceNow SDK.

    add

    Store credentials in the device keychain or credential manager on your system.

    The auth command has the following structure with the --add parameter:
    npx @servicenow/sdk auth [--add <instance url>] [--type <auth method>] [--alias <alias>]
    Note:
    Using the npx command installs the ServiceNow SDK in your application directory instead of globally.
    Table 2. Required parameters
    Parameter Type Description Default value
    --add String The URL of the target instance to access and to which you install applications. The instance must be on the Washington DC release or later.
    Table 3. Optional parameters
    Parameter Type Description Default value
    --type String The method to use to authenticate with the target instance. Specify basic for basic authentication or oauth for OAuth 2.0 authentication. basic
    --alias String The alias for the instance and user credentials.

    The alias can be used for authentication with the init, transform, dependencies, and install commands.

    For example:
    npx @servicenow/sdk auth --add https://myinstance.service-now.com --type oauth --alias devuser1

    delete

    Remove credentials in the device keychain or credential manager on your system.

    The auth command has the following structure with the --delete parameter:
    now-sdk auth [--delete <alias or all>]
    Table 4. Required parameters
    Parameter Type Description Default value
    --delete String

    The alias for the instance and user credentials.

    To delete all credentials, set this parameter to --delete all.

    For example:
    now-sdk auth --delete devuser1

    list

    View credentials saved in the device keychain or credential manager on your system. Passwords and authentication codes aren't returned.

    The auth command has the following structure with the --list parameter:
    now-sdk auth [--list]
    Table 5. Required parameters
    Parameter Type Description Default value
    --list String Lists all available authentication credentials.
    For example:
    now-sdk auth --list

    use

    Set the credentials to be used by commands by default.

    The auth command has the following structure with the --use parameter:
    now-sdk auth [--use <alias>]
    Table 6. Required parameters
    Parameter Type Description Default value
    --use String The alias for the instance and user credentials.
    For example:
    now-sdk auth --use devuser1

    init

    Create a custom scoped application or convert an existing scoped application to support development in source code. The application is added in the current directory.

    To create an application, you can run the init command without any optional parameters (now-sdk init). To convert an existing application, you must include the --from parameter to provide the sys_id of an application on an instance or a path to a local directory that contains an application.

    After initializing an application, you must install the required third-party dependencies using your preferred package manager before building the application. For example, if you use Node Package Manager (npm), run npm install.

    The init command has the following structure:
    npx @servicenow/sdk init [--from <sys_id or path>] [--appName <name>] [--packageName <name>] [--scopeName <name>] [--auth <alias>] [--template <template>]
    Note:
    Using the npx command installs the ServiceNow SDK in your application directory instead of globally.
    Table 7. Optional parameters
    Parameter Type Description Default value
    --from String A sys_id of an application on the instance or a path to a local directory that contains an application to convert to support development in source code.

    Converting an application adds the necessary files and directories for using the ServiceNow SDK locally and downloads the application metadata. The application isn't changed on the instance until you build and install it on the instance. After installing a converted application, the Package JSON field of the custom application record [sys_app] contains the path to the package.json file for the application.

    --appName String A name for the application.
    --packageName String A name for the application package used in the package.json file. The package name must adhere to Node Package Manager (npm) package naming standards.
    --scopeName String The scope of the application.

    The scope name must be unique on the instance, begin with x_<prefix>, and be 18 characters or fewer. For more information, see Namespace identifier.

    --auth, -a String An alias for the credentials to use to authenticate to the instance. If set, the default alias.
    --template String A template for the default structure of the application.
    • base: An application with only the basic structure necessary for development in source code.
    • javascript.basic: An application configured for development in ServiceNow Fluent and JavaScript.
    • javascript.react: An application configured for development in ServiceNow Fluent, JavaScript, and React.
    • typescript.basic: An application configured for development in ServiceNow Fluent and TypeScript. TypeScript source files in the src/server directory are transpiled into JavaScript modules.
    • typescript.react: An application configured for development in ServiceNow Fluent, TypeScript, and React. TypeScript source files in the src/server directory are transpiled into JavaScript modules.
    • partial.javascript.react: Adds template files and directories to an existing application for development in ServiceNow Fluent, JavaScript, and React.
    • partial.typescript.react: Adds template files and directories to an existing application for development in ServiceNow Fluent, TypeScript, and React.
    For example:
    npx @servicenow/sdk init --from dbce0f6a3b3fda107b45b5d355e45af6 --appName Example App --packageName example-app --scopeName x_snc_example --auth devuser1 --template base

    For more information, see Create an application with the ServiceNow SDK or Convert an application with the ServiceNow SDK.

    build

    Compile source files and output build artifacts. Third-party library dependencies are converted into XML files that can be installed with the application.

    The build command has the following structure:
    now-sdk build <source> [--frozenKeys <flag>] [--errorOnConflict <flag>] 
    Table 8. Optional parameters
    Parameter Type Description Default value
    source String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    --frozenKeys Boolean An option to validate that the keys.ts file is up to date for continuous integration (CI) builds. If true and changes were made to the application's ServiceNow Fluent code, the keys.ts file isn't updated and the build fails.

    The keys.ts file is automatically generated in the src/fluent/generated directory.

    false
    --errorOnConflict Boolean An option to treat sys_id conflicts between ServiceNow Fluent code and metadata XML as errors instead of warnings. false
    For example:
    now-sdk build /path/to/package --frozenKeys true --errorOnConflict true 

    For more information, see Build and install an application with the ServiceNow SDK.

    install

    Package the build artifacts and install or update an application on an instance. Before using the install command, you must use the build command to generate an installable package.

    The install command has the following structure:

    now-sdk install [--source <package path>] [--reinstall <flag>] [--auth <alias>] [--open-browser <flag>] [--info <flag>] [--demoData <flag>] [--skip-flow-activation <flag>]
    Table 9. Optional parameters
    Parameter Type Description Default value
    --source String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    --reinstall, -r Boolean An option to uninstall and reinstall the application on the instance to ensure that the metadata on the instance matches the metadata in the installation package.
    Warning:
    Metadata that is on the instance but not in your local application is removed.

    If you have previous versions of modules in the EcmaScript Module [sys_module] table that aren't needed, re-installing an application removes previous versions of the application’s modules from the table.

    false
    --auth, -a String An alias for the credentials to use to authenticate to the instance.
    Note:
    For CI/CD pipelines, you can set the following environment variables to authenticate with an instance at runtime:
    • SN_SDK_NODE_ENV: Set to SN_SDK_CI_INSTALL to enable CI server support.
    • SN_SDK_INSTANCE_URL: The URL of the target instance to access and to which you install applications.
    • SN_SDK_USER: A username to access the instance using basic authentication.
    • SN_SDK_USER_PWD: The password associated with the user.
    If set, the default alias.
    --open-browser, -b Boolean An option to open the application record in your default browser after successfully installing the application. false
    --info, -i Boolean An option to return details about the most recent installation of this application, such as the status and records updated. When this parameter is used, the application isn’t installed. false
    --demoData Boolean An option to install demo data with an application. true
    --skip-flow-activation Boolean An option to skip activating, or publishing, flows when installing an application. By default, flows are activated on the instance when an application is installed.
    Note:
    ServiceNow IDE version 4.1.1 or later must be installed to activate flows with this command.
    false
    For example:
    now-sdk install --source /path/to/package --reinstall false --auth devuser1 --open-browser true --info true --demoData false --skip-flow-activation true

    For more information, see Build and install an application with the ServiceNow SDK.

    dependencies

    Download application dependencies and TypeScript definitions from an instance to enable IntelliSense and code validation for an application.

    The dependencies command downloads dependencies and TypeScript definitions for scripts and ServiceNow Fluent code:

    • For scripts, this command downloads TypeScript definitions for all Glide APIs and scans the modules and scripts in your application and generates type definitions for the script includes that they use. Type definitions are added in the @types/servicenow directory. After downloading script dependencies, you must update your tsconfig.json file to include the type definitions.
    • For ServiceNow Fluent, this command downloads the dependencies listed in an application's now.config.json file and generates TypeScript definitions for them in the @types/servicenow/fluent directory.

    To download all script and ServiceNow Fluent dependencies for an application, you can use the dependencies command with no parameters. If needed, provide the application directory and authentication alias too.

    The dependencies command has the following structure:

    now-sdk dependencies [--directory <package path>] [--auth <alias>][--type-defs-only <flag>] [--fluent-only <flag>] [--add <table> <sys_ids or names>] [--scope <name>]
    Table 10. Optional parameters
    Parameter Type Description Default value
    --directory String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    --auth, -a String An alias for the credentials to use to authenticate to the instance. If set, the default alias.
    --type-defs-only Boolean An option to download TypeScript definitions for only script dependencies.

    Script types are downloaded in the @types/servicenow directory.

    false
    --fluent-only Boolean An option to download dependencies and TypeScript definitions for only ServiceNow Fluent dependencies from other application scopes. You must list an application’s dependencies in its now.config.json file.

    ServiceNow Fluent types are generated in the @types/servicenow/fluent directory.

    false
    --add String Adds the dependencies that you want to download to the application's now.config.json file. You must specify the type of dependencies to add using the table name and then the names or sys_ids of each item to add, separated by spaces.
    --add <table_name> <sys_id1> <sys_id2> <sys_id3>
    • To add table dependencies, you can use the table alias and names of tables instead of the sys_ids. For example:
      --add tables incident problem change_request
    • To add role dependencies, you can use the role alias and names of roles instead of the sys_ids. For example:
      --add roles admin user itil
    Use a wildcard (*) to add all items from a specified table and scope. For example:
    --add sys_security_acl "*"
    sysIds Array A list of sys_ids of dependencies to download and generate TypeScript definitions from. This parameter only applies if you use the --add parameter.
    --scope String The application scope from which to download dependencies. This parameter is required if you use the --add parameter.
    For example:
    now-sdk dependencies --directory /path/to/package --auth devuser1 --add sys_ui_view fa776f6d97700100f309124eda2975bc --scope global

    For more information, see Downloading dependencies with the ServiceNow SDK.

    transform

    Download application metadata (XML) from the instance and transform the metadata into ServiceNow Fluent source code to synchronize the application changes on the instance into your local application.

    After initializing an application, you can run the transform command without any parameters to transform new application metadata from the instance into source code in the src/fluent/generated directory and synchronize changes to metadata into source code in the src/fluent directory. To transform metadata that existed when the application was initialized into source code, use the --from parameter to provide the path to a local directory or file that contains XML. If metadata exists in the local application as both XML and source code, the XML version takes precedence when installed on the instance.

    The transform command has the following structure:
    now-sdk transform [--from <path>] [--directory <package path>] [--preview <flag>] [--auth <alias>] [--format <flag>] 
    Table 11. Optional parameters
    Parameter Type Description Default value
    --from String A path to a local directory or file that contains metadata XML to transform into ServiceNow Fluent code.
    --directory String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    --preview Boolean An option to preview the transformed ServiceNow Fluent code from the command line without saving the changes. false
    --auth, -a String An alias for the credentials to use to authenticate to the instance. If set, the default alias.
    --format, -f Boolean An option to format new and updated ServiceNow Fluent source code when it's transformed. true
    For example:
    now-sdk transform --from metadata/update --directory /path/to/package --preview true --auth devuser1 --format true 

    For more information, see Convert an application with the ServiceNow SDK or Build and install an application with the ServiceNow SDK.

    download

    Download all application metadata (XML) from an application on an instance to compare with the metadata in your local application.

    Updates to JavaScript modules aren't included when downloading application metadata from your instance.​

    The download command has the following structure:
    now-sdk download <directory> [--source <package path>] [--incremental <flag>]
    Table 12. Required parameters
    Parameter Type Description Default value
    directory String A path to any directory in which to download the metadata.
    Note:
    This directory should be a different directory from the metadata directory in your application.
    Table 13. Optional parameters
    Parameter Type Description Default value
    --source String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    --incremental Boolean An option to download only changes to application metadata made on the instance and recorded in the Customer Updates [sys_update_xml] table. false
    For example:
    now-sdk download /path/to/directory --source /path/to/package --incremental true

    clean

    Remove the build artifacts that were output with the previous build.

    The clean command has the following structure:
    now-sdk clean <source>
    Table 14. Optional parameters
    Parameter Type Description Default value
    source String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    For example:
    now-sdk clean /path/to/package

    pack

    Package the build artifacts that were output with the previous build into an installable ZIP file.

    The pack command has the following structure:
    now-sdk pack <source> 
    Table 15. Optional parameters
    Parameter Type Description Default value
    source String The path to the directory that contains the package.json file for your application.

    The package.json should be in the base directory of your application.

    Current working directory
    For example:
    now-sdk pack /path/to/package 

    explain

    View documentation and examples for a ServiceNow Fluent API.

    The explain command has the following structure:
    now-sdk explain <topic> [--list <keyword>] [--format <output type>] [--peek <flag>]
    Table 16. Required parameters
    Parameter Type Description Default value
    topic String A keyword or topic name to search for to view related ServiceNow Fluent API, guide, or skill documentation, such as table-api or table-guide. To get a list of available topics, use the --list parameter.
    Table 17. Optional parameters
    Parameter Type Description Default value
    --list, -l Boolean An option to view a list of available topics, which you can filter by providing a topic name or keyword, such as now-sdk explain flow --list. The list returned includes matches that contain the keyword and possibly related matches.
    --format String An option to format the output for the terminal (pretty) or as Markdown (raw). pretty
    --peek, -p Boolean An option to display a short description of a topic instead of the complete topic content. You can use this parameter with the --list parameter to display summaries of the listed topics.
    For example:
    now-sdk explain uipage-api --format raw