Skip to main content
POST
/
api
/
models
/
model
/
delete
Delete Model
curl --request POST \
  --url https://api.example.com/api/models/model/delete \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>"
}
'
{
  "success": true
}

Body Parameters

id
string
required
The unique identifier of the model to delete

Response

success
boolean
Returns true if the model was successfully deleted, false otherwise

Example Request

curl -X POST "https://api.example.com/api/models/model/delete" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "my-custom-gpt4"
  }'

Example Response

true

Error Responses

401
Unauthorized - Model not found
{
  "detail": "Model not found"
}
401
Unauthorized - User does not have permission to delete this model
{
  "detail": "Unauthorized"
}

Permissions

To delete a model, the user must:
  • Be an admin user, OR
  • Be the owner of the model (user_id matches), OR
  • Have write access granted through access_grants

Side Effects

Deleting a model will:
  1. Remove all access grants associated with the model
  2. Permanently delete the model from the database
  3. The model ID will become available for reuse
This operation cannot be undone. Make sure to export the model configuration if you need to recreate it later.

Alternative: Delete All Models

Admins can delete all models at once using:
curl -X DELETE "https://api.example.com/api/models/delete/all" \
  -H "Authorization: Bearer YOUR_API_KEY"
This endpoint:
  • Requires admin privileges
  • Deletes all models in the database
  • Revokes all associated access grants
  • Returns true on success
Warning: This is a destructive operation that cannot be undone. Use with extreme caution.