Your first CLI session
On this page, you walk step by step through logging in to Hako CMS with hakocms-cli, then editing one entry and publishing it. It takes about 15 minutes.
Before you begin
Section titled “Before you begin”- Install
hakocms-cli(Install the CLI) - Have a Hako CMS environment and a space that contains entries. If you do not have them yet, create a space, a content type, and an entry with the Quickstart. As in the Quickstart, this page uses
blogas the space slug andpostsas the content type ID - Be a member of that space with a role that can edit and publish entries (owner, admin, or editor)
The IDs, dates and times, and field values on this page are examples. Your environment shows different values.
1. Log in
Section titled “1. Log in”In a terminal, run the following command. Replace <hostname> with the hostname of your environment. The hostname is the <hostname> part of the admin address https://<hostname>.hakocms.net/admin.
hakocms-cli auth login --host https://<hostname>.hakocms.netA confirmation code and a URL are shown as follows, and a browser opens.
First check this code in the browser: DCHP-QPXWApprove the login at: https://<hostname>.hakocms.net/admin/cli-login?code=DCHP-QPXWWaiting for approval…The browser shows the [CLI のログイン](CLI login) screen. If you are not logged in to the admin, log in first.
- Check that the code on the screen matches the code shown in the terminal (
DCHP-QPXWin this example) - Press [許可する](Allow). “許可しました。端末に戻ってください” (Approved. Return to your terminal.) is shown
When you go back to the terminal, it shows the following.
✓ Logged in to <hostname>.hakocms.net (https://<hostname>.hakocms.net) as you@example.comIf a browser does not open, open the URL shown in the terminal in a browser on your computer. The confirmation code expires in 10 minutes.
2. Choose a space
Section titled “2. Choose a space”List the spaces in the environment you logged in to.
hakocms-cli spaces listThe spaces you are a member of are shown.
ID SLUG NAME ROLE CREATED ATsdbm329n7t7o blog ブログ owner 2026-10-23T04:17:48.862ZSet the space you will use. Once you set it, you do not need to add --space blog to every command.
hakocms-cli spaces use blog✓ Using the space blog on <hostname>.hakocms.net3. List entries
Section titled “3. List entries”List the content types in the space.
hakocms-cli content-types listID ENDPOINT NAME KIND UPDATED AT CREATED ATk4xst7lr0ikx posts 記事 collection 2026-10-23T04:18:29.560Z 2026-10-23T04:18:29.560ZThe [ENDPOINT] column is the content type ID. List the entries in posts. Specify the content type with --type (short form -t).
hakocms-cli entries list -t postsID STATUS UPDATED AT CREATED ATiazte4ghzm55 draft 2026-10-23T04:18:29.640Z 2026-10-23T04:18:29.640ZThe [ID] on the left is the entry ID. You use it in the next step.
4. Edit the entry
Section titled “4. Edit the entry”Look at the entry’s values. Replace <entry ID> with the ID shown in step 3.
hakocms-cli entries get <entry ID> -t postsid: iazte4ghzm55contentTypeId: k4xst7lr0ikxstatus: draftpublished:draft: {"title":"はじめての記事","body":"CLIから書きました"}createdAt: 2026-10-23T04:18:29.640ZupdatedAt: 2026-10-23T04:18:29.640ZpublishedAt:revisedAt:reservation: {"publishAt":null,"closeAt":null,"error":null,"failedAt":null}Change the title. Pass a field ID and a value joined with = to --set.
hakocms-cli entries update <entry ID> -t posts --set title=はじめての記事(直した)The output shows that title in the draft value changed. The field you did not specify (body) stays as it was.
status: draftdraft: {"title":"はじめての記事(直した)","body":"CLIから書きました"}At this point, the change is only saved as a draft. Like [保存](Save) in the admin, it does not appear on your site yet.
5. Publish
Section titled “5. Publish”hakocms-cli entries publish <entry ID> -t postsstatus becomes published, and published holds the current values.
status: publishedpublished: {"title":"はじめての記事(直した)","body":"CLIから書きました"}draft:publishedAt: 2026-10-23T04:18:42.148Z6. Verify
Section titled “6. Verify”In the admin, open the entry in [記事](Articles) in blog. The title is now “はじめての記事(直した)”, and the entry is published.
You can also retrieve it from the Content API (Read entries).
curl https://<hostname>.hakocms.net/api/v1/content/posts/<entry ID> \ -H "Authorization: Bearer <API key>"What to do next
Section titled “What to do next”- Log in with the CLI: where tokens are stored, using the CLI from CI, and switching between several environments
- Edit and retrieve entries in bulk
- Apply a schema from CI
- CLI output and exit codes:
--jsonand--jq, and using the CLI in scripts