Skip to main content
DELETE
/
api
/
v1
/
tokensets
/
{id}
/
modes
/
{modeId}
Delete Mode
curl --request DELETE \
  --url https://app.tokencraft.dev/api/v1/api/v1/tokensets/{id}/modes/{modeId} \
  --header 'Authorization: Bearer <token>'

Delete Mode

Permanently deletes a mode and all its associated tokens. This action cannot be undone.
PRO Plan Required - This endpoint requires a PRO or TEAM subscription plan. API write access is not available on the FREE plan.

Endpoint

DELETE /api/v1/tokensets/{id}/modes/{modeId}

Request

Path Parameters

ParameterTypeRequiredDescription
idstringYesTokenset ID
modeIdstringYesMode ID

Response

Status: 200 OK
{
  "message": "Mode deleted successfully"
}

Examples

curl -X DELETE https://app.tokencraft.dev/api/v1/tokensets/tokenset-123/modes/mode-dark \
  -H "Authorization: Bearer dtk_your_token_here"

Error Responses

400 Bad Request

{
  "error": "Cannot delete the last mode in a tokenset"
}
A tokenset must always have at least one mode. You cannot delete the last remaining mode.

404 Not Found

{
  "error": "Mode not found"
}

Cascade Deletion

When a mode is deleted:
  • ✅ All tokens in the mode are deleted
This operation is irreversible. All data will be permanently deleted. Export tokens before deletion if you need a backup.

Restrictions

Cannot Delete Last Mode

// This will fail if only one mode exists
await deleteMode(tokensetId, lastModeId);
// Error: Cannot delete the last mode in a tokenset
Solution: Create a new mode before deleting:
// Create new mode first
const newMode = await createMode(tokensetId, { name: 'New Mode', is_default: true });

// Then delete old mode
await deleteMode(tokensetId, oldModeId);

Best Practices

Export Before Deletion

async function safeDeleteMode(tokensetId, modeId) {
  // Export mode first
  await exportMode(tokensetId, modeId, 'json');
  
  // Then delete
  await deleteMode(tokensetId, modeId);
}

Next Steps