← Back to blog
AI & Automation3 min read

QR code via command line: Install and use the sameqr CLI

Bild von Unsplash

Why the command line

A CLI (Command Line Interface) is a program that you operate via text commands in the terminal. A command can be repeated, written into a script, chained with other tools, and executed by a coding agent. The sameqr CLI brings Same-QR exactly there. It has no further dependencies and requires only Node.js version 18 or higher.

Step 1: Install

The CLI is available via npm, the package manager for Node.js:

npm install -g sameqr
sameqr --version

Step 2: Create API key

In the dashboard under Account, you will find the section 'Access for CLI, scripts and agents'. Create a key there. For now, 'read + write' is sufficient: create, change names and texts. Anyone who also wants to change the targets of existing codes, take pages offline, or delete them should choose 'full'. It starts with sqr_live_ and is displayed only once. Save it immediately in your password manager.

Step 3: Log in

The key is never passed as an argument, otherwise it would appear in the shell history. "sameqr login" prompts for it discreetly, verifies it, and saves it in a read-only manner for you in ~/.config/sameqr/config.json. Alternatively, you can set the environment variable SAMEQR_API_KEY, which always takes precedence.

sameqr login
sameqr whoami

"sameqr whoami" shows your account, the plan, and how many codes you can create.

Step 4: Create the first code

sameqr qr create --name "Speisekarte Tische" --url https://example.com/karte
sameqr qr list
sameqr qr update <id> --url https://example.com/winterkarte
sameqr qr stats <id>

With --slug, you set your own short link when creating, with --label you attach labels. Their identifiers are shown by 'sameqr labels list'. Changing the target, taking offline, and deleting require a 'full' key. The CLI then asks in the terminal, in scripts without a terminal it only works with explicit --yes. Via the API, a maximum of 10 such changes per hour and 30 per day are possible.

Step 5: Hosted pages and menus

sameqr seite create --vorlage speisekarte --name "Gasthof zum Löwen"
sameqr karte import karte-1.jpg karte-2.jpg --seite menu/gasthof-zum-loewen
sameqr seite publish menu/gasthof-zum-loewen
sameqr qr create --name "Tischaufsteller" --seite menu/gasthof-zum-loewen

"seite create" outputs the address of the new page, in the example menu/gasthof-zum-loewen. You need this for the following commands. The page is created as a draft. "karte import" reads the photos using AI and attaches the recognized groups to the page without overwriting anything. Review the draft before publishing. To publish, the operator details must be filled in. The last command creates a code that points directly to the page. Further templates: preisliste, zeiten, links, aktion, weingut, etikett and kontakt.

Step 6: In scripts with --json

If you append --json to a command, the response comes as JSON. Errors also appear as JSON on the error output, and the return value indicates the type: 3 means not logged in, 4 means missing permissions, 2 means an incorrect input. This allows a script to react specifically rather than interpreting text.

sameqr qr list --json

Conclusion: why Same-QR

The sameqr-CLI brings the full functionality of Same-QR into the terminal: codes, statistics, hosted pages, menus from photos, labels, and projects. It is lightweight, handles your key carefully, and speaks JSON for scripts and coding agents. And it works in every plan.

Get started right away: sign up for free at sameqr.com, two dynamic QR codes are free forever. API, CLI and MCP server are included in every plan, and the documentation is at sameqr.com/entwickler.

Create dynamic QR codes for free
Start with 2 dynamic QR codes that are free forever. No subscription, no credit card.
Start free now →

Frequently asked questions

What are the prerequisites for the CLI?

Node.js version 18 or higher and a Same-QR account with an API key. It does not require any further packages.

Where does the CLI store my key?

In ~/.config/sameqr/config.json, readable only by you. If SAMEQR_API_KEY is set, nothing is saved. "sameqr logout" deletes the saved key.

How do I set up a coding agent with it?

"sameqr mcp" displays the ready-made entries for Claude Code, Cursor, and Codex.

Reserve a spot

Reserve your spot before we go live.

One email as soon as the tool goes live — including pricing and the free plan. No spam, unsubscribe any time.

Only until launchLaunching in the next few weeks
  • Your free account is reserved — there is nothing to pay yet anyway
  • 90 days of unlimited destination changes instead of 30, only for early sign-ups
  • Launch price locked in, even if we raise prices later

By subscribing you consent to receiving the newsletter. You can withdraw consent at any time via the unsubscribe link in every email.

Keep reading