@bitefoundry/outlook 0.2.0 → 0.3.1
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.
- package/LICENSE +21 -21
- package/README.md +185 -165
- package/docs/API.md +394 -365
- package/docs/MCP.md +164 -147
- package/docs/NPM.md +269 -236
- package/docs/openapi.yaml +739 -705
- package/package.json +49 -49
package/docs/API.md
CHANGED
|
@@ -1,365 +1,394 @@
|
|
|
1
|
-
# `outlook` HTTP JSON API
|
|
2
|
-
|
|
3
|
-
Local HTTP/JSON server for AI agents, scripts, and integrations. Exposed by `outlook serve` (alias `api`), backed by Microsoft Graph v1.0, local SQLite WAL/FTS5 caching, and the background sync engine (`sync::spawn_sync_engine`).
|
|
4
|
-
|
|
5
|
-
## Starting the server
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
outlook serve # http://127.0.0.1:3939
|
|
9
|
-
outlook serve --port 9000 # custom port
|
|
10
|
-
outlook serve --bind 127.0.0.1 --port 3939
|
|
11
|
-
outlook serve --api-key secret123 # require Bearer secret123 or x-api-key: secret123
|
|
12
|
-
outlook serve --token secret123 # --token is an alias for --api-key
|
|
13
|
-
outlook
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `--
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
#### `
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
curl -X
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
1
|
+
# `outlook` HTTP JSON API
|
|
2
|
+
|
|
3
|
+
Local HTTP/JSON server for AI agents, scripts, and integrations. Exposed by `outlook serve` (alias `api`), backed by Microsoft Graph v1.0, local SQLite WAL/FTS5 caching, and the background sync engine (`sync::spawn_sync_engine`).
|
|
4
|
+
|
|
5
|
+
## Starting the server
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
outlook serve # http://127.0.0.1:3939, prints a generated Bearer token to stderr
|
|
9
|
+
outlook serve --port 9000 # custom port
|
|
10
|
+
outlook serve --bind 127.0.0.1 --port 3939
|
|
11
|
+
outlook serve --api-key secret123 # require Bearer secret123 or x-api-key: secret123
|
|
12
|
+
outlook serve --token secret123 # --token is an alias for --api-key
|
|
13
|
+
outlook serve --allow-keyless # loopback only, no authentication
|
|
14
|
+
outlook serve --cors-origin http://localhost:5173 # let one browser app call the API
|
|
15
|
+
outlook api # alias for `serve`
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- `--bind` defaults to `127.0.0.1` (loopback only). Binding to a non-loopback address (e.g. `0.0.0.0`) requires `--api-key <KEY>` (or `--token <KEY>`) unless `OUTLOOK_ALLOW_INSECURE_SERVE=1` is explicitly set.
|
|
19
|
+
- `--port` defaults to `3939`.
|
|
20
|
+
- `--api-key` (alias `--token`) sets the key. Every endpoint except `GET /health` requires either `Authorization: Bearer <key>` or `x-api-key: <key>`.
|
|
21
|
+
- Without `--api-key`, a loopback server generates a random 32-byte token (64 hex characters) for that run and prints it once to stderr. It is not written to disk, and a new one is generated on every start; pass `--api-key` when clients need a stable key.
|
|
22
|
+
- `--allow-keyless` turns authentication off for a loopback server instead of generating a token. It cannot be combined with `--api-key`.
|
|
23
|
+
- `--cors-origin <ORIGIN>` (repeatable) allows one browser origin, written as `scheme://host[:port]`. No origin is allowed by default.
|
|
24
|
+
- Requires an existing login (`outlook login`), `OUTLOOK_ACCESS_TOKEN`, `OUTLOOK_TOKEN_FILE`, or a shared M365 session (`teams-cli` / `TEAMS_TOKEN_FILE` when `OUTLOOK_SHARE_M365_AUTH=true`).
|
|
25
|
+
- On startup, `outlook serve` spawns the background sync engine so the local SQLite cache stays warm while serving requests.
|
|
26
|
+
|
|
27
|
+
## Conventions
|
|
28
|
+
|
|
29
|
+
- All responses are JSON (`Content-Type: application/json`).
|
|
30
|
+
- Errors use `{"error": "<message>"}` with HTTP `400`, `401`, `403`, `404`, or `500`.
|
|
31
|
+
- `limit` is clamped to `1..=1000`.
|
|
32
|
+
- Mail folder parameters accept a folder ID, display name/prefix, or well-known alias (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`).
|
|
33
|
+
- To Do list parameters default to `"tasks"` and accept a list ID, display name, or `"default"` / `"tasks"` / `"defaultList"`.
|
|
34
|
+
- The `curl` examples below leave out the key. Add `-H "Authorization: Bearer <key>"`, or start the server with `--allow-keyless`.
|
|
35
|
+
|
|
36
|
+
## Security
|
|
37
|
+
|
|
38
|
+
The API can read and send mail as the signed-in user, so it refuses callers it cannot place:
|
|
39
|
+
|
|
40
|
+
- **Authentication** is on by default (see `--api-key` and the generated token above). `GET /health` stays public.
|
|
41
|
+
- **Browser origins**: a request with an `Origin` header is answered only when that origin was passed with `--cors-origin`, compared exactly. Every other origin gets `403`, preflight included, with or without a valid key. This applies to pages served from `localhost` too. Clients that send no `Origin` header (curl, scripts, agents) are unaffected.
|
|
42
|
+
- **`Host` header** (keyless servers only): the request must be addressed to `localhost`, a loopback address (`127.0.0.1`, `[::1]`), or a name listed in `OUTLOOK_SERVE_ALLOWED_HOSTS` (comma-separated). Any other host gets `403`, `/health` included. This stops a web page that points its own domain at `127.0.0.1` (DNS rebinding) from reaching the API. A server with a key skips this check, so a reverse proxy can forward its own host name.
|
|
43
|
+
- **Non-loopback binds** need `--api-key`. `OUTLOOK_ALLOW_INSECURE_SERVE=1` overrides that and serves without authentication; the bind address is then accepted as a `Host`, and `0.0.0.0` needs `OUTLOOK_SERVE_ALLOWED_HOSTS` for any non-loopback name.
|
|
44
|
+
|
|
45
|
+
## Endpoints
|
|
46
|
+
|
|
47
|
+
### System & Auth
|
|
48
|
+
|
|
49
|
+
#### `GET /health`
|
|
50
|
+
|
|
51
|
+
No key needed. The `Origin` and `Host` checks in [Security](#security) still apply.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
curl http://127.0.0.1:3939/health
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"ok": true,
|
|
60
|
+
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
61
|
+
"version": "0.1.5"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### `GET /openapi.json`
|
|
66
|
+
|
|
67
|
+
Returns the OpenAPI 3.1.0 specification JSON generated by the running server.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
curl http://127.0.0.1:3939/openapi.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### `GET /v1/whoami`
|
|
74
|
+
|
|
75
|
+
Returns the active user profile, auth mode/source (`outlook-cli` vs shared `teams-cli` session), token expiry, and JWT `scp` / `roles` diagnostics.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
curl http://127.0.0.1:3939/v1/whoami -H "Authorization: Bearer secret123"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"authenticated": true,
|
|
84
|
+
"user_id": "00000000-0000-0000-0000-000000000000",
|
|
85
|
+
"display_name": "Alice Kim",
|
|
86
|
+
"email": "alice@contoso.com",
|
|
87
|
+
"client_id": "14d82eec-204b-4c2f-b7e8-296a70dab67e",
|
|
88
|
+
"tenant_id": "common",
|
|
89
|
+
"auth_mode": "pkce",
|
|
90
|
+
"auth_source": "keyring",
|
|
91
|
+
"expires_at": 1795023600,
|
|
92
|
+
"expired": false,
|
|
93
|
+
"scopes": ["User.Read", "User.ReadBasic.All", "Mail.ReadWrite", "Mail.Send", "Calendars.ReadWrite", "Contacts.Read", "Tasks.ReadWrite"],
|
|
94
|
+
"roles": []
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Mail
|
|
99
|
+
|
|
100
|
+
#### `GET /v1/mail/folders?refresh=false&offline=false`
|
|
101
|
+
|
|
102
|
+
Lists Outlook mail folders with unread and total item counts.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
curl "http://127.0.0.1:3939/v1/mail/folders?refresh=true"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"folders": [
|
|
111
|
+
{
|
|
112
|
+
"id": "AAMkAGI2...",
|
|
113
|
+
"display_name": "Inbox",
|
|
114
|
+
"well_known_name": "inbox",
|
|
115
|
+
"parent_folder_id": null,
|
|
116
|
+
"child_folder_count": 0,
|
|
117
|
+
"unread_item_count": 4,
|
|
118
|
+
"total_item_count": 128
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### `GET /v1/mail/messages?folder=inbox&limit=30&unread=false&flagged=false&focused=false&refresh=false&offline=false`
|
|
125
|
+
|
|
126
|
+
Lists messages in a mail folder (`inbox`, `sent`, `drafts`, `archive`, `trash`, `junk`, folder name, or folder ID).
|
|
127
|
+
|
|
128
|
+
Live requests are bounded:
|
|
129
|
+
|
|
130
|
+
- With `unread`, `flagged` or `focused`, the scan reads at most 20 Graph pages. `has_more` is `true` or `false` when the scan could tell, and `null` when it stopped at the page cap (or the response came from the cache) and more matches may exist further back.
|
|
131
|
+
- Without a filter, the first sync of a folder reads at most 40 delta pages (about 2,000 messages) per request. A larger folder answers with the newest messages and `"sync_complete": false`; later requests and the background sync continue from where it stopped. The key is absent once the folder is fully synced.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
curl "http://127.0.0.1:3939/v1/mail/messages?folder=inbox&limit=20&unread=true"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"folder": { "id": "AAMkAGI2...", "display_name": "Inbox", "well_known_name": "inbox" },
|
|
140
|
+
"messages": [
|
|
141
|
+
{
|
|
142
|
+
"id": "AAMkAGI2...",
|
|
143
|
+
"conversation_id": "AAQkAGI2...",
|
|
144
|
+
"folder_id": "AAMkAGI2...",
|
|
145
|
+
"subject": "Quarterly Review",
|
|
146
|
+
"from": { "name": "Bob Smith", "address": "bob@contoso.com" },
|
|
147
|
+
"received_at": "2026-11-18T09:30:00Z",
|
|
148
|
+
"is_read": false,
|
|
149
|
+
"flagged": false,
|
|
150
|
+
"importance": "normal",
|
|
151
|
+
"inference_classification": "focused",
|
|
152
|
+
"has_attachments": true,
|
|
153
|
+
"body_loaded": false,
|
|
154
|
+
"preview": "Attached are the Q4 numbers..."
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"has_more": false
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### `GET /v1/mail/messages/{id}?offline=false`
|
|
162
|
+
|
|
163
|
+
Fetches full headers, HTML/plain body, and attachment metadata for a single message (and caches it in SQLite). Messages fetched with expanded attachments include `attachments[].content_bytes_b64`.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
curl "http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2..."
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `POST /v1/mail/send`
|
|
170
|
+
|
|
171
|
+
Composes and sends a new email (Markdown compiled to HTML) with optional `cc`, `bcc`, `importance` (`low` | `normal` | `high`), host file `attachments`, and `save_to_sent_items` (default `true`). `markdown` also accepts alias `body`.
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/send \
|
|
175
|
+
-H "Content-Type: application/json" \
|
|
176
|
+
-d '{"to":["bob@contoso.com"],"subject":"Release v0.1.0","markdown":"Build **passed**!","importance":"high"}'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"ok": true,
|
|
182
|
+
"to": ["bob@contoso.com"],
|
|
183
|
+
"subject": "Release v0.1.0"
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### `POST /v1/mail/messages/{id}/reply`
|
|
188
|
+
|
|
189
|
+
Replies (`reply_all: false`) or replies-all (`reply_all: true`) to an email message. `markdown` also accepts alias `body`.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../reply \
|
|
193
|
+
-H "Content-Type: application/json" \
|
|
194
|
+
-d '{"markdown":"Looks good, approved.","reply_all":true}'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### `POST /v1/mail/messages/{id}/forward`
|
|
198
|
+
|
|
199
|
+
Forwards an email message to one or more recipients (`to`) with an optional Markdown `markdown` (alias `comment`) preface.
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../forward \
|
|
203
|
+
-H "Content-Type: application/json" \
|
|
204
|
+
-d '{"to":["carol@contoso.com"],"markdown":"FYI — see thread below."}'
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### `PATCH /v1/mail/messages/{id}`
|
|
208
|
+
|
|
209
|
+
Updates read status (`is_read`), flag status (`flagged`), and/or moves the message to `destination_folder_id` (alias `destination_folder`, accepting folder name, alias such as `"archive"`, or folder ID). At least one field must be provided.
|
|
210
|
+
|
|
211
|
+
To edit an existing draft's subject or body, use `outlook edit-draft` or MCP `update_draft`. To edit an active composition, use the TUI.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
curl -X PATCH http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2... \
|
|
215
|
+
-H "Content-Type: application/json" \
|
|
216
|
+
-d '{"is_read":true,"flagged":false,"destination_folder_id":"archive"}'
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"ok": true,
|
|
222
|
+
"message_id": "AAMkAGI2...",
|
|
223
|
+
"is_read": true,
|
|
224
|
+
"flagged": false,
|
|
225
|
+
"moved": { "id": "AAMkAGI2...", "folder_id": "AAMkAGI2..." }
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `DELETE /v1/mail/messages/{id}`
|
|
230
|
+
|
|
231
|
+
Deletes a mail message and removes it from the local SQLite cache.
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
curl -X DELETE http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2...
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### `POST /v1/mail/messages/{id}/attachments/{att_id}/download`
|
|
238
|
+
|
|
239
|
+
Downloads an attachment to disk on the host running `outlook serve` (defaults to `download_dir`, usually `Downloads/outlook`). Optional body: `{"out_dir": "/path/to/dir"}` (alias `dir`).
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
curl -X POST http://127.0.0.1:3939/v1/mail/messages/AAMkAGI2.../attachments/ATT_ID/download \
|
|
243
|
+
-H "Content-Type: application/json" \
|
|
244
|
+
-d '{"out_dir":"./downloads"}'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```json
|
|
248
|
+
{
|
|
249
|
+
"ok": true,
|
|
250
|
+
"path": "./downloads/report.pdf",
|
|
251
|
+
"file_name": "report.pdf",
|
|
252
|
+
"bytes_written": 48120
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### `GET /v1/mail/search?q=...&folder=&remote=false&limit=30`
|
|
257
|
+
|
|
258
|
+
Searches local SQLite FTS5 + `LIKE` (`hits`) and, when `remote=true`, queries Microsoft Graph KQL `$search` (`remote`) while caching returned messages.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
curl "http://127.0.0.1:3939/v1/mail/search?q=quarterly&remote=true&limit=20"
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Calendar
|
|
265
|
+
|
|
266
|
+
#### `GET /v1/calendar/events?from=&to=&days=7&limit=50&offline=false`
|
|
267
|
+
|
|
268
|
+
Lists calendar events within a time window (`from` / `to` accept aliases `start` / `end` as ISO-8601 or `YYYY-MM-DD`; defaults to now through `+7` days).
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
curl "http://127.0.0.1:3939/v1/calendar/events?days=14"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"start": "2026-11-18T00:00:00Z",
|
|
277
|
+
"end": "2026-12-02T00:00:00Z",
|
|
278
|
+
"events": [
|
|
279
|
+
{
|
|
280
|
+
"id": "AAMkAGI2...",
|
|
281
|
+
"subject": "Architecture Review",
|
|
282
|
+
"start_iso": "2026-11-20T09:00:00Z",
|
|
283
|
+
"end_iso": "2026-11-20T10:00:00Z",
|
|
284
|
+
"time_zone": "UTC",
|
|
285
|
+
"is_all_day": false,
|
|
286
|
+
"location": "Room 4B",
|
|
287
|
+
"response_status": "accepted",
|
|
288
|
+
"is_online_meeting": true,
|
|
289
|
+
"online_meeting_url": "https://teams.microsoft.com/l/meetup-join/..."
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### `POST /v1/calendar/events`
|
|
296
|
+
|
|
297
|
+
Creates a new calendar event. `start_iso` / `end_iso` accept aliases `start` / `end`; `markdown` accepts alias `body`; `is_online_meeting` accepts alias `online`.
|
|
298
|
+
|
|
299
|
+
| Input | `time_zone` | Result |
|
|
300
|
+
|---|---|---|
|
|
301
|
+
| RFC3339 (`2026-11-20T14:00:00Z`, `...+09:00`) | any | Exact instant, stored in UTC. |
|
|
302
|
+
| Wall clock (`2026-11-20 14:00`) | omitted | Read in the server machine's time zone. |
|
|
303
|
+
| Wall clock (`2026-11-20 14:00`) | `Asia/Seoul` | Read in that zone (IANA or Windows name). |
|
|
304
|
+
| `is_all_day: true` | optional | `start_iso` and `end_iso` must be `YYYY-MM-DD`; the end date is exclusive. |
|
|
305
|
+
|
|
306
|
+
Invalid all-day input (a time of day, or an end date that is not after the start date) returns `400` without calling Microsoft Graph.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
curl -X POST http://127.0.0.1:3939/v1/calendar/events \
|
|
310
|
+
-H "Content-Type: application/json" \
|
|
311
|
+
-d '{"subject":"Sprint Planning","start_iso":"2026-11-20T14:00:00Z","end_iso":"2026-11-20T15:00:00Z","attendees":["bob@contoso.com"],"is_online_meeting":true}'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### `GET /v1/calendar/events/{id}?offline=false`
|
|
315
|
+
|
|
316
|
+
Reads full details and attendees for a calendar event.
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
curl "http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2..."
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
#### `POST /v1/calendar/events/{id}/rsvp`
|
|
323
|
+
|
|
324
|
+
Responds to a meeting invitation (`response`: `"accept"` | `"tentative"` | `"decline"`, optional `comment`).
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
curl -X POST http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2.../rsvp \
|
|
328
|
+
-H "Content-Type: application/json" \
|
|
329
|
+
-d '{"response":"accept","comment":"See you there."}'
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
#### `DELETE /v1/calendar/events/{id}`
|
|
333
|
+
|
|
334
|
+
Cancels/deletes a calendar event and removes it from the local cache.
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
curl -X DELETE http://127.0.0.1:3939/v1/calendar/events/AAMkAGI2...
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Microsoft To Do
|
|
341
|
+
|
|
342
|
+
#### `GET /v1/todo/lists?refresh=false&offline=false`
|
|
343
|
+
|
|
344
|
+
Lists Microsoft To Do task lists.
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
curl "http://127.0.0.1:3939/v1/todo/lists"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
#### `GET /v1/todo/tasks?list=tasks&all=false&limit=50&refresh=false&offline=false`
|
|
351
|
+
|
|
352
|
+
Lists tasks in a To Do list (`all` accepts alias `include_completed`).
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
curl "http://127.0.0.1:3939/v1/todo/tasks?list=tasks&all=true"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### `POST /v1/todo/tasks`
|
|
359
|
+
|
|
360
|
+
Creates a To Do task (`body_plain` accepts alias `notes`; `due_date_iso` accepts alias `due`; `importance`: `low` | `normal` | `high`).
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
curl -X POST http://127.0.0.1:3939/v1/todo/tasks \
|
|
364
|
+
-H "Content-Type: application/json" \
|
|
365
|
+
-d '{"title":"Publish outlook v0.1.0","due_date_iso":"2026-11-20","importance":"high"}'
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### `PATCH /v1/todo/tasks/{id}`
|
|
369
|
+
|
|
370
|
+
Marks a To Do task completed or incomplete (`{ "list"?: "tasks", "completed": true }`).
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
curl -X PATCH http://127.0.0.1:3939/v1/todo/tasks/TASK_ID \
|
|
374
|
+
-H "Content-Type: application/json" \
|
|
375
|
+
-d '{"completed":true}'
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
#### `DELETE /v1/todo/tasks/{id}?list=tasks`
|
|
379
|
+
|
|
380
|
+
Deletes a To Do task.
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
curl -X DELETE "http://127.0.0.1:3939/v1/todo/tasks/TASK_ID?list=tasks"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Contacts & Directory
|
|
387
|
+
|
|
388
|
+
#### `GET /v1/contacts?q=&limit=50&offline=false`
|
|
389
|
+
|
|
390
|
+
Lists personal Outlook contacts (`/me/contacts`) or, when `q` (alias `query`) is provided, searches both personal contacts and the Entra ID organization directory (`/users`).
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
curl "http://127.0.0.1:3939/v1/contacts?q=alice&limit=20"
|
|
394
|
+
```
|