Get Started

Theme switcher

Theneo CLI

The Theneo CLI (Command Line Interface) is s a command-line tool for effortless management of the Theneo platform from your terminal. Create, manage, and publish API documentation with ease, all without leaving your command line.

You can find Github repo here or the npm package here → https://www.npmjs.com/package/@theneo/cli

To install the Theneo CLI, use the following command:

Bash
npm install -g @theneo/cli@latest

This command installs the Theneo CLI globally on your machine, allowing it to be run from any directory.

Basic Usage

To get started with Theneo CLI, you can use the help command:

Bash
theneo help

This command provides a list of available options and commands:

General Options:

  • -V, --version: Outputs the version number of the Theneo CLI.
  • -h, --help: Displays help for a specific command.

Primary Commands:

  • login: Logs into the Theneo CLI.
  • project <action>:Executes project related commands.
  • workspace <action>: Executes workspace related commands.
  • version <action>: Executes project version related commands.
  • help [command]: Provides help for a specific command.

Common Use Cases

Logging In

Standard Login:

Bash
theneo login

Login with an API Key:

Bash
theneo login --token <theneo-api-key>

You can also set the THENEO_API_KEY environment variable.

Creating a New Project

Bash
theneo project create --help Usage: theneo project create [options] Create new project Options: --name <name> Project name --workspace <workspace> Enter workspace slug where the project should be created in, if not present uses default workspace -f, --file <file> API file path to import (eg: docs/openapi.yml) --link <link> API file URL to create project using it --postman-api-key <postman-api-key> Postman API Key (env: THENEO_POSTMAN_API_KEY) --postman-collection <postman-collection> Postman collection id, you can use multiple times --empty Creates empty project (default: false) --sample Creates project with sample template (default: false) --publish Publish the project after creation (default: false) --public Make published documentation to be publicly accessible. Private by default (default: false) --generate-description <generate-description> Indicates if AI should be used for description generation (choices: "fill", "overwrite", "no_generation", default: "no_generation") --profile <string> Use a specific profile from your config file. -h, --help display help for command

Standard Project Creation:

Bash
theneo project create

Creating a Project with an API Spec File:

Bash
theneo project create --name api-documentation --generate-description overwrite --publish --public --file ./examples/openapi-spec.json

Creating a Project Using a Link to API Documentation:

Bash
theneo project create --name api-documentation --generate-description fill --publish --public --link https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/uspto.json

Creating a Project from Postman Collections:

Bash
theneo project create --name api-documentation --postman-api-key <key> --postman-collection <id-1> --postman-collection <id-2>

Updating API Documentation from an API Spec File

Bash
Usage: theneo project import [options] Import updated documentation into Theneo using file, link or postman collection Note: Published document link has this pattern: https://app.theneo.io/<workspace-slug>/<project-slug>/<version-slug> Options: --project <project-slug> Specify the project slug to import updated documentation in -f, --file <file> API file path to import (eg: docs/openapi.yml) --link <link> API file URL to create project using it --postman-api-key <postman-api-key> Postman API Key (env: THENEO_POSTMAN_API_KEY) --postman-collection <postman-collection> Postman collection id, you can use multiple times --import-type <import-type> Indicates how should the new api spec be imported (choices: "endpoints", "overwrite", "append", "merge") --publish Automatically publish the project (default: false) --workspace <workspace-slug> Workspace slug, where the project is located --projectVersion <version-slug> Project version slug to import to, if not provided then default version will be used --keepOldParameterDescription Additional flag during merging import option, it will keep old parameter descriptions --keepOldSectionDescription Additional flag during merging import option, it will keep old section descriptions --profile <string> Use a specific profile from your config file. -h, --help display help for command

Updating a Project:

Bash
theneo project import --file <file> --project <project-slug> --publish

Import with merge option

Bash
theneo project import --project <project-slug> \ --workspace <workspace-slug> \ --projectVersion <version-slug> \ --publish \ --file ./api-spec.json \ --import-type merge \ --keepOldParameterDescription \ --keepOldSectionDescription

Publishing Documentation

Bash
theneo project publish --project <project-slug>

Deleting a Project

Bash
theneo project delete --project <project-slug>

Project Version

Bash
theneo version --help Usage: theneo version [options] [command] <action> Project version related commands Options: -h, --help display help for command Commands: list [options] List project versions create [options] delete [options] help [command] display help for command

Create Version

Bash
Usage: theneo version create [options] Options: --name <name> Name of the version --project <project-slug> Project slug to create version for --workspace <workspace-slug> Workspace slug where the project is --previousVersion <previous-version-slug> Previous version slug to duplicate the content from --profile <string> Use a specific profile from your config file. -h, --help display help for command

Add ChangeLog subscriber

Bash
Usage: theneo version add-subscriber [options] Add a subscriber for project changelog Options: --project <project-slug> Project slug --workspace <workspace-slug> Workspace slug --projectVersion <previous-version-slug> Project version slug --email <email> Email of the new subscriber to change log --profile <string> Use a specific profile from your config file. -h, --help display help for command

Use the main branch changes

Clone the repository

Bash
git clone git@github.com:Theneo-Inc/theneo-tools.git

Install packages

Bash
nvm use
npm install

Install the CLI

Bash
npm run cli

Run the CLI

Bash
theneo help

Change theneo API endpoint

  • Using environment variable
Bash
THENEO_API_KEY=<theneo-api-key> THENEO_API_URL=https://api.theneo.io THENEO_APP_URL=https://app.theneo.io \theneo <command>

  • Using theneo config file and profile
Bash
theneo login --profile <profile-name> --token <theneo-api-key> --api-url https://api.theneo.io --app-url https://app.theneo.io

check the config file at .config/theneo/config

CLI Export

Export Project Data in Markdown Format - Beta Feature

Bash
Usage: theneo export [options] Options: --project project slug --projectVersion Version slug --workspace Enter workspace slug where the project should be created in, if not present uses default workspace --profile Use a specific profile from your config file. --dir

Export an OpenAPI Spec - Beta Feature

You can export your Theneo docs into an openAPI spec, by running the following command

Bash
theneo export --openapi --format json

You can use the same exporting options as in the regular export command.

Managing Projects Using Markdown Files via CLI

Create a New Project from Markdown Files

Bash
Usage: theneo create [options] Options: --dir <directory> directory location where the project will be exported --name <project-name> project name --workspace <workspace-slug> Enter workspace slug where the project should be created in, if not present uses default workspace --profile <string> Use a specific profile from your config file. -h, --help display help for command

Import Project Data from Markdown Files

Bash
Usage: theneo import [options] Update theneo project from generated markdown directory Options: --project <project-slug> project slug --workspace <workspace-slug> Enter workspace slug where the project

Best Practices and Tips

  • Always check the version of the Theneo CLI installed with theneo -V to ensure compatibility with your project.
  • Utilize the --help option regularly to understand the specific requirements of each command.
  • Regularly update your Theneo CLI to access the latest features and bug fixes.
  • When importing or updating projects, ensure your API specifications are correctly formatted to avoid errors.
Was this section helpful?

What made this section unhelpful for you?

On this page
  • Theneo CLI