Skip to content
These docs describe Tradr v0.17.0. Running an older release? Check the release notes for what changed.

Delete a user and all their data (admin only).

POST
/api/admin/users/{id}/delete
curl --request POST \
--url https://api.tradr.cloud/api/admin/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/delete \
--header 'Content-Type: application/json' \
--data '{ "confirmEmail": "hello@example.com" }'

Admin-gated (403 ADMIN_REQUIRED). DESTRUCTIVE AND IRREVERSIBLE — the user row and every user-keyed row (accounts, positions, ledger, wallet, Stripe mirror, sessions, settings) are removed by the FK cascade in one transaction; there is no undo. POST (never GET) per the SameSite=Lax CSRF posture. confirmEmail must equal the target user’s email (case-insensitive) or the request is a 400 VALIDATION_ERROR and nothing is changed; the check is enforced here, not only in the UI that collects it. An admin cannot delete their OWN account this way (400 VALIDATION_ERROR) — self-deletion goes through Settings. Before the delete, every live subscription is cancelled immediately at Stripe (fail-closed): a cancel error is a 502 STRIPE_CANCEL_FAILED and nothing is deleted. Deleting the last remaining admin is refused with 409 LAST_ADMIN. With Stripe unconfigured but a non-terminal subscription mirror still present the deletion is refused with 409 SUBSCRIPTION_UNRESOLVED.

id
required
string format: uuid
Media typeapplication/json
object
confirmEmail
required

Must match the target user’s email, case-insensitively.

string format: email
Examplegenerated
{
"confirmEmail": "hello@example.com"
}

AdminDeleteUserResult — { userId, outcome: “deleted”, purgeOutcome }.

VALIDATION_ERROR — id is not a UUID, body malformed, confirmEmail does not match, or the caller targeted their own account.

Not authenticated.

ADMIN_REQUIRED — authenticated but not an admin.

NOT_FOUND — no such user.

LAST_ADMIN — cannot delete the last admin; or SUBSCRIPTION_UNRESOLVED — resolve billing first.

Admin rate limit reached (60 / 60 s per user).

STRIPE_CANCEL_FAILED — a live subscription could not be cancelled; nothing deleted.