curl --request DELETE \
--url 'https://YOURSITE.konstantly.ai/api/v1/groups/123/users/emp-1042' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstantly.ai/api/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "emp-1042"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstantly.ai/api/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstantly.ai/api/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 204;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
(empty body)
{
"status": 404,
"message": "User not found"
}
Groups
Remove User from Group
Remove a user from a group
DELETE
/
groups
/
{groupId}
/
users
/
{userId}
curl --request DELETE \
--url 'https://YOURSITE.konstantly.ai/api/v1/groups/123/users/emp-1042' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstantly.ai/api/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "emp-1042"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstantly.ai/api/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstantly.ai/api/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 204;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
(empty body)
{
"status": 404,
"message": "User not found"
}
Remove a specific user from a group. If the user is not a member, the request still succeeds.
Request Headers
URL Parameters
The Konstantly user ID, or your own user ID set when the user was created (see User IDs).
Response
On success the endpoint returns204 No Content with an empty body.
Error Responses
curl --request DELETE \
--url 'https://YOURSITE.konstantly.ai/api/v1/groups/123/users/emp-1042' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def remove_user_from_group(api_key: str, group_id: int, user_id: str) -> bool:
url = f"https://YOURSITE.konstantly.ai/api/v1/groups/{group_id}/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.delete(url, headers=headers)
if response.status_code == 404:
raise ValueError("Group or user not found")
response.raise_for_status()
return True
# Example usage
try:
if remove_user_from_group("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", 123, "emp-1042"):
print("User removed from group successfully")
except Exception as e:
print(f"Failed to remove user from group: {str(e)}")
const axios = require('axios');
async function removeUserFromGroup(apiKey, groupId, userId) {
try {
await axios.delete(
`https://YOURSITE.konstantly.ai/api/v1/groups/${groupId}/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return true;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Group or user not found');
}
throw error;
}
}
// Example usage
removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')
.then(() => console.log('User removed from group successfully'))
.catch(error => console.error('Failed:', error.message));
<?php
function removeUserFromGroup($apiKey, $groupId, $userId) {
$ch = curl_init();
$url = "https://YOURSITE.konstantly.ai/api/v1/groups/{$groupId}/users/{$userId}";
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-KEY: ' . $apiKey
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
throw new Exception('Error: ' . curl_error($ch));
}
curl_close($ch);
if ($httpCode === 404) {
throw new Exception("Group or user not found");
}
return $httpCode === 204;
}
// Example usage
try {
if (removeUserFromGroup('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', 123, 'emp-1042')) {
echo "User removed from group successfully\n";
}
} catch (Exception $e) {
echo "Failed to remove user from group: " . $e->getMessage() . "\n";
}
?>
(empty body)
{
"status": 404,
"message": "User not found"
}
Was this page helpful?