Quickstarts by surface
Publish from the CLI
Create an author, category, tag, and reviewed draft from a terminal.
Use this quickstart when a terminal command fits your local workflow, continuous integration job, or agent task.
Before you start
Install the CLI and create a private key with create, read, update, and publish access for posts, authors, categories, and tags.
npm install -g @cli-blog/cliConfigure the key
Keep the private value in your shell or secret manager:
cli-blog config set --api-key "$CLI_BLOG_PRIVATE_API_KEY"Create the draft
Create the supporting resources and pass their returned IDs into the post command:
AUTHOR_ID=$(cli-blog authors create --public-name "Maya Chen" --json | jq -r '.id')
CATEGORY_ID=$(cli-blog categories create --name "Engineering" --locale en-US --json | jq -r '.id')
TAG_ID=$(cli-blog tags create --name "Launch notes" --locale en-US --json | jq -r '.id')
POST=$(cli-blog posts create \
--title "Shipping an API-first blog" \
--body-markdown "## What shipped\n\nA reviewed product update." \
--author-ids "$AUTHOR_ID" \
--category-ids "$CATEGORY_ID" \
--tag-ids "$TAG_ID" \
--json)Inspect the draft before publication:
printf '%s' "$POST" | jq '{ id, title, slug, status, version }'Publish the reviewed version
Publish the exact version returned by the create command:
POST_ID=$(printf '%s' "$POST" | jq -r '.id')
POST_VERSION=$(printf '%s' "$POST" | jq -r '.version')
cli-blog posts publish "$POST_ID" --expected-version "$POST_VERSION" --jsonContinue with the CLI guide or inspect every post action.