API Reference
Organization
Org profile and two-step organization deletion
Auth required, active organization, and admin/owner role.
PATCH /api/org/profile
Update the active organization's name and/or description.
| Body field | Type | Constraints |
|---|---|---|
name | string | 1–120 chars |
description | string | up to 500 chars (stored in Clerk publicMetadata) |
200 { "ok": true } · 400 validation / nothing to update · 502 Clerk error.
Organization deletion (two-step)
Deletion is irreversible — every stored file is permanently destroyed (on-chain records remain immutable). It is gated by an emailed 6-digit confirmation code.
POST /api/org/delete/request
Generates a 6-digit code (valid ~10 minutes) and emails it to the requesting admin.
200 { "ok": true } · 503 email not configured on the server (RESEND_API_KEY).
POST /api/org/delete/confirm
Body: { "code": "123456" }. On a valid code:
- Deletes every org document — R2 objects (bundles + capture screenshots) and DB rows
- Emails all members that the org and its files are gone
- Deletes the Clerk organization
200 { "ok": true } · 400 wrong/expired code or none pending · 502 files were deleted but removing the Clerk org failed.