AdminDelete user aggregate

Delete user aggregate

Admin-only endpoint for deleting a user aggregate. Supports two modes: DELETE_DO_ONLY removes the Durable Object instance while preserving R2 events (the state will be restored on next access), and DELETE_DO_AND_EVENTS archives all events to a timestamped folder then permanently removes the DO instance and D1 entries. Requires dual authentication: X-Admin-API-Key header and a JWT with @smartphonekey.com email domain.

curl -X DELETE "https://api.spkey.co/admin/cleanup/users/example_string?mode=DELETE_DO_ONLY" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN (JWT)" \
  -H "X-API-Key: YOUR_API_KEY"
{
  "success": true,
  "userId": "example_string",
  "mode": "example_string",
  "operations": [
    "null"
  ],
  "deletionSummary": "example_string",
  "auditLogPath": "example_string",
  "duration": 3.14,
  "errors": [
    "example_string"
  ]
}
DELETE
/admin/cleanup/users/{userId}
DELETE
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token (JWT)
Bearer Tokenstring
Required

JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.

JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.
API Key (header: X-API-Key)
X-API-Keystring
Required

API key for B2B organization access. Provided during organization onboarding.

API key for B2B organization access. Provided during organization onboarding.
path
userIdstring
Required

User ID to delete

query
modestring
Required

Deletion mode: DELETE_DO_ONLY preserves R2 events, DELETE_DO_AND_EVENTS archives and removes everything

Options: DELETE_DO_ONLY, DELETE_DO_AND_EVENTS
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token (JWT). JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.

header
X-API-Keystring
Required

API Key for authentication. API key for B2B organization access. Provided during organization onboarding.

Path Parameters

userIdstring
Required

User ID to delete

Query Parameters

modestring
Required

Deletion mode: DELETE_DO_ONLY preserves R2 events, DELETE_DO_AND_EVENTS archives and removes everything

Allowed values:DELETE_DO_ONLYDELETE_DO_AND_EVENTS

Responses

successboolean
Required
userIdstring
Required
modestring
Required
operationsstring[]
Required
deletionSummarystring
auditLogPathstring
Required
durationnumber
Required
errorsstring[]
Required