Skip to main content

max / makenotwork

10.4 KB · 292 lines History Blame Raw
1 # MNW -- API Reference
2
3 Public JSON API endpoints. All write routes require authentication via session cookie or JWT.
4
5 Rate limits: write routes (burst 10, 2/sec per IP), export routes (burst 3, 1/sec per IP).
6
7 HTMX responses return HTML fragments; non-HTMX requests get JSON.
8
9 ---
10
11 ## Projects
12
13 | Method | Path | Description |
14 |--------|------|-------------|
15 | POST | /api/projects | Create a new project |
16 | GET | /api/projects | List all projects for the authenticated user |
17 | PUT | /api/projects/{id} | Update a project |
18 | DELETE | /api/projects/{id} | Delete a project |
19
20 ## Git Repos
21
22 | Method | Path | Description |
23 |--------|------|-------------|
24 | POST | /api/repos | Create a bare git repo on disk |
25 | POST | /api/projects/{id}/repos | Link a repo to a project |
26 | DELETE | /api/projects/{id}/repos/{name} | Unlink a repo from a project |
27 | PUT | /api/repos/{id}/visibility | Update repo visibility |
28
29 ## Items
30
31 | Method | Path | Description |
32 |--------|------|-------------|
33 | POST | /api/projects/{id}/items | Create a new item |
34 | PUT | /api/items/{id} | Update an item |
35 | DELETE | /api/items/{id} | Delete an item |
36 | POST | /api/items/{id}/duplicate | Duplicate an item as a new draft |
37 | PUT | /api/items/{id}/move | Reorder an item within its project |
38
39 ### Bulk Operations
40
41 | Method | Path | Description |
42 |--------|------|-------------|
43 | POST | /api/items/bulk/publish | Publish multiple items |
44 | POST | /api/items/bulk/unpublish | Unpublish multiple items |
45 | POST | /api/items/bulk/delete | Delete multiple items |
46
47 ### Tags
48
49 | Method | Path | Description |
50 |--------|------|-------------|
51 | POST | /api/items/{id}/tags | Add a tag to an item |
52 | DELETE | /api/items/{id}/tags/{tag_id} | Remove a tag from an item |
53 | PUT | /api/items/{id}/primary-tag | Set the primary tag |
54 | GET | /api/tags/search | Typeahead tag search |
55 | GET | /api/items/{id}/tag-suggestions | Suggest tags for an item |
56
57 ### Bundles
58
59 | Method | Path | Description |
60 |--------|------|-------------|
61 | POST | /api/items/{id}/bundle/add | Add a child item to a bundle |
62 | DELETE | /api/items/{id}/bundle/{child_id} | Remove a child from a bundle |
63 | PUT | /api/items/{id}/bundle/{child_id}/listed | Toggle child visibility |
64
65 ### Text Content
66
67 | Method | Path | Description |
68 |--------|------|-------------|
69 | PUT | /api/items/{id}/text | Save or update text body content |
70
71 ### Chapters
72
73 | Method | Path | Description |
74 |--------|------|-------------|
75 | GET | /api/items/{id}/chapters | List chapters for an item |
76 | POST | /api/items/{id}/chapters | Create a chapter marker |
77 | PUT | /api/chapters/{id} | Update a chapter |
78 | DELETE | /api/chapters/{id} | Delete a chapter |
79
80 ### Versions
81
82 | Method | Path | Description |
83 |--------|------|-------------|
84 | GET | /api/items/{id}/versions | List versions for an item |
85 | POST | /api/items/{id}/versions | Create a new version |
86
87 ## Blog
88
89 | Method | Path | Description |
90 |--------|------|-------------|
91 | POST | /api/projects/{id}/blog | Create a blog post |
92 | GET | /api/projects/{id}/blog | List blog posts for a project |
93 | GET | /api/blog/{id} | Get a blog post (includes markdown body) |
94 | PUT | /api/blog/{id} | Update a blog post |
95 | DELETE | /api/blog/{id} | Delete a blog post |
96
97 ## Collections
98
99 | Method | Path | Description |
100 |--------|------|-------------|
101 | POST | /api/collections | Create a collection |
102 | PUT | /api/collections/{id} | Update a collection |
103 | DELETE | /api/collections/{id} | Delete a collection |
104 | POST | /api/collections/{id}/items/{item_id} | Add an item to a collection |
105 | DELETE | /api/collections/{id}/items/{item_id} | Remove an item from a collection |
106 | PUT | /api/collections/{id}/items/reorder | Reorder items |
107 | GET | /api/collections/for-item/{item_id} | Collections containing an item |
108
109 ## License Keys
110
111 ### Creator Endpoints (auth required)
112
113 | Method | Path | Description |
114 |--------|------|-------------|
115 | POST | /api/items/{id}/license-settings | Configure license key settings |
116 | GET | /api/items/{id}/keys | List keys for an item |
117 | POST | /api/items/{id}/keys | Generate a new key |
118 | POST | /api/keys/{id}/revoke | Revoke a key |
119
120 ### Public Endpoints (rate-limited, stable API contract)
121
122 | Method | Path | Description |
123 |--------|------|-------------|
124 | POST | /api/keys/validate | Validate and optionally activate a key |
125 | POST | /api/keys/deactivate | Release an activation slot |
126 | GET | /api/keys/{code}/status | Check key status |
127
128 ## Promo Codes
129
130 | Method | Path | Description |
131 |--------|------|-------------|
132 | POST | /api/promo-codes | Create a promo code |
133 | GET | /api/promo-codes | List promo codes |
134 | DELETE | /api/promo-codes/{id} | Delete a promo code |
135 | POST | /api/promo-codes/claim | Claim a free_access promo code (buyer endpoint) |
136
137 ## Subscription Tiers
138
139 | Method | Path | Description |
140 |--------|------|-------------|
141 | POST | /api/projects/{id}/tiers | Create a subscription tier |
142 | GET | /api/projects/{id}/tiers | List tiers for a project |
143 | PUT | /api/tiers/{id} | Update a tier |
144 | DELETE | /api/tiers/{id} | Delete a tier |
145
146 ## Follows
147
148 | Method | Path | Description |
149 |--------|------|-------------|
150 | POST | /api/follow/{type}/{id} | Follow a user or project |
151 | DELETE | /api/follow/{type}/{id} | Unfollow a user or project |
152
153 ## Custom Links
154
155 | Method | Path | Description |
156 |--------|------|-------------|
157 | POST | /api/links | Create a profile link |
158 | PUT | /api/links/{id} | Update a link |
159 | DELETE | /api/links/{id} | Delete a link |
160 | PUT | /api/links/reorder | Reorder all links |
161
162 ## Labels
163
164 | Method | Path | Description |
165 |--------|------|-------------|
166 | GET | /api/labels | List all available labels |
167 | GET | /api/projects/{id}/labels | Get labels for a project |
168 | POST | /api/projects/{id}/labels | Add a label to a project |
169 | DELETE | /api/projects/{id}/labels/{label_id} | Remove a label from a project |
170
171 ## Categories
172
173 | Method | Path | Description |
174 |--------|------|-------------|
175 | POST | /api/categories | Create a category |
176 | GET | /api/categories/search | Search categories (typeahead) |
177
178 ## Custom Domains
179
180 | Method | Path | Description |
181 |--------|------|-------------|
182 | POST | /api/domains | Add a custom domain |
183 | POST | /api/domains/verify | Trigger DNS TXT verification |
184 | DELETE | /api/domains/{id} | Remove a custom domain |
185
186 ## Content Insertions
187
188 | Method | Path | Description |
189 |--------|------|-------------|
190 | POST | /api/users/me/insertions/presign | Get presigned upload URL |
191 | POST | /api/users/me/insertions/confirm | Confirm upload |
192 | GET | /api/users/me/insertions | List insertions |
193 | PUT | /api/insertions/{id} | Rename an insertion |
194 | DELETE | /api/insertions/{id} | Delete an insertion |
195 | POST | /api/items/{id}/insertions | Place an insertion in an item |
196 | DELETE | /api/item-insertions/{id} | Remove a placement |
197 | GET | /api/items/{id}/insertions | List placements for an item |
198
199 ## Exports
200
201 | Method | Path | Description |
202 |--------|------|-------------|
203 | POST | /api/export/projects | Export projects + items as JSON |
204 | POST | /api/export/sales | Export sales as CSV |
205 | POST | /api/export/purchases | Export purchases as CSV |
206 | POST | /api/export/followers | Export followers as CSV |
207 | POST | /api/export/content | Export content files as ZIP |
208
209 ## User Account
210
211 | Method | Path | Description |
212 |--------|------|-------------|
213 | PUT | /api/users/me | Update display name and bio |
214 | PUT | /api/users/me/password | Change password |
215 | PUT | /api/users/me/preferences | Update notification preferences |
216 | PUT | /api/users/me/stripe-tax | Toggle Stripe tax collection |
217 | DELETE | /api/users/me | Delete account |
218 | DELETE | /api/users/me/stripe | Disconnect Stripe Connect |
219 | POST | /api/users/me/appeal | Submit suspension appeal |
220 | POST | /api/resend-verification | Resend verification email |
221 | POST | /api/account/request-deletion | Request account deletion with data export |
222
223 ### Sessions
224
225 | Method | Path | Description |
226 |--------|------|-------------|
227 | DELETE | /api/users/me/sessions/{id} | Revoke a session |
228 | DELETE | /api/users/me/sessions | Revoke all other sessions |
229
230 ### SSH Keys
231
232 | Method | Path | Description |
233 |--------|------|-------------|
234 | GET | /api/users/me/ssh-keys | List SSH keys |
235 | POST | /api/users/me/ssh-keys | Add an SSH key |
236 | DELETE | /api/users/me/ssh-keys/{id} | Delete an SSH key |
237
238 ### TOTP (2FA)
239
240 | Method | Path | Description |
241 |--------|------|-------------|
242 | POST | /api/users/me/totp/setup | Generate TOTP secret and QR code |
243 | POST | /api/users/me/totp/confirm | Verify first code and enable 2FA |
244 | POST | /api/users/me/totp/disable | Disable 2FA |
245 | POST | /api/users/me/totp/backup-codes | Regenerate backup codes |
246 | GET | /api/users/me/totp/status | Get 2FA status |
247
248 ### Passkeys (WebAuthn)
249
250 | Method | Path | Description |
251 |--------|------|-------------|
252 | POST | /api/users/me/passkeys/register/start | Start passkey registration |
253 | POST | /api/users/me/passkeys/register/finish | Finish passkey registration |
254 | GET | /api/users/me/passkeys | List passkeys |
255 | PUT | /api/users/me/passkeys/{id} | Rename a passkey |
256 | DELETE | /api/users/me/passkeys/{id} | Delete a passkey |
257
258 ## Library
259
260 | Method | Path | Description |
261 |--------|------|-------------|
262 | POST | /api/library/add/{item_id} | Add to library |
263 | DELETE | /api/library/remove/{item_id} | Remove from library |
264
265 ## Miscellaneous
266
267 | Method | Path | Description |
268 |--------|------|-------------|
269 | POST | /api/reports | Submit a content report |
270 | POST | /api/broadcast | Send broadcast to followers |
271 | POST | /api/waitlist/apply | Join the platform waitlist |
272 | POST | /api/invites/create | Create an invite code |
273 | POST | /api/validate/project-slug | Check project slug availability |
274 | POST | /api/validate/collection-slug | Check collection slug availability |
275 | POST | /api/validate/blog-slug | Check blog slug availability |
276 | POST | /api/email-signup | Subscribe to newsletter (public, no auth) |
277 | GET | /api/restart-status | Check pending service restart (public, no auth) |
278
279 ---
280
281 ## Internal API
282
283 Service-to-service endpoints under `/api/internal/` are authenticated via `ServiceAuth` bearer token. Used by mnw-cli for creator operations, git authorization, and file uploads. Not listed here — see `src/routes/api/internal.rs` for the full surface.
284
285 ## SyncKit API
286
287 SyncKit endpoints under `/api/synckit/` handle cloud sync, device management, and blob operations. Authenticated via SyncKit JWT. See `src/routes/synckit.rs`.
288
289 ## OTA API
290
291 OTA update endpoints under `/api/ota/` serve release metadata and presigned download URLs. See `src/routes/ota.rs`.
292