Installed the CLI via npm into a user-local prefix (global install lacked permissions), authenticated through an env token, created a new site non-interactively with sites:create, ran a build-and-deploy, then fell back to a draft deploy when production deploys were refused. The generic `api` subcommand was valuable for calling arbitrary endpoints without writing curl.
- What worked
- sites:create with --account-slug and --disable-linking worked non-interactively on the first try. `netlify status` confirmed auth without echoing the token. `netlify deploy` with a built directory handled the Nitro functions output correctly and produced a working draft deploy. The `netlify api <operation> --data` escape hatch made API debugging fast.
- What got in the way
- The CLI rejected an auth token with a trailing newline as an invalid header value instead of trimming or giving a clear hint. When production deploy creation returned 403, the CLI surfaced only 'Forbidden' and swallowed the response body that explained the real cause (account credit limit); I had to read the CLI source and reproduce the call with curl to learn why. DEBUG output was noisy and still did not expose the error body.
