This endpoint allows customers to deactivate their own account. This is a soft delete operation that sets the account’s is_active flag to false, preserving historical data while preventing login.
Authentication
Required : Bearer token in Authorization header
Permission : You can only delete your own customer account (CustomerOnly permission)
Path Parameters
The customer ID to deactivate. Must match the authenticated user’s ID.
Response
Returns HTTP 204 No Content on successful deactivation.
Example Request
curl -X DELETE http://localhost:8000/api/v1/customers/42/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
url = "http://localhost:8000/api/v1/customers/42/"
headers = {
"Authorization" : "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.delete(url, headers = headers)
print ( f "Status Code: { response.status_code } " )
const response = await fetch ( 'http://localhost:8000/api/v1/customers/42/' , {
method: 'DELETE' ,
headers: {
'Authorization' : 'Bearer YOUR_ACCESS_TOKEN'
}
});
console . log ( `Status: ${ response . status } ` );
Example Response
Status : 204 No Content
No response body is returned on successful deactivation.
Error Responses
401 Unauthorized
Returned when authentication token is missing or invalid:
{
"detail" : "Authentication credentials were not provided."
}
403 Forbidden
Returned when you try to delete another customer’s account:
{
"detail" : "You do not have permission to perform this action."
}
404 Not Found
Returned when the customer ID doesn’t exist:
{
"detail" : "Not found."
}
Soft Delete Behavior
This endpoint implements a soft delete pattern:
Customer record remains in database
Order history is retained
Product reviews remain visible
Address information is kept
Purchase history is accessible
is_active flag is set to false
Account cannot log in
Account excluded from active customer queries
Cart session is preserved but inaccessible
What about vendor stores?
If the customer owns a store:
The store remains active (not automatically deleted)
Store products remain listed
To fully remove presence, delete the store first using Delete Store
Business Rules
Customers can only delete their own account
This is a soft delete - the account is marked inactive rather than removed
Historical data (orders, reviews) is preserved for business records
The customer’s email remains reserved and cannot be reused for new registrations
If the customer owns a store, the store is NOT automatically deleted
While this is a soft delete, account reactivation is not currently supported through the API. Contact support if you need to reactivate a deactivated account.
Recommended Deletion Workflow
If you’re a vendor with a store, follow this order:
Clear personal data
Optionally update your customer profile to remove personal information
Deactivate account
Finally, delete your customer account using this endpoint
Data Retention Policy
Deactivated accounts are retained for:
Order records : Indefinitely (required for business compliance)
Product reviews : Indefinitely (remain visible with attribution)
Personal information : Subject to data retention policies and GDPR requests
Login credentials : Authentication is disabled, tokens are invalidated
For GDPR or complete data deletion requests, please contact the platform administrator directly. Soft delete does not constitute full data erasure.
Code Reference
Implementation: ~/workspace/source/customers/views.py:70-73