Installation

Updated: 2026-11-28 · Smart Albums 1.0.150

Smart Albums runs as its own container next to Immich. It needs no image of its own: a slim Python image runs the code from the app/ folder. You need Docker Compose, a running Immich and an API key.

What you need

  • Immich with face recognition. For the folder structure, an external library, see Photos and folders.
  • One folder for the code (app/) and one for the data (data/).
  • An authenticator app on your phone, for signing in.

1. Create folders and copy the code

Create two folders, for example /path/to/smart-albums/app and /path/to/smart-albums/data. Copy the contents of app/ from the download into the first one. The second stays empty; Smart Albums creates its files there itself.

2. API key in Immich

In Immich, go to Account Settings › API Keys › New API Key and create a key, for example named smart-albums.

The key acts on behalf of the user who owns it. The albums belong to this user, and Smart Albums finds this user's photos and those of their partners. The key needs these permissions:

Area Permissions
People person.read
Users user.read
Search photos asset.read
Albums album.create, album.read, album.update, album.delete
Photos in albums albumAsset.create, albumAsset.delete
Album users albumUser.create, albumUser.update, albumUser.delete
Shared links sharedLink.create, sharedLink.update, sharedLink.delete
Read tags tag.read
Write tags, smart tags tag.create, tag.update, tag.delete, tag.asset
Folder structure, type “Folder” folder.read, library.read
  • Without album.delete, everything works except deleting the Immich album together with a smart album.
  • Without the tag permissions, the “Tags” tile is missing. With only tag.read, you can view tags but not set them.
  • If you replace the key later, the new one must belong to the same user. Otherwise the existing albums count as deleted.
  • If a permission is missing, the app reports HTTP 403.

Tip

Don't keep the key in files or chats, keep it in your password manager. In Compose, it comes in as a variable from the .env file.

3. Compose file

An example. Adjust paths, ports and addresses:

services:
  smart-albums:
    container_name: immich-smart-albums
    image: python:3.12-alpine
    restart: unless-stopped
    working_dir: /app
    command: ["python", "-u", "app.py"]
    environment:
      TZ: Europe/Zurich
      DATA_DIR: /data
      IMMICH_URL: http://immich_server:2283
      IMMICH_PUBLIC_URL: https://photos.example.com
      IMMICH_API_KEY: ${IMMICH_API_KEY:?IMMICH_API_KEY missing}
      SHARE_URL: https://links.example.com
      OVERVIEW_URL: https://links.example.com
      GALLERY_URL: https://gallery.example.com
      SYNC_INTERVAL_MIN: "30"
    volumes:
      - /path/to/smart-albums/app:/app:ro
      - /path/to/smart-albums/data:/data
    ports:
      - "8080:8080"   # admin
      - "8081:8081"   # recipients' overviews
      - "8082:8082"   # public gallery
    networks:
      - immich
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request;urllib.request.urlopen('http://127.0.0.1:8080/healthz',timeout=4)"]
      interval: 60s

networks:
  immich:
    external: true

The container joins the same Docker network as Immich and reaches it internally at http://immich_server:2283. If your network has a different name, change it.

The three ports belong to three web servers in the same container:

Port What Who opens it
8080 Admin only you, with sign-in
8081 Recipients' overviews (/s/<code>) your recipients
8082 Public gallery everyone

Don't put the admin on the internet, or only behind a reverse proxy with HTTPS. Overviews and gallery are meant for your recipients and need a public address.

4. Make the external library writable

You need this if you use tags or smart tags and your photos are in an external library. Immich then writes tags as an XMP file (photo.jpg.xmp) next to the photo. If it can't, it reads the old state back at the next scan, and the tag is gone again right away.

  • In Immich's Compose file, change the photo mount from :ro to :rw.
  • The user Immich uses to access the folder needs the permissions write, write attributes, write extended attributes and delete. Delete is needed because Immich replaces an existing .xmp via a temporary file.

Immich does not change the original photos. Still keep a backup of your photos.

Test: set a tag. A file <photo>.xmp appears next to the photo, and the tag stays.

5. Start and first sign-in

Start the stack and open the admin in your browser. The first time, every page leads to “Set up sign-in”.

  1. Get the setup code from the container log:

    bash docker logs immich-smart-albums 2>&1 | grep Einrichtungscode

    The code changes with every restart; the last line counts. If your container has a different name, use that name. 2. Choose a user name and a password with at least 10 characters. 3. Scan the QR code with an authenticator app and enter the 6-digit code. The app is required, even on your local network.

After 5 failed attempts, sign-in is locked for a few minutes.

Phone lost or password forgotten: delete data/auth.json, restart the container and set it up again. The new code is in the log again.

6. Check

  1. Open the admin. If people and users appear, key and network are fine.
  2. Create a smart album with one person, sync “Exact”, not shared.
  3. Compare the number of photos with an Immich search for the same person.

Continue with First steps.

Update

Copy the new contents of app/ over the old ones and restart the container. The data in data/ stays. If the Compose file changes, recreate the stack.

The version is shown in the app at the bottom left of the menu, the changes under About.

Settings

The most important variables:

Variable Default Meaning
IMMICH_API_KEY – API key, required
IMMICH_URL http://immich_server:2283 Immich in the Docker network
IMMICH_PUBLIC_URL same as IMMICH_URL public address of Immich, for links from the admin
SHARE_URL same as IMMICH_PUBLIC_URL base of the links your recipients get
OVERVIEW_URL same as SHARE_URL address of the overviews
GALLERY_URL – address of the gallery, shown in the admin only
SYNC_INTERVAL_MIN 30 interval of the automatic sync in minutes
DATA_DIR /data where the data is stored
PORT, LINK_PORT, GALLERY_PORT 8080, 8081, 8082 ports inside the container
TAGS_ENABLED, SMART_TAGS_ENABLED on tags and smart tags, off turns them off
SOURCES_ENABLED on “Source” filter by library, off turns it off
SOURCE_PATHS empty fallback if the key may not read the libraries: Name=/path;Name2=/path2
TRIGGER_URL, TRIGGER_API_KEY empty connect the Album Creator; empty = no button
LOGIN_NAME empty display name in the profile menu
TRUSTED_PROXIES empty reverse proxies whose client address is trusted (comma-separated)
SMTP_HOST, SMTP_PORT, SMTP_SECURITY, SMTP_FROM, SMTP_USER, SMTP_PASSWORD empty sending email; without SMTP_HOST and SMTP_FROM, nothing is sent
UMAMI_URL, UMAMI_WEBSITE_ID, UMAMI_LINKS_ID, UMAMI_PUBLIC_ID empty statistics with Umami for admin, overviews and gallery; empty = no counting

Troubleshooting

Message Cause and fix
HTTP 401 API key missing or wrong. Check the variable.
HTTP 403 The key lacks a permission, see the table above.
“Album was deleted in Immich” Album deleted by hand. In the smart album, “Recreate album”, or delete the smart album.
“Person no longer in Immich” Person deleted or merged. Edit the smart album.
Tag disappears right away Immich can't write the .xmp, see step 4.
immich_server … Name or service not known The container is not in Immich's Docker network.
Code from the authenticator app is rejected Clock on phone or server is wrong, ±30 seconds count. Each code works only once.
“Too many failed attempts” Wait a few minutes or restart the container.