curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def delete_user(api_key: str, user_id: str) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
elif response.status_code == 422:
error_data = response.json()
raise ValueError(error_data.get('message', 'Cannot process request'))
response.raise_for_status()
# Example usage
try:
delete_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print("User deleted successfully")
except Exception as e:
print(f"Failed to delete user: {str(e)}")
const axios = require('axios');
async function deleteUser(apiKey, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: {
'X-API-KEY': apiKey
}
}
);
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
if (error.response?.status === 422) {
throw new Error(error.response.data.message || 'Cannot process request');
}
throw error;
}
}
// Example usage
deleteUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(() => console.log('User deleted successfully'))
.catch(error => console.error('Failed to delete user:', error.message));
{
"status": 404,
"message": "Not found"
}
{
"status": 422,
"message": "You should block users before deleting them"
}
Users
Delete User
Delete user account
DELETE
/
users
/
{userId}
curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def delete_user(api_key: str, user_id: str) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
elif response.status_code == 422:
error_data = response.json()
raise ValueError(error_data.get('message', 'Cannot process request'))
response.raise_for_status()
# Example usage
try:
delete_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print("User deleted successfully")
except Exception as e:
print(f"Failed to delete user: {str(e)}")
const axios = require('axios');
async function deleteUser(apiKey, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: {
'X-API-KEY': apiKey
}
}
);
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
if (error.response?.status === 422) {
throw new Error(error.response.data.message || 'Cannot process request');
}
throw error;
}
}
// Example usage
deleteUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(() => console.log('User deleted successfully'))
.catch(error => console.error('Failed to delete user:', error.message));
{
"status": 404,
"message": "Not found"
}
{
"status": 422,
"message": "You should block users before deleting them"
}
Permanently delete a user account.
Users must be deactivated (blocked) before they can be deleted. Use the Deactivate User endpoint first.
Request Headers
API Key. Go to your Konstantly site > Settings > API and copy the value from there.
URL Parameters
User API ID
Response
On success, returns HTTP 200 status code.Error Responses
curl --request DELETE \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def delete_user(api_key: str, user_id: str) -> None:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
elif response.status_code == 422:
error_data = response.json()
raise ValueError(error_data.get('message', 'Cannot process request'))
response.raise_for_status()
# Example usage
try:
delete_user("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print("User deleted successfully")
except Exception as e:
print(f"Failed to delete user: {str(e)}")
const axios = require('axios');
async function deleteUser(apiKey, userId) {
try {
await axios.delete(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: {
'X-API-KEY': apiKey
}
}
);
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
if (error.response?.status === 422) {
throw new Error(error.response.data.message || 'Cannot process request');
}
throw error;
}
}
// Example usage
deleteUser('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(() => console.log('User deleted successfully'))
.catch(error => console.error('Failed to delete user:', error.message));
{
"status": 404,
"message": "Not found"
}
{
"status": 422,
"message": "You should block users before deleting them"
}
Was this page helpful?
⌘I