Skip to main content

Delete Custom Model

Permanently delete a custom model. This action cannot be undone.

Endpoint

DELETE /api/v3/custom_models/{id}

Authentication

Requires API key with custom_models:write scope.

Request

Path Parameters

ParameterTypeRequiredDescription
idintegerYesModel ID to delete

Example Request

DELETE /api/v3/custom_models/123

Response

Success Response

Status Code: 204 No Content

Empty response body. Success indicated by 204 status code.

Examples

cURL

curl -X DELETE https://api.scriptix.io/api/v3/custom_models/123 \
-H "Authorization: Bearer YOUR_API_KEY"

Python

import requests

def delete_model(model_id):
url = f"https://api.scriptix.io/api/v3/custom_models/{model_id}"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

response = requests.delete(url, headers=headers)

if response.status_code == 204:
print(f"Model {model_id} deleted successfully")
return True
else:
print(f"Error deleting model: {response.json()}")
return False

# Usage
delete_model(123)

JavaScript

const deleteModel = async (modelId) => {
try {
const response = await axios.delete(
`https://api.scriptix.io/api/v3/custom_models/${modelId}`,
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);

if (response.status === 204) {
console.log(`Model ${modelId} deleted successfully`);
return true;
}
} catch (error) {
console.error('Error deleting model:', error.response.data);
return false;
}
};

// Usage
await deleteModel(123);

TypeScript

const deleteModel = async (modelId: number): Promise<boolean> => {
const response = await fetch(
`https://api.scriptix.io/api/v3/custom_models/${modelId}`,
{
method: 'DELETE',
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);

if (response.status === 204) {
console.log(`Model ${modelId} deleted`);
return true;
}

const error = await response.json();
throw new Error(error.message);
};

Error Responses

404 Not Found

{
"error": "Not Found",
"message": "Model not found",
"error_code": "MODEL_NOT_FOUND"
}

Causes:

  • Model ID doesn't exist
  • Model already deleted
  • Model belongs to different organization

409 Conflict - Model In Use

{
"error": "Conflict",
"message": "Cannot delete model: currently in use",
"error_code": "MODEL_IN_USE",
"details": {
"active_transcriptions": 5
}
}

Solution: Wait for active transcriptions to complete, then delete.

401 Unauthorized

{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}

Important Warnings

⚠️ Permanent Deletion

  • Cannot be undone: Deleted models cannot be recovered
  • Training data lost: All uploaded audio and transcripts are deleted
  • Metrics lost: Training metrics and logs are permanently removed
  • Active transcriptions: In-progress transcriptions using this model will fail

⚠️ Before Deleting

  1. Export training data: Download audio and transcripts if needed
  2. Save metrics: Record training_metrics for documentation
  3. Check usage: Ensure no active transcriptions using this model
  4. Migrate: Update applications to use different model
  5. Archive: Consider keeping model inactive instead of deleting

Safe Deletion Pattern

def safe_delete_model(model_id):
"""Safely delete model with checks and confirmation."""

# 1. Get model details
model = get_model(model_id)

# 2. Check if training is in progress
if model['training_status'] == 3:
print("Warning: Training in progress. Wait for completion.")
return False

# 3. Export metrics if successful training
if model['training_status'] == 4:
metrics = model.get('training_metrics', {})
print(f"Model metrics:")
print(f" WER: {metrics.get('word_error_rate')}%")
print(f" Improvement: {metrics.get('accuracy_improvement')}%")

# Save to file
with open(f"model_{model_id}_metrics.json", 'w') as f:
json.dump(model, f, indent=2)
print(f"Metrics saved to model_{model_id}_metrics.json")

# 4. Confirm deletion
confirm = input(f"Delete model '{model['name']}' (ID: {model_id})? [y/N]: ")
if confirm.lower() != 'y':
print("Deletion cancelled")
return False

# 5. Delete
response = requests.delete(
f"https://api.scriptix.io/api/v3/custom_models/{model_id}",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)

if response.status_code == 204:
print(f"✓ Model {model_id} deleted successfully")
return True
else:
print(f"✗ Error deleting model: {response.json()}")
return False

# Usage
safe_delete_model(123)

Batch Deletion

Delete multiple models (use with caution):

def delete_models(model_ids, dry_run=True):
"""Delete multiple models with dry-run option."""

for model_id in model_ids:
try:
model = get_model(model_id)
print(f"Model {model_id}: {model['name']} - {model['status_message']}")

if not dry_run:
if delete_model(model_id):
print(f" ✓ Deleted")
else:
print(f" ✗ Failed to delete")
else:
print(f" [DRY RUN] Would delete")

except Exception as e:
print(f"Model {model_id}: Error - {e}")

# Dry run first
delete_models([123, 124, 125], dry_run=True)

# Actually delete after reviewing
delete_models([123, 124, 125], dry_run=False)

Delete Failed Models

Clean up models that failed training:

def delete_failed_models():
"""Delete all models with training_status = 5 (failed)."""

# Get all models
response = requests.get(
"https://api.scriptix.io/api/v3/custom_models",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"status": 5} # Filter for failed models
)

failed_models = response.json()['result']

print(f"Found {len(failed_models)} failed models")

for model in failed_models:
print(f"\nModel ID {model['id']}: {model['name']}")
print(f"Error: {model.get('error', 'Unknown error')}")

confirm = input("Delete this model? [y/N]: ")
if confirm.lower() == 'y':
if delete_model(model['id']):
print("✓ Deleted")

# Usage
delete_failed_models()

Alternatives to Deletion

Instead of deleting, consider:

1. Keep as Reference

Keep successful models for performance comparison and documentation.

2. Version Management

Create new model versions instead of deleting old ones:

# Don't delete v1, create v2
create_model(name="Medical Cardiology EN v2")

3. Archive in Description

Mark models as archived instead of deleting:

update_model(123, description="[ARCHIVED] Old version, use model 456 instead")

Rate Limits

  • Requests: 20 requests/hour
  • Concurrent: 3 concurrent requests

Important: Always export training data and metrics before deleting a model. Deletion is permanent and cannot be undone.