# @api-client/cli

> API Now! CLI

Latest version **1.0.4** (published 2026-05-30) · 0 weekly downloads

## Install

```sh
npm install @api-client/cli
pnpm add @api-client/cli
yarn add @api-client/cli
bun add @api-client/cli
```

Provides the command `apinow`.

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2026-05-30 |
| First published | 2022-03-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22.0.0 |
| Dependencies | 5 |
| Unpacked size | 76.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jarrodek |

## Links

- npm: https://www.npmjs.com/package/@api-client/cli
- npm.io page: https://npm.io/package/@api-client/cli

## Dependencies (5)

- [open](https://npm.io/package/open.md) ^11.0.0
- [commander](https://npm.io/package/commander.md) ^15.0.0
- [update-notifier](https://npm.io/package/update-notifier.md) ^7.3.1
- [@api-client/core](https://npm.io/package/@api-client/core.md) ^0.21.7
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) ^8.5.0

## Recent versions

- 1.0.4 (latest) — 2026-05-30
- 1.0.3 — 2026-05-30
- 1.0.2 — 2026-05-30
- 1.0.1 — 2026-05-30
- 1.0.0 — 2026-05-30
- 0.2.2 — 2022-03-22
- 0.2.1 — 2022-03-21
- 0.1.0 — 2022-03-14

## README

# API NOW! CLI

The **API NOW! CLI** is a robust, cross-platform command-line tool designed to manage settings, handle authentication, organize directories/files, and publish assets directly to the Data Catalog from your terminal.

---

## Features

- **OAuth2 Loopback Authentication**: Authenticate using your Google, GitHub, or LinkedIn accounts.
- **Interactive Onboarding**: Guided setup prompts for first-time users to configure organization names and slugs (validated against reserved keywords/taken values).
- **Default Organization Management**: List organizations and pin a default workspace ID.
- **Metadata and Media Uploads**: Create, list, and read blueprints, domains, and multimedia assets.
- **Data Catalog Publishing**: Publish schemas and datasets to the global/private catalog with automatic semantic versioning support.
- **Developer Formatting Options**: Toggle outputs between human-friendly ASCII tables and machine-readable JSON.

---

## Installation

Install the CLI globally from npm:

```bash
npm install -g @api-client/cli
```

Once installed, the CLI is available as the `apinow` command.

---

## Usage & Commands

All commands support the following global options:
- `--api-url <url>`: Override the target API Server URL (Default: `http://localhost:8080`). Note that the platform is actively under development and the final default URL will be set once the platform is officially released.
- `--format <text|json>`: Define the output layout (Default: `text`).

### 1. Configuration (`config`)
Read and write persistent CLI configurations stored in the OS settings folder depending on the platform:
- **Linux**: `~/.config/apinow-cli/config.json` (or respects `$XDG_CONFIG_HOME`)
- **macOS**: `~/Library/Preferences/apinow-cli/config.json`
- **Windows**: `%APPDATA%\apinow-cli\config.json`

```bash
# Get a configuration property (e.g. apiUrl, defaultOrg)
apinow config get <key>

# Set a configuration property
apinow config set <key> <value>
```

### 2. Authentication (`auth`)
Securely log in to the API platform using OAuth2.

```bash
# Log in using Google, GitHub, or LinkedIn
apinow auth login <google|github|linkedin>

# Verify current authentication status and user identity details
apinow auth status

# Log out and erase stored authentication tokens
apinow auth logout
```

*Note: On your first login or checking status with no registered organization, an interactive step will automatically guide you through creating your first organization with live slug verification.*

#### Personal Access Tokens (`auth tokens`)
Generate and manage Personal Access Tokens (PATs) for programmatic access.

```bash
# List all personal access tokens
apinow auth tokens list

# Create a new personal access token
apinow auth tokens create [--name <token_name>] [--expires-at <duration_or_timestamp>]

Example:
apinow auth tokens create --name "Test Token" --expires-at "30 days"

# Delete a personal access token by its ID
apinow auth tokens delete <token_id>
```

### 3. Organizations (`orgs`)
Manage organization contexts.

```bash
# List all organizations you belong to
apinow orgs list

# Get the default configured organization
apinow orgs get-default

# Set default organization to avoid passing --org CLI parameters
apinow orgs set-default <organization_id>
```

### 4. Files (`files`)
Manage domain and API files in your organizations.

```bash
# List files with optional filters
apinow files list --org <org_id> --parent <parent_id> --kind <domain|api>

# Create file metadata and upload local media
apinow files create --name "My Domain File" --kind "domain" --org <org_id> --parent <parent_id> --media ./path/to/schema.ts

# Create file metadata and pipe media contents from STDIN
echo '{"schema": "content"}' | apinow files create --name "My Piped File" --kind "api" --org <org_id> --stdin

# Read file metadata (default) or media content (--media)
apinow files read --id <file_id> --org <org_id> [--media]
```

### 5. Data Catalog (`catalog`)
Publish and browse published catalog items.

```bash
# Publish a local data domain file to the catalog
apinow catalog publish --file <file_id> --name "Catalog Name" --description "Catalog Description" --scope public --catalog-version 1.0.0

# List all published data domains in the catalog
apinow catalog list --scope <all|public|organization|private> [--key <domain_key>]
```

---

## Development

### Local Setup & Building
1. Clone the repository and install dependencies:
   ```bash
   npm install
   ```

2. Build the package:
   ```bash
   npm run build
   ```

3. Run the CLI locally:
   ```bash
   # Run directly via tsx (Development)
   npm run dev -- [command]

   # Or execute the compiled build
   node dist/index.js [command]
   ```

### Formatting and Linting
To format the source code with Prettier:
```bash
npm run format
```

To run the ESLint static code analysis checks:
```bash
npm run lint
```

### Type Checking
To run the TypeScript compiler in dry-run mode:
```bash
npm run typecheck
```

---
_Source: https://npm.io/package/@api-client/cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
