AdminDelete lock aggregate

Delete lock aggregate

Admin-only endpoint for deleting a lock aggregate. Supports two modes: DELETE_DO_ONLY removes the Durable Object instance while preserving R2 events (state restored on next access), and DELETE_DO_AND_EVENTS archives all events then permanently removes the DO instance and D1 entries. The cascadeDeleteKeys parameter controls whether associated key_assignments are also removed. 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/locks/example_string?mode=DELETE_DO_ONLY&cascadeDeleteKeys=true" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN (JWT)" \
  -H "X-API-Key: YOUR_API_KEY"
{
  "success": true,
  "lockId": "example_string",
  "mode": "example_string",
  "cascadeDeleteKeys": true,
  "operations": [
    "null"
  ],
  "deletionSummary": "example_string",
  "auditLogPath": "example_string",
  "duration": 3.14,
  "errors": [
    "example_string"
  ]
}
DELETE
/admin/cleanup/locks/{lockId}
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
lockIdstring
Required

Lock ID (numeric) or UUID

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
query
cascadeDeleteKeysstring

Whether to also delete associated key_assignments rows (default: true)

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

lockIdstring
Required

Lock ID (numeric) or UUID

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
cascadeDeleteKeysstring

Whether to also delete associated key_assignments rows (default: true)

Responses

successboolean
Required
lockIdstring
Required
modestring
Required
cascadeDeleteKeysboolean
Required
operationsstring[]
Required
deletionSummarystring
auditLogPathstring
Required
durationnumber
Required
errorsstring[]
Required