benjivers/notes Public Public: anyone can read this; nobody can change it.

Files otel
663 lines · 17.1 KB · ~5.8k tok Raw History
1
{
2
  "openapi": "3.1.0",
3
  "info": {
4
    "title": "notes",
5
    "version": "1.1.0",
6
    "description": "A personal linked-notes vault — markdown, [[wikilinks]], backlinks, tags, graph."
7
  },
8
  "paths": {
9
    "/api/notes": {
10
      "get": {
11
        "summary": "Your notes, pinned first then most recently changed; with `q`, the ones a search finds (words, \"a phrase\", #tag), best first.",
12
        "operationId": "getApiNotes",
13
        "parameters": [
14
          {
15
            "name": "limit",
16
            "in": "query",
17
            "schema": {
18
              "type": "integer",
19
              "minimum": 1,
20
              "maximum": 5000
21
            }
22
          },
23
          {
24
            "name": "q",
25
            "in": "query",
26
            "schema": {
27
              "type": "string",
28
              "maxLength": 500
29
            }
30
          }
31
        ],
32
        "responses": {
33
          "200": {
34
            "description": "Your notes, pinned first then most recently changed; with `q`, the ones a search finds (words, \"a phrase\", #tag), best first.",
35
            "content": {
36
              "application/json": {
37
                "schema": {
38
                  "type": "array",
39
                  "items": {
40
                    "$ref": "#/components/schemas/Note"
41
                  }
42
                }
43
              }
44
            }
45
          },
46
          "default": {
47
            "description": "{ error, message }: why not",
48
            "content": {
49
              "application/json": {
50
                "schema": {
51
                  "$ref": "#/components/schemas/Error"
52
                }
53
              }
54
            }
55
          }
56
        },
57
        "x-contract": {
58
          "resource": "note",
59
          "verb": "list",
60
          "least": "author"
61
        }
62
      },
63
      "post": {
64
        "summary": "Add a note to your vault.",
65
        "operationId": "postApiNotes",
66
        "requestBody": {
67
          "required": true,
68
          "content": {
69
            "application/json": {
70
              "schema": {
71
                "type": "object",
72
                "properties": {
73
                  "title": {
74
                    "type": "string",
75
                    "maxLength": 200,
76
                    "description": "Unique in your vault; “Untitled” when left out."
77
                  },
78
                  "body": {
79
                    "type": "string",
80
                    "maxLength": 200000,
81
                    "description": "Markdown."
82
                  }
83
                }
84
              }
85
            }
86
          }
87
        },
88
        "responses": {
89
          "201": {
90
            "description": "Add a note to your vault.",
91
            "content": {
92
              "application/json": {
93
                "schema": {
94
                  "$ref": "#/components/schemas/Note"
95
                }
96
              }
97
            }
98
          },
99
          "default": {
100
            "description": "{ error, message }: why not",
101
            "content": {
102
              "application/json": {
103
                "schema": {
104
                  "$ref": "#/components/schemas/Error"
105
                }
106
              }
107
            }
108
          }
109
        },
110
        "x-contract": {
111
          "resource": "note",
112
          "verb": "create",
113
          "least": "user"
114
        }
115
      }
116
    },
117
    "/api/notes/{id}": {
118
      "get": {
119
        "summary": "One of your notes.",
120
        "operationId": "getApiNotesId",
121
        "parameters": [
122
          {
123
            "name": "id",
124
            "in": "path",
125
            "required": true,
126
            "schema": {
127
              "type": "integer"
128
            }
129
          }
130
        ],
131
        "responses": {
132
          "200": {
133
            "description": "One of your notes.",
134
            "content": {
135
              "application/json": {
136
                "schema": {
137
                  "$ref": "#/components/schemas/Note"
138
                }
139
              }
140
            }
141
          },
142
          "default": {
143
            "description": "{ error, message }: why not",
144
            "content": {
145
              "application/json": {
146
                "schema": {
147
                  "$ref": "#/components/schemas/Error"
148
                }
149
              }
150
            }
151
          }
152
        },
153
        "x-contract": {
154
          "resource": "note",
155
          "verb": "read",
156
          "least": "author"
157
        }
158
      },
159
      "patch": {
160
        "summary": "Change a note's title, words or pin; a rename rewrites the links to it. `relinked` says how many notes that touched.",
161
        "operationId": "patchApiNotesId",
162
        "parameters": [
163
          {
164
            "name": "id",
165
            "in": "path",
166
            "required": true,
167
            "schema": {
168
              "type": "integer"
169
            }
170
          }
171
        ],
172
        "requestBody": {
173
          "required": true,
174
          "content": {
175
            "application/json": {
176
              "schema": {
177
                "type": "object",
178
                "properties": {
179
                  "title": {
180
                    "type": "string",
181
                    "minLength": 1,
182
                    "maxLength": 200,
183
                    "description": "A rename carries every [[link]] to the note with it."
184
                  },
185
                  "body": {
186
                    "type": "string",
187
                    "maxLength": 200000
188
                  },
189
                  "pinned": {
190
                    "type": "boolean"
191
                  }
192
                }
193
              }
194
            }
195
          }
196
        },
197
        "responses": {
198
          "200": {
199
            "description": "Change a note's title, words or pin; a rename rewrites the links to it. `relinked` says how many notes that touched.",
200
            "content": {
201
              "application/json": {
202
                "schema": {
203
                  "allOf": [
204
                    {
205
                      "type": "object",
206
                      "properties": {
207
                        "id": {
208
                          "type": "integer"
209
                        },
210
                        "title": {
211
                          "type": "string",
212
                          "minLength": 1,
213
                          "maxLength": 200
214
                        },
215
                        "body": {
216
                          "type": "string",
217
                          "maxLength": 200000
218
                        },
219
                        "pinned": {
220
                          "enum": [
221
                            0,
222
                            1
223
                          ]
224
                        },
225
                        "author_id": {
226
                          "type": "string"
227
                        },
228
                        "author_name": {
229
                          "type": "string"
230
                        },
231
                        "created_at": {
232
                          "type": "string",
233
                          "format": "date-time"
234
                        },
235
                        "updated_at": {
236
                          "type": "string",
237
                          "format": "date-time"
238
                        }
239
                      },
240
                      "required": [
241
                        "id",
242
                        "title",
243
                        "body",
244
                        "pinned",
245
                        "author_id",
246
                        "author_name",
247
                        "created_at",
248
                        "updated_at"
249
                      ]
250
                    },
251
                    {
252
                      "type": "object",
253
                      "properties": {
254
                        "relinked": {
255
                          "type": "integer"
256
                        }
257
                      },
258
                      "required": [
259
                        "relinked"
260
                      ]
261
                    }
262
                  ]
263
                }
264
              }
265
            }
266
          },
267
          "default": {
268
            "description": "{ error, message }: why not",
269
            "content": {
270
              "application/json": {
271
                "schema": {
272
                  "$ref": "#/components/schemas/Error"
273
                }
274
              }
275
            }
276
          }
277
        },
278
        "x-contract": {
279
          "resource": "note",
280
          "verb": "update",
281
          "least": "author"
282
        }
283
      },
284
      "delete": {
285
        "summary": "Remove a note.",
286
        "operationId": "deleteApiNotesId",
287
        "parameters": [
288
          {
289
            "name": "id",
290
            "in": "path",
291
            "required": true,
292
            "schema": {
293
              "type": "integer"
294
            }
295
          }
296
        ],
297
        "responses": {
298
          "200": {
299
            "description": "Remove a note.",
300
            "content": {
301
              "application/json": {
302
                "schema": {
303
                  "type": "object",
304
                  "properties": {
305
                    "id": {
306
                      "type": "integer"
307
                    }
308
                  },
309
                  "required": [
310
                    "id"
311
                  ]
312
                }
313
              }
314
            }
315
          },
316
          "default": {
317
            "description": "{ error, message }: why not",
318
            "content": {
319
              "application/json": {
320
                "schema": {
321
                  "$ref": "#/components/schemas/Error"
322
                }
323
              }
324
            }
325
          }
326
        },
327
        "x-contract": {
328
          "resource": "note",
329
          "verb": "delete",
330
          "least": "author"
331
        }
332
      }
333
    },
334
    "/api/audit": {
335
      "get": {
336
        "summary": "The audit trail, newest first; `before` pages back by id.",
337
        "operationId": "getApiAudit",
338
        "parameters": [
339
          {
340
            "name": "limit",
341
            "in": "query",
342
            "schema": {
343
              "type": "integer",
344
              "minimum": 1,
345
              "maximum": 500,
346
              "default": 100
347
            }
348
          },
349
          {
350
            "name": "before",
351
            "in": "query",
352
            "schema": {
353
              "type": "integer"
354
            }
355
          }
356
        ],
357
        "responses": {
358
          "200": {
359
            "description": "The audit trail, newest first; `before` pages back by id.",
360
            "content": {
361
              "application/json": {
362
                "schema": {
363
                  "type": "array",
364
                  "items": {
365
                    "$ref": "#/components/schemas/AuditRow"
366
                  }
367
                }
368
              }
369
            }
370
          },
371
          "default": {
372
            "description": "{ error, message }: why not",
373
            "content": {
374
              "application/json": {
375
                "schema": {
376
                  "$ref": "#/components/schemas/Error"
377
                }
378
              }
379
            }
380
          }
381
        },
382
        "x-contract": {
383
          "resource": "audit",
384
          "verb": "list",
385
          "least": "admin"
386
        }
387
      }
388
    },
389
    "/api/audit/{id}": {
390
      "get": {
391
        "summary": "One row of the audit trail.",
392
        "operationId": "getApiAuditId",
393
        "parameters": [
394
          {
395
            "name": "id",
396
            "in": "path",
397
            "required": true,
398
            "schema": {
399
              "type": "integer"
400
            }
401
          }
402
        ],
403
        "responses": {
404
          "200": {
405
            "description": "One row of the audit trail.",
406
            "content": {
407
              "application/json": {
408
                "schema": {
409
                  "$ref": "#/components/schemas/AuditRow"
410
                }
411
              }
412
            }
413
          },
414
          "default": {
415
            "description": "{ error, message }: why not",
416
            "content": {
417
              "application/json": {
418
                "schema": {
419
                  "$ref": "#/components/schemas/Error"
420
                }
421
              }
422
            }
423
          }
424
        },
425
        "x-contract": {
426
          "resource": "audit",
427
          "verb": "read",
428
          "least": "admin"
429
        }
430
      }
431
    },
432
    "/mcp": {
433
      "post": {
434
        "summary": "One JSON-RPC 2.0 message to the MCP server; its tools are the actions.",
435
        "operationId": "postMcp",
436
        "requestBody": {
437
          "required": true,
438
          "content": {
439
            "application/json": {
440
              "schema": {
441
                "type": "object",
442
                "properties": {
443
                  "jsonrpc": {
444
                    "const": "2.0"
445
                  },
446
                  "id": {},
447
                  "method": {
448
                    "type": "string"
449
                  },
450
                  "params": {
451
                    "type": "object"
452
                  }
453
                },
454
                "required": [
455
                  "jsonrpc",
456
                  "method"
457
                ]
458
              }
459
            }
460
          }
461
        },
462
        "responses": {
463
          "200": {
464
            "description": "One JSON-RPC 2.0 message to the MCP server; its tools are the actions.",
465
            "content": {
466
              "application/json": {
467
                "schema": {
468
                  "type": "object"
469
                }
470
              }
471
            }
472
          },
473
          "default": {
474
            "description": "{ error, message }: why not",
475
            "content": {
476
              "application/json": {
477
                "schema": {
478
                  "$ref": "#/components/schemas/Error"
479
                }
480
              }
481
            }
482
          }
483
        }
484
      }
485
    },
486
    "/healthz": {
487
      "get": {
488
        "summary": "Whether the app is up: its version, commit, environment and seconds since it started.",
489
        "operationId": "getHealthz",
490
        "responses": {
491
          "200": {
492
            "description": "Whether the app is up: its version, commit, environment and seconds since it started.",
493
            "content": {
494
              "application/json": {
495
                "schema": {
496
                  "type": "object",
497
                  "properties": {
498
                    "ok": {
499
                      "type": "boolean"
500
                    },
501
                    "version": {
502
                      "type": "string"
503
                    },
504
                    "commit": {
505
                      "type": "string"
506
                    },
507
                    "env": {
508
                      "type": "string"
509
                    },
510
                    "uptime": {
511
                      "type": "integer"
512
                    }
513
                  },
514
                  "required": [
515
                    "ok",
516
                    "version",
517
                    "uptime"
518
                  ]
519
                }
520
              }
521
            }
522
          },
523
          "default": {
524
            "description": "{ error, message }: why not",
525
            "content": {
526
              "application/json": {
527
                "schema": {
528
                  "$ref": "#/components/schemas/Error"
529
                }
530
              }
531
            }
532
          }
533
        }
534
      }
535
    }
536
  },
537
  "components": {
538
    "schemas": {
539
      "Note": {
540
        "type": "object",
541
        "properties": {
542
          "id": {
543
            "type": "integer"
544
          },
545
          "title": {
546
            "type": "string",
547
            "minLength": 1,
548
            "maxLength": 200
549
          },
550
          "body": {
551
            "type": "string",
552
            "maxLength": 200000
553
          },
554
          "pinned": {
555
            "enum": [
556
              0,
557
              1
558
            ]
559
          },
560
          "author_id": {
561
            "type": "string"
562
          },
563
          "author_name": {
564
            "type": "string"
565
          },
566
          "created_at": {
567
            "type": "string",
568
            "format": "date-time"
569
          },
570
          "updated_at": {
571
            "type": "string",
572
            "format": "date-time"
573
          }
574
        },
575
        "required": [
576
          "id",
577
          "title",
578
          "body",
579
          "pinned",
580
          "author_id",
581
          "author_name",
582
          "created_at",
583
          "updated_at"
584
        ]
585
      },
586
      "AuditRow": {
587
        "type": "object",
588
        "properties": {
589
          "id": {
590
            "type": "integer"
591
          },
592
          "at": {
593
            "type": "string",
594
            "format": "date-time"
595
          },
596
          "who_id": {
597
            "type": [
598
              "string",
599
              "null"
600
            ]
601
          },
602
          "who_name": {
603
            "type": [
604
              "string",
605
              "null"
606
            ]
607
          },
608
          "role": {
609
            "enum": [
610
              "anon",
611
              "user",
612
              "admin"
613
            ]
614
          },
615
          "resource": {
616
            "type": "string"
617
          },
618
          "verb": {
619
            "type": "string"
620
          },
621
          "target": {
622
            "type": [
623
              "string",
624
              "null"
625
            ]
626
          },
627
          "allowed": {
628
            "enum": [
629
              0,
630
              1
631
            ]
632
          },
633
          "outcome": {
634
            "type": "string"
635
          }
636
        },
637
        "required": [
638
          "id",
639
          "at",
640
          "role",
641
          "resource",
642
          "verb",
643
          "allowed",
644
          "outcome"
645
        ]
646
      },
647
      "Error": {
648
        "type": "object",
649
        "properties": {
650
          "error": {
651
            "type": "string"
652
          },
653
          "message": {
654
            "type": "string"
655
          }
656
        },
657
        "required": [
658
          "error"
659
        ]
660
      }
661
    }
662
  }
663
}
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts