Like the TypeScript SDK — which the CLI is built on internally — this calls the live API, not a bundled snapshot. It needs an API key and is subject to your plan’s usage quotas. For offline/bundled data with no API key, see npm Packages.
Installation
Quick Start
Global Flags
These flags work on every command:Authentication
Search
Fuzzy, typo-tolerant search
Requires Professional+ plan.
--type defaults to city if omitted. --country scopes results and isn’t used with --type country.
Per-entity, reusing --filter’s value as the fuzzy query:
--fuzzy requires --filter on these subcommands — the CLI exits with an error if you pass --fuzzy without it. On cities, --state is ignored when --fuzzy is set, since fuzzy search only scopes by country.
Fuzzy results replace the usual per-entity table with a shared one:
--fields and --sort
Requires Supporter+ plan.
search countries/states/cities — passed straight through to the API instead of the CLI always fetching full objects:
When
--fields narrows the response, output falls back to a generic table showing whatever columns actually came back — the CLI’s usual hardcoded columns (ISO2, Capital, Phone, and so on) may not all be present anymore.Get Details
Usage & Billing
csc upgrade fetches live plan and pricing data from the API on every run, so what you see always matches the current pricing page — it isn’t a table baked into the CLI’s own code that can drift out of date.Plan-Gated Features
Hitting a command your plan doesn’t include shows the specific plan you need and a direct upgrade link, not just a generic message:Code Generation
Requires Supporter+ plan.
Live Location Components
These commands create live components that call the Autocomplete API as the user types. Unlikedropdown and seed, they do not download data when you generate the files, so the generator works offline.
The generated component needs a Professional or Business API plan when it runs. Get an API key or compare plans.
--target is required: nextjs or react-browser. --output <dir> defaults to the current directory. Both generators always produce TypeScript (.tsx) — there’s no --typescript/--no-typescript toggle like dropdown has.
Choosing a target
- nextjs (recommended)
- react-browser
Generates a server Route Handler (
app/api/csc-search/route.ts) that holds CSC_API_KEY server-side and proxies to the Autocomplete API — the key never reaches the browser. autocomplete and location-picker share this same route file when both are generated with nextjs.What gets generated
Every run also writes an.env.example and a short README:
.env.example uses a placeholder, never a real key — CSC_API_KEY=YOUR_API_KEY_HERE for nextjs, VITE_CSC_API_KEY=YOUR_API_KEY_HERE for react-browser.
For safety, the command stops before writing anything if one of these files already exists. It never replaces your existing files.
Behavior
Both components share the same search-field logic:- Debounced input (~250ms), 2-character minimum before searching
- Cancels the previous in-flight request when new input arrives, so a slow response never overwrites a newer one
- Five distinct states —
loading,empty,plan-restricted,rate-limited,network-error— each with its own message, not one generic error - Full keyboard support:
ArrowUp/ArrowDownto move,Enterto select the highlighted result,EscapeorTabto close - ARIA combobox pattern (
role="combobox",aria-expanded,aria-controls,aria-autocomplete,aria-activedescendant) for screen readers
Selections carry stable identifiers (
id, iso2, country_code, state_code, depending on entity) alongside the display label. Use the identifiers for anything programmatic — storing a selection, filtering a follow-up request, and so on. label is for display only.location-picker cascades three fields — country, then state, then city. The state field is disabled until a country is picked; the city field is disabled until a state is picked. Selecting a country clears both state and city; selecting a state clears only city:
autocomplete reports its selection via onSelect?: (result: IAutocompleteResult) => void. location-picker reports the whole cascade via onChange?: (value: LocationPickerValue) => void, called after every level changes.
Interactive Explorer
csc generate command to copy-paste.
Requires an interactive terminal (TTY). Use
csc search for scripts.Export
Source
GitHub Repository
View the CLI source, open issues, or contribute.
npm Package
View published versions and changelog.