@apidex/cli
v0.2.0
Published
Official apidex.dev CLI tool for uploading API spec files
Maintainers
Readme
@apidex/cli
Agent-native CLI for apidex.dev. Manage projects and API specs from your terminal, CI, or an AI agent — no dashboard, no prompts.
Install
npm install -g @apidex/cli
# or run ad-hoc:
npx @apidex/cli --helpAuth
Every command needs an API token (create one under CLI in the dashboard).
Provide it with --token or the APIDEX_TOKEN environment variable.
export APIDEX_TOKEN=apx_your_token_hereThe API base URL defaults to https://api.apidex.dev; override with --api-url
or APIDEX_API_URL.
Global options
| Option | Description |
| --- | --- |
| -t, --token <token> | API token (or set APIDEX_TOKEN) |
| --api-url <url> | API base URL (or set APIDEX_API_URL) |
| --json | Print the raw API response as JSON (for scripting/agents) |
--json emits only the API response on stdout; in human mode you get a spinner
and a short summary. Any failure exits non-zero with the error on stderr. There
are no interactive prompts — missing required input is an error, not a question.
Commands
project
apidex project create --name <name> [--theme <id>] [--description <text>]
apidex project list
apidex project remove <projectId>--theme accepts any public-page theme id (e.g. rose-pine, catppuccin,
tokyo-night, nord, ayu).
subdomain
apidex subdomain set <projectId> --subdomain <s> # claim/change the {x}.apidex.dev address
apidex subdomain remove <projectId> # release it (reverts to a generated id)The subdomain is the project's public address segment. Use 3–32 lowercase
letters, digits, or hyphens (no leading/trailing hyphen); a handful of words
(www, api, app, …) are reserved. Changing it mutates the project's
canonical URL.
spec
apidex spec sync <projectId> --file <path> [--slug <s>] [--title <s>] [--public]
apidex spec remove <projectId> --slug <s>spec sync is an upsert: with --slug it updates that spec (creating it if
the slug doesn't exist yet); without --slug it creates a new spec. Running the
same --slug command repeatedly is idempotent — ideal for CI.
guide
apidex guide sync <projectId> --file <path.md> [--slug <s>] [--title <s>]
apidex guide remove <projectId> --slug <s>changelog
apidex changelog sync <projectId> --file <path.md> [--slug <s>] [--title <s>]
apidex changelog remove <projectId> --slug <s>guide/changelog sync read a markdown file and upsert exactly like spec sync.
The title comes from --title, else a YAML front-matter title:, else the first
# Heading in the file. --slug (or a front-matter slug:) makes it an
idempotent upsert; a front-matter published_on: sets a changelog entry's date.
Examples
Create a project and sync a spec into it, capturing JSON for an agent:
export APIDEX_TOKEN=apx_...
PROJECT=$(apidex project create --name "My API" --json | jq -r .public_id)
apidex spec sync "$PROJECT" --file ./openapi.json --slug my-api --public --jsonGitHub Actions:
- name: Sync API Docs
env:
APIDEX_TOKEN: ${{ secrets.APIDEX_TOKEN }}
run: |
npx @apidex/cli spec sync ${{ vars.APIDEX_PROJECT_ID }} \
--file ./openapi.json --slug my-api --publicDevelopment
npm install
npm run build # tsc -> dist/
npm test # builds, then runs scripts/cli-selftest.mjs (no network)