Delete Tokenset
Permanently deletes a tokenset and all its associated modes and 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}
Authentication
Requires a valid API token in the Authorization header.
Request
| Header | Value | Required |
|---|
Authorization | Bearer token | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|
id | string | Yes | Tokenset ID |
Response
Success Response
Status: 200 OK
{
"message": "Tokenset deleted successfully"
}
Examples
curl -X DELETE https://app.tokencraft.dev/api/v1/tokensets/tokenset-123 \
-H "Authorization: Bearer dtk_your_token_here"
Error Responses
404 Not Found
{
"error": "Tokenset not found"
}
Cascade Deletion
When a tokenset is deleted, the following are also deleted:
- ✅ All modes in the tokenset
- ✅ All tokens in those modes
This operation is irreversible. All data will be permanently deleted. Make sure to export your tokens before deletion if you need a backup.
Best Practices
Export Before Deletion
async function safeDeleteTokenset(tokensetId) {
// Export all modes first
const modes = await getModes(tokensetId);
for (const mode of modes) {
await exportMode(tokensetId, mode.id, 'json');
}
// Then delete
await deleteTokenset(tokensetId);
}
Next Steps