immich-rest-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- immich_rest_cli-0.1.0/PKG-INFO +281 -0
- immich_rest_cli-0.1.0/README.md +253 -0
- immich_rest_cli-0.1.0/pyproject.toml +45 -0
- immich_rest_cli-0.1.0/src/immich_rest_cli/__init__.py +1 -0
- immich_rest_cli-0.1.0/src/immich_rest_cli/cli.py +20 -0
- immich_rest_cli-0.1.0/src/immich_rest_cli/spec.yaml +26369 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: immich-rest-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A full-coverage CLI for the Immich REST API, generated from the official OpenAPI spec
|
|
5
|
+
Project-URL: Homepage, https://github.com/shivaam/openapi-cli-gen
|
|
6
|
+
Project-URL: Source, https://github.com/shivaam/openapi-cli-gen/tree/main/wrappers/immich-rest-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/shivaam/openapi-cli-gen/issues
|
|
8
|
+
Project-URL: Generator, https://github.com/shivaam/openapi-cli-gen
|
|
9
|
+
Author: Shivam Rastogi
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: api,cli,generated,openapi,rest
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: openapi-cli-gen>=0.0.14
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# immich-rest-cli
|
|
30
|
+
|
|
31
|
+
**A full-coverage CLI for the [Immich](https://immich.app) REST API.** Every endpoint in Immich's OpenAPI spec — ~250 subcommands across 35+ groups — exposed as a typed shell command. Generated from [Immich's official OpenAPI spec](https://github.com/immich-app/immich/tree/main/open-api) using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
32
|
+
|
|
33
|
+
## Why
|
|
34
|
+
|
|
35
|
+
Immich ships an [official CLI](https://github.com/immich-app/CLI) focused on **bulk photo uploading from a directory**. It's the right tool for the classic "initial import from my hard drive" workflow and this CLI is **not trying to replace it**.
|
|
36
|
+
|
|
37
|
+
This CLI is for everything else the official CLI doesn't cover — scripting against albums, libraries, users, search, tags, memories, sync, admin, workflows, server config, and yes, individual asset uploads too. If you've ever wanted to:
|
|
38
|
+
|
|
39
|
+
- Write a shell script that creates an album, adds specific assets to it, then shares it with a list of users
|
|
40
|
+
- Dump all your library metadata to JSON for an external tool
|
|
41
|
+
- Bulk-tag assets from a CSV via a loop
|
|
42
|
+
- Automate admin tasks (create users, set quotas, rotate API keys) in Ansible
|
|
43
|
+
- Query asset metadata / EXIF from CI pipelines
|
|
44
|
+
- Build a digital photo frame script that fetches a rotating "favorites" album
|
|
45
|
+
- Sync Immich state into / out of another system
|
|
46
|
+
|
|
47
|
+
…this gives you the full REST surface as shell commands instead of making you write Python against the OpenAPI client every time.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pipx install immich-rest-cli
|
|
53
|
+
|
|
54
|
+
# Or with uv
|
|
55
|
+
uv tool install immich-rest-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Setup
|
|
59
|
+
|
|
60
|
+
Point it at your Immich instance:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
export IMMICH_REST_CLI_BASE_URL=http://your-immich-host:2283/api
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Authentication
|
|
67
|
+
|
|
68
|
+
Immich supports multiple auth modes. This CLI uses **Bearer tokens**:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
export IMMICH_REST_CLI_TOKEN=your-access-token
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
You can get a token two ways:
|
|
75
|
+
|
|
76
|
+
1. **Log in via this CLI and copy the `accessToken` from the response:**
|
|
77
|
+
```bash
|
|
78
|
+
immich-rest-cli Authentication login --email you@example.com --password ...
|
|
79
|
+
# copy the accessToken from the JSON response
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
2. **Create a long-lived API key from the Immich web UI** (Account Settings → API Keys) and use that value.
|
|
83
|
+
|
|
84
|
+
## Quick Start
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Server health
|
|
88
|
+
immich-rest-cli Server ping
|
|
89
|
+
immich-rest-cli Server get-version
|
|
90
|
+
immich-rest-cli Server get-about-info
|
|
91
|
+
|
|
92
|
+
# Who am I
|
|
93
|
+
immich-rest-cli Users get-my
|
|
94
|
+
|
|
95
|
+
# List albums
|
|
96
|
+
immich-rest-cli Albums get-all
|
|
97
|
+
|
|
98
|
+
# Create an album
|
|
99
|
+
immich-rest-cli Albums create --album-name "Holiday 2025"
|
|
100
|
+
|
|
101
|
+
# Add assets to an album
|
|
102
|
+
immich-rest-cli Albums add-assets-to-album \
|
|
103
|
+
--id <album-id> \
|
|
104
|
+
--ids '["<asset-id-1>", "<asset-id-2>"]'
|
|
105
|
+
|
|
106
|
+
# Search
|
|
107
|
+
immich-rest-cli Search assets --query "sunset"
|
|
108
|
+
immich-rest-cli Search smart --query "dog on a beach"
|
|
109
|
+
|
|
110
|
+
# Upload a photo (multipart — every field from the spec)
|
|
111
|
+
immich-rest-cli Assets upload \
|
|
112
|
+
--asset-data ~/Pictures/photo.jpg \
|
|
113
|
+
--device-asset-id "unique-id-1" \
|
|
114
|
+
--device-id "my-script" \
|
|
115
|
+
--file-created-at 2026-04-10T00:00:00.000Z \
|
|
116
|
+
--file-modified-at 2026-04-10T00:00:00.000Z \
|
|
117
|
+
--filename photo.jpg
|
|
118
|
+
|
|
119
|
+
# Get asset info back
|
|
120
|
+
immich-rest-cli Assets get-info --id <asset-id>
|
|
121
|
+
|
|
122
|
+
# List assets by device
|
|
123
|
+
immich-rest-cli Assets get-all-user-by-device-id --device-id my-script
|
|
124
|
+
|
|
125
|
+
# Admin: list users
|
|
126
|
+
immich-rest-cli "Users (admin)" search-users-admin
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Discover All Commands
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Top-level command groups (35+)
|
|
133
|
+
immich-rest-cli --help
|
|
134
|
+
|
|
135
|
+
# Commands in a group
|
|
136
|
+
immich-rest-cli Albums --help
|
|
137
|
+
|
|
138
|
+
# Flags for a specific command
|
|
139
|
+
immich-rest-cli Assets upload --help
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Output Formats
|
|
143
|
+
|
|
144
|
+
Every command accepts `--output-format`:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
immich-rest-cli Albums get-all --output-format json # default
|
|
148
|
+
immich-rest-cli Albums get-all --output-format table # rich table
|
|
149
|
+
immich-rest-cli Albums get-all --output-format yaml
|
|
150
|
+
immich-rest-cli Albums get-all --output-format raw
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Command Groups
|
|
154
|
+
|
|
155
|
+
Full Immich REST surface. A partial list:
|
|
156
|
+
|
|
157
|
+
| Group | What it covers |
|
|
158
|
+
|---|---|
|
|
159
|
+
| `Authentication` | Login, logout, sign-up, OAuth, session locks, PIN codes |
|
|
160
|
+
| `Assets` | Upload, download, delete, search, bulk metadata, edits, stacks |
|
|
161
|
+
| `Albums` | Full CRUD + add/remove assets + share with users |
|
|
162
|
+
| `Search` | Metadata search, smart (semantic) search, explore, suggestions |
|
|
163
|
+
| `Libraries` | External library create/scan/validate |
|
|
164
|
+
| `Tags` | Tag CRUD + bulk tag/untag assets |
|
|
165
|
+
| `Memories` | Memory CRUD + asset add/remove |
|
|
166
|
+
| `People` | Face recognition, merge, reassign, person CRUD |
|
|
167
|
+
| `Faces` | Face CRUD + reassignment |
|
|
168
|
+
| `Partners` | Partner shares |
|
|
169
|
+
| `Shared links` | Public share link management |
|
|
170
|
+
| `Stacks` | Asset stacks (burst photos, raw+jpeg pairs) |
|
|
171
|
+
| `Timeline` | Time bucket queries for the timeline view |
|
|
172
|
+
| `Sync` | Bidirectional sync for mobile / desktop clients |
|
|
173
|
+
| `Trash` | Soft-delete management |
|
|
174
|
+
| `Notifications` | User + admin notifications |
|
|
175
|
+
| `System config` | Server config — read, update, defaults, storage templates |
|
|
176
|
+
| `System metadata` | Admin onboarding, version check state, reverse geocoding |
|
|
177
|
+
| `Jobs` / `Queues` | Background job management |
|
|
178
|
+
| `Maintenance (admin)` | Maintenance mode, prior install detection |
|
|
179
|
+
| `Users` / `Users (admin)` | User CRUD, preferences, profile images, sessions, licenses |
|
|
180
|
+
| `Database Backups (admin)` | List, download, upload, restore backups |
|
|
181
|
+
| `API keys` | User + admin API key management |
|
|
182
|
+
| `Server` | Version, features, statistics, storage, licensing, theme, APK links |
|
|
183
|
+
| `Views` | Original-path asset browsing |
|
|
184
|
+
| `Workflows` | Automation workflows |
|
|
185
|
+
| `Download` | Archive download for assets |
|
|
186
|
+
| `Map` | Map markers + reverse geocode |
|
|
187
|
+
| `Activities` | Comments / likes on shared assets |
|
|
188
|
+
| `Plugins` | Plugin discovery + triggers |
|
|
189
|
+
| `Sessions` | User session management |
|
|
190
|
+
| `Duplicates` | Duplicate detection and resolution |
|
|
191
|
+
|
|
192
|
+
…and more. Run `immich-rest-cli --help` for the complete list.
|
|
193
|
+
|
|
194
|
+
## Real Example: Upload an Asset End-to-End
|
|
195
|
+
|
|
196
|
+
This is the exact flow verified against a live Immich v2 instance:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Sign up (first user becomes admin)
|
|
200
|
+
$ immich-rest-cli Authentication sign-up-admin \
|
|
201
|
+
--email admin@example.com \
|
|
202
|
+
--password 'SecurePass123!' \
|
|
203
|
+
--name Admin
|
|
204
|
+
{"id": "2a504424-...", "email": "admin@example.com", "isAdmin": true, ...}
|
|
205
|
+
|
|
206
|
+
# Log in to get a token
|
|
207
|
+
$ immich-rest-cli Authentication login \
|
|
208
|
+
--email admin@example.com \
|
|
209
|
+
--password 'SecurePass123!'
|
|
210
|
+
{"accessToken": "OXiyVeZZ7QO...", "userId": "2a504424-...", ...}
|
|
211
|
+
|
|
212
|
+
# Export the token
|
|
213
|
+
$ export IMMICH_REST_CLI_TOKEN=OXiyVeZZ7QO...
|
|
214
|
+
|
|
215
|
+
# Upload a photo
|
|
216
|
+
$ immich-rest-cli Assets upload \
|
|
217
|
+
--asset-data /tmp/photo.jpg \
|
|
218
|
+
--device-asset-id "my-device-001" \
|
|
219
|
+
--device-id "script" \
|
|
220
|
+
--file-created-at 2026-04-10T00:00:00.000Z \
|
|
221
|
+
--file-modified-at 2026-04-10T00:00:00.000Z \
|
|
222
|
+
--filename photo.jpg
|
|
223
|
+
{"id": "1447e90c-65bc-4574-8be5-cd6bb94afcaf", "status": "created"}
|
|
224
|
+
|
|
225
|
+
# Read it back
|
|
226
|
+
$ immich-rest-cli Assets get-info --id 1447e90c-65bc-4574-8be5-cd6bb94afcaf
|
|
227
|
+
{
|
|
228
|
+
"id": "1447e90c-...",
|
|
229
|
+
"type": "IMAGE",
|
|
230
|
+
"originalFileName": "photo.jpg",
|
|
231
|
+
"fileCreatedAt": "2026-04-10T00:00:00.000Z",
|
|
232
|
+
"exifInfo": {
|
|
233
|
+
"fileSizeInByte": 2132,
|
|
234
|
+
"mimeType": "image/jpeg"
|
|
235
|
+
},
|
|
236
|
+
...
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Passing Complex JSON Bodies
|
|
241
|
+
|
|
242
|
+
Some endpoints take deeply nested request bodies (`bulk-assets`, `update-metadata`, etc.). For these, you can pass a JSON string to the `--root` flag instead of typed flags:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
immich-rest-cli Albums add-assets-to-album \
|
|
246
|
+
--id <album-id> \
|
|
247
|
+
--root '{"ids": ["asset-1", "asset-2", "asset-3"]}'
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Simple endpoints (like `Albums create`, `Assets upload`) take typed flags directly.
|
|
251
|
+
|
|
252
|
+
## How It Works
|
|
253
|
+
|
|
254
|
+
This package is a thin wrapper:
|
|
255
|
+
- Embeds the Immich OpenAPI spec (`spec.yaml`)
|
|
256
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
257
|
+
- Handles multipart/form-data upload with native httpx multipart support
|
|
258
|
+
|
|
259
|
+
Since it's spec-driven, new Immich endpoints show up automatically on regeneration — no manual wrapping to fall behind.
|
|
260
|
+
|
|
261
|
+
## Relationship to the Official Immich CLI
|
|
262
|
+
|
|
263
|
+
| | Official [@immich/cli](https://github.com/immich-app/CLI) | immich-rest-cli |
|
|
264
|
+
|---|---|---|
|
|
265
|
+
| Language | TypeScript/Node.js | Python |
|
|
266
|
+
| Primary use | Bulk photo import from a folder | Any REST endpoint as a shell command |
|
|
267
|
+
| Endpoint coverage | Upload-focused | Every endpoint in the spec (~250) |
|
|
268
|
+
| Maintained by | Immich team (official) | Community (unofficial) |
|
|
269
|
+
|
|
270
|
+
**If you just want to bulk-upload a folder of photos:** use the official CLI. It handles concurrency, deduplication, resume, and is first-party.
|
|
271
|
+
|
|
272
|
+
**If you want to script against the rest of the API:** use this. They're complementary, not competing.
|
|
273
|
+
|
|
274
|
+
## Limitations
|
|
275
|
+
|
|
276
|
+
- **Authenticated session cookies**: use Bearer tokens or long-lived API keys instead. The cookie-based flow (browser sessions) is not wired into the CLI.
|
|
277
|
+
- **Server-sent events / streaming endpoints**: not supported. A handful of endpoints stream progress; for those, use the Immich SDK or raw httpx.
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
MIT. Not affiliated with Immich — this is an unofficial community CLI built on top of their public OpenAPI spec.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# immich-rest-cli
|
|
2
|
+
|
|
3
|
+
**A full-coverage CLI for the [Immich](https://immich.app) REST API.** Every endpoint in Immich's OpenAPI spec — ~250 subcommands across 35+ groups — exposed as a typed shell command. Generated from [Immich's official OpenAPI spec](https://github.com/immich-app/immich/tree/main/open-api) using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Immich ships an [official CLI](https://github.com/immich-app/CLI) focused on **bulk photo uploading from a directory**. It's the right tool for the classic "initial import from my hard drive" workflow and this CLI is **not trying to replace it**.
|
|
8
|
+
|
|
9
|
+
This CLI is for everything else the official CLI doesn't cover — scripting against albums, libraries, users, search, tags, memories, sync, admin, workflows, server config, and yes, individual asset uploads too. If you've ever wanted to:
|
|
10
|
+
|
|
11
|
+
- Write a shell script that creates an album, adds specific assets to it, then shares it with a list of users
|
|
12
|
+
- Dump all your library metadata to JSON for an external tool
|
|
13
|
+
- Bulk-tag assets from a CSV via a loop
|
|
14
|
+
- Automate admin tasks (create users, set quotas, rotate API keys) in Ansible
|
|
15
|
+
- Query asset metadata / EXIF from CI pipelines
|
|
16
|
+
- Build a digital photo frame script that fetches a rotating "favorites" album
|
|
17
|
+
- Sync Immich state into / out of another system
|
|
18
|
+
|
|
19
|
+
…this gives you the full REST surface as shell commands instead of making you write Python against the OpenAPI client every time.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pipx install immich-rest-cli
|
|
25
|
+
|
|
26
|
+
# Or with uv
|
|
27
|
+
uv tool install immich-rest-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Setup
|
|
31
|
+
|
|
32
|
+
Point it at your Immich instance:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export IMMICH_REST_CLI_BASE_URL=http://your-immich-host:2283/api
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Authentication
|
|
39
|
+
|
|
40
|
+
Immich supports multiple auth modes. This CLI uses **Bearer tokens**:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export IMMICH_REST_CLI_TOKEN=your-access-token
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can get a token two ways:
|
|
47
|
+
|
|
48
|
+
1. **Log in via this CLI and copy the `accessToken` from the response:**
|
|
49
|
+
```bash
|
|
50
|
+
immich-rest-cli Authentication login --email you@example.com --password ...
|
|
51
|
+
# copy the accessToken from the JSON response
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. **Create a long-lived API key from the Immich web UI** (Account Settings → API Keys) and use that value.
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Server health
|
|
60
|
+
immich-rest-cli Server ping
|
|
61
|
+
immich-rest-cli Server get-version
|
|
62
|
+
immich-rest-cli Server get-about-info
|
|
63
|
+
|
|
64
|
+
# Who am I
|
|
65
|
+
immich-rest-cli Users get-my
|
|
66
|
+
|
|
67
|
+
# List albums
|
|
68
|
+
immich-rest-cli Albums get-all
|
|
69
|
+
|
|
70
|
+
# Create an album
|
|
71
|
+
immich-rest-cli Albums create --album-name "Holiday 2025"
|
|
72
|
+
|
|
73
|
+
# Add assets to an album
|
|
74
|
+
immich-rest-cli Albums add-assets-to-album \
|
|
75
|
+
--id <album-id> \
|
|
76
|
+
--ids '["<asset-id-1>", "<asset-id-2>"]'
|
|
77
|
+
|
|
78
|
+
# Search
|
|
79
|
+
immich-rest-cli Search assets --query "sunset"
|
|
80
|
+
immich-rest-cli Search smart --query "dog on a beach"
|
|
81
|
+
|
|
82
|
+
# Upload a photo (multipart — every field from the spec)
|
|
83
|
+
immich-rest-cli Assets upload \
|
|
84
|
+
--asset-data ~/Pictures/photo.jpg \
|
|
85
|
+
--device-asset-id "unique-id-1" \
|
|
86
|
+
--device-id "my-script" \
|
|
87
|
+
--file-created-at 2026-04-10T00:00:00.000Z \
|
|
88
|
+
--file-modified-at 2026-04-10T00:00:00.000Z \
|
|
89
|
+
--filename photo.jpg
|
|
90
|
+
|
|
91
|
+
# Get asset info back
|
|
92
|
+
immich-rest-cli Assets get-info --id <asset-id>
|
|
93
|
+
|
|
94
|
+
# List assets by device
|
|
95
|
+
immich-rest-cli Assets get-all-user-by-device-id --device-id my-script
|
|
96
|
+
|
|
97
|
+
# Admin: list users
|
|
98
|
+
immich-rest-cli "Users (admin)" search-users-admin
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Discover All Commands
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Top-level command groups (35+)
|
|
105
|
+
immich-rest-cli --help
|
|
106
|
+
|
|
107
|
+
# Commands in a group
|
|
108
|
+
immich-rest-cli Albums --help
|
|
109
|
+
|
|
110
|
+
# Flags for a specific command
|
|
111
|
+
immich-rest-cli Assets upload --help
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Output Formats
|
|
115
|
+
|
|
116
|
+
Every command accepts `--output-format`:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
immich-rest-cli Albums get-all --output-format json # default
|
|
120
|
+
immich-rest-cli Albums get-all --output-format table # rich table
|
|
121
|
+
immich-rest-cli Albums get-all --output-format yaml
|
|
122
|
+
immich-rest-cli Albums get-all --output-format raw
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Command Groups
|
|
126
|
+
|
|
127
|
+
Full Immich REST surface. A partial list:
|
|
128
|
+
|
|
129
|
+
| Group | What it covers |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `Authentication` | Login, logout, sign-up, OAuth, session locks, PIN codes |
|
|
132
|
+
| `Assets` | Upload, download, delete, search, bulk metadata, edits, stacks |
|
|
133
|
+
| `Albums` | Full CRUD + add/remove assets + share with users |
|
|
134
|
+
| `Search` | Metadata search, smart (semantic) search, explore, suggestions |
|
|
135
|
+
| `Libraries` | External library create/scan/validate |
|
|
136
|
+
| `Tags` | Tag CRUD + bulk tag/untag assets |
|
|
137
|
+
| `Memories` | Memory CRUD + asset add/remove |
|
|
138
|
+
| `People` | Face recognition, merge, reassign, person CRUD |
|
|
139
|
+
| `Faces` | Face CRUD + reassignment |
|
|
140
|
+
| `Partners` | Partner shares |
|
|
141
|
+
| `Shared links` | Public share link management |
|
|
142
|
+
| `Stacks` | Asset stacks (burst photos, raw+jpeg pairs) |
|
|
143
|
+
| `Timeline` | Time bucket queries for the timeline view |
|
|
144
|
+
| `Sync` | Bidirectional sync for mobile / desktop clients |
|
|
145
|
+
| `Trash` | Soft-delete management |
|
|
146
|
+
| `Notifications` | User + admin notifications |
|
|
147
|
+
| `System config` | Server config — read, update, defaults, storage templates |
|
|
148
|
+
| `System metadata` | Admin onboarding, version check state, reverse geocoding |
|
|
149
|
+
| `Jobs` / `Queues` | Background job management |
|
|
150
|
+
| `Maintenance (admin)` | Maintenance mode, prior install detection |
|
|
151
|
+
| `Users` / `Users (admin)` | User CRUD, preferences, profile images, sessions, licenses |
|
|
152
|
+
| `Database Backups (admin)` | List, download, upload, restore backups |
|
|
153
|
+
| `API keys` | User + admin API key management |
|
|
154
|
+
| `Server` | Version, features, statistics, storage, licensing, theme, APK links |
|
|
155
|
+
| `Views` | Original-path asset browsing |
|
|
156
|
+
| `Workflows` | Automation workflows |
|
|
157
|
+
| `Download` | Archive download for assets |
|
|
158
|
+
| `Map` | Map markers + reverse geocode |
|
|
159
|
+
| `Activities` | Comments / likes on shared assets |
|
|
160
|
+
| `Plugins` | Plugin discovery + triggers |
|
|
161
|
+
| `Sessions` | User session management |
|
|
162
|
+
| `Duplicates` | Duplicate detection and resolution |
|
|
163
|
+
|
|
164
|
+
…and more. Run `immich-rest-cli --help` for the complete list.
|
|
165
|
+
|
|
166
|
+
## Real Example: Upload an Asset End-to-End
|
|
167
|
+
|
|
168
|
+
This is the exact flow verified against a live Immich v2 instance:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Sign up (first user becomes admin)
|
|
172
|
+
$ immich-rest-cli Authentication sign-up-admin \
|
|
173
|
+
--email admin@example.com \
|
|
174
|
+
--password 'SecurePass123!' \
|
|
175
|
+
--name Admin
|
|
176
|
+
{"id": "2a504424-...", "email": "admin@example.com", "isAdmin": true, ...}
|
|
177
|
+
|
|
178
|
+
# Log in to get a token
|
|
179
|
+
$ immich-rest-cli Authentication login \
|
|
180
|
+
--email admin@example.com \
|
|
181
|
+
--password 'SecurePass123!'
|
|
182
|
+
{"accessToken": "OXiyVeZZ7QO...", "userId": "2a504424-...", ...}
|
|
183
|
+
|
|
184
|
+
# Export the token
|
|
185
|
+
$ export IMMICH_REST_CLI_TOKEN=OXiyVeZZ7QO...
|
|
186
|
+
|
|
187
|
+
# Upload a photo
|
|
188
|
+
$ immich-rest-cli Assets upload \
|
|
189
|
+
--asset-data /tmp/photo.jpg \
|
|
190
|
+
--device-asset-id "my-device-001" \
|
|
191
|
+
--device-id "script" \
|
|
192
|
+
--file-created-at 2026-04-10T00:00:00.000Z \
|
|
193
|
+
--file-modified-at 2026-04-10T00:00:00.000Z \
|
|
194
|
+
--filename photo.jpg
|
|
195
|
+
{"id": "1447e90c-65bc-4574-8be5-cd6bb94afcaf", "status": "created"}
|
|
196
|
+
|
|
197
|
+
# Read it back
|
|
198
|
+
$ immich-rest-cli Assets get-info --id 1447e90c-65bc-4574-8be5-cd6bb94afcaf
|
|
199
|
+
{
|
|
200
|
+
"id": "1447e90c-...",
|
|
201
|
+
"type": "IMAGE",
|
|
202
|
+
"originalFileName": "photo.jpg",
|
|
203
|
+
"fileCreatedAt": "2026-04-10T00:00:00.000Z",
|
|
204
|
+
"exifInfo": {
|
|
205
|
+
"fileSizeInByte": 2132,
|
|
206
|
+
"mimeType": "image/jpeg"
|
|
207
|
+
},
|
|
208
|
+
...
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Passing Complex JSON Bodies
|
|
213
|
+
|
|
214
|
+
Some endpoints take deeply nested request bodies (`bulk-assets`, `update-metadata`, etc.). For these, you can pass a JSON string to the `--root` flag instead of typed flags:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
immich-rest-cli Albums add-assets-to-album \
|
|
218
|
+
--id <album-id> \
|
|
219
|
+
--root '{"ids": ["asset-1", "asset-2", "asset-3"]}'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Simple endpoints (like `Albums create`, `Assets upload`) take typed flags directly.
|
|
223
|
+
|
|
224
|
+
## How It Works
|
|
225
|
+
|
|
226
|
+
This package is a thin wrapper:
|
|
227
|
+
- Embeds the Immich OpenAPI spec (`spec.yaml`)
|
|
228
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
229
|
+
- Handles multipart/form-data upload with native httpx multipart support
|
|
230
|
+
|
|
231
|
+
Since it's spec-driven, new Immich endpoints show up automatically on regeneration — no manual wrapping to fall behind.
|
|
232
|
+
|
|
233
|
+
## Relationship to the Official Immich CLI
|
|
234
|
+
|
|
235
|
+
| | Official [@immich/cli](https://github.com/immich-app/CLI) | immich-rest-cli |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| Language | TypeScript/Node.js | Python |
|
|
238
|
+
| Primary use | Bulk photo import from a folder | Any REST endpoint as a shell command |
|
|
239
|
+
| Endpoint coverage | Upload-focused | Every endpoint in the spec (~250) |
|
|
240
|
+
| Maintained by | Immich team (official) | Community (unofficial) |
|
|
241
|
+
|
|
242
|
+
**If you just want to bulk-upload a folder of photos:** use the official CLI. It handles concurrency, deduplication, resume, and is first-party.
|
|
243
|
+
|
|
244
|
+
**If you want to script against the rest of the API:** use this. They're complementary, not competing.
|
|
245
|
+
|
|
246
|
+
## Limitations
|
|
247
|
+
|
|
248
|
+
- **Authenticated session cookies**: use Bearer tokens or long-lived API keys instead. The cookie-based flow (browser sessions) is not wired into the CLI.
|
|
249
|
+
- **Server-sent events / streaming endpoints**: not supported. A handful of endpoints stream progress; for those, use the Immich SDK or raw httpx.
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
MIT. Not affiliated with Immich — this is an unofficial community CLI built on top of their public OpenAPI spec.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "immich-rest-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A full-coverage CLI for the Immich REST API, generated from the official OpenAPI spec"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Shivam Rastogi" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["cli", "openapi", "rest", "api", "generated"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Software Development",
|
|
29
|
+
"Topic :: Utilities",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"openapi-cli-gen>=0.0.14",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/shivaam/openapi-cli-gen"
|
|
37
|
+
Source = "https://github.com/shivaam/openapi-cli-gen/tree/main/wrappers/immich-rest-cli"
|
|
38
|
+
Issues = "https://github.com/shivaam/openapi-cli-gen/issues"
|
|
39
|
+
Generator = "https://github.com/shivaam/openapi-cli-gen"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
immich-rest-cli = "immich_rest_cli.cli:main"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/immich_rest_cli"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""immich-rest-cli CLI — generated by openapi-cli-gen."""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from openapi_cli_gen import build_cli
|
|
4
|
+
|
|
5
|
+
# Base URL: override via IMMICH_REST_CLI_BASE_URL env var, fall back to spec default
|
|
6
|
+
_base_url = os.environ.get("IMMICH_REST_CLI_BASE_URL") or "http://localhost:2283/api"
|
|
7
|
+
|
|
8
|
+
app = build_cli(
|
|
9
|
+
spec=Path(__file__).parent / "spec.yaml",
|
|
10
|
+
name="immich-rest-cli",
|
|
11
|
+
base_url=_base_url,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
app()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
main()
|