cURL
curl --request DELETE \ --url https://app.tokencraft.dev/api/v1/tokensets/{id}/modes/{modeId} \ --header 'Authorization: Bearer <token>'
Permanently delete a mode and all its tokens
DELETE /tokensets/{id}/modes/{modeId}
id
modeId
200 OK
{ "message": "Mode deleted successfully" }
curl -X DELETE https://app.tokencraft.dev/api/v1/tokensets/tokenset-123/modes/mode-dark \ -H "Authorization: Bearer tkc_your_token_here"
{ "error": "Cannot delete the last mode in a tokenset" }
{ "error": "Mode not found" }
// This will fail if only one mode exists await deleteMode(tokensetId, lastModeId); // Error: Cannot delete the last mode in a tokenset
// Create new mode first const newMode = await createMode(tokensetId, { name: 'New Mode', is_default: true }); // Then delete old mode await deleteMode(tokensetId, oldModeId);
async function safeDeleteMode(tokensetId, modeId) { // Export mode first await exportMode(tokensetId, modeId, 'json'); // Then delete await deleteMode(tokensetId, modeId); }