Delete Customer
Permanently deletes a customer from the system.
HTTP Request
DELETE/api/customers/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the customer to delete |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3response = requests.delete('http://www.example.com/api/customers/123',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.status_code) # Should be 204 for successful deletion
7
8# Check if customer was deleted
9if response.status_code == 204:
10 print("Customer deleted successfully")
11elif response.status_code == 404:
12 print("Customer not found")
13else:
14 print(f"Error: {response.status_code}")1curl -X DELETE "http://www.example.com/api/customers/123" \
2-H "Authorization: Token <your_api_key>" \
3-vStatus Codes
| Code | Description |
|---|---|
| 204 | Customer deleted successfully |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Customer not found |
| 409 | Conflict — customer has active orders or cannot be deleted |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| None | None | No content returned on successful deletion |
Notes
- This action permanently deletes the customer and cannot be undone
- All customer data including addresses, order history, and personal information will be removed
- Consider deactivating the customer (setting is_active to false) instead of deletion for data retention
- Some systems may prevent deletion if the customer has active orders or pending transactions
- Use this endpoint with extreme caution in production environments