← Back to blog
AI & Automation2 min read

QR codes in deployment: Automatically switch targets after a release

Image from Unsplash

Printed QR codes and new addresses

During a release, pages move: /sommerkarte becomes /karte, /produkt-a becomes /produkte/a. On the website, you handle this with redirects. However, printed QR codes continue to point to the old address, and redirect chains become longer with each release. With dynamic QR codes from Same-QR, you instead switch the target directly to the new address.

Step 1: Assignment in the repository

Keep track of which QR code should point where, for example in qr-ziele.csv next to your QR code. You retrieve the identifiers once with “sameqr qr list”:

speisekarte-lx3k9a1b2;https://example.com/karte
flyer-herbst-q8w7e6r5;https://example.com/aktion/herbst

Step 2: Key for the pipeline

In the dashboard under Account, set up a dedicated "full" key under "Access for CLI, scripts and agents" specifically for deployment, as target changes require this level with an appropriate validity period. Store it as the secret variable SAMEQR_API_KEY in your CI. The CLI reads it from there without saving it.

Step 3: Switching after the release

After a successful deployment, a short step runs:

npm install -g sameqr
while IFS=";" read -r id url; do
  curl -fsS -o /dev/null "$url" || { echo "Ziel nicht erreichbar: $url"; exit 1; }
  sameqr qr update "$id" --url "$url" --yes --json || exit 1
done < qr-ziele.csv

The script first checks whether the new address responds, and only then makes the change. In case of an error, it aborts. Because no one is at the terminal in the CI, --yes confirms the change. The CLI reads the current status of each QR code beforehand. Important: Through the API, there are a maximum of 10 target changes per hour and 30 per day. Thus, this step is suitable for a handful of QR codes per release. For larger changes, use the dashboard or time control.

Time control as an alternative

If the timing is known in advance, such as a launch on Monday at 9 a.m., Gastro Pro and Marketing Pro offer time control: A QR code redirects from a date or at specific times to a different target, in the QR code's time zone, with up to 10 rules. Then no step in the deployment is needed.

Back if something goes wrong

Keep the old mapping. A rollback is then the same step with the previous file. Additionally, Same-QR checks all targets every night and sends an email if one is unreachable.

Conclusion: why Same-QR

With Same-QR, printed QR codes become part of your deployment: a CLI that fits into any pipeline, protection against parallel overwriting, time control from Gastro Pro and Marketing Pro, and nightly target checks as a safety net. No link leads to a dead end after a release.

Get started right away: sign up for free at sameqr.com, 20 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 20 dynamic QR codes that are free forever. No subscription, no credit card.
Start free now →

Frequently asked questions

Where does the key go in the CI?

In the secret variables of your CI as SAMEQR_API_KEY, never in the repository.

What happens if the script aborts in the middle?

The QR codes redirected so far point to the new addresses, the rest to the old ones. With the same file, the step can be easily repeated.

Do target changes count against a limit?

In the free plan, the number of target changes per QR code is limited, in the paid plans it is not.

Newsletter

New articles straight to your inbox

Tips on dynamic QR codes, new features, no spam. Unsubscribe any time.

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

Keep reading