curl -X DELETE 'https://api.weir.ai/org/team/team_123456789' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"message": "Team deleted successfully",
"status": "success"
}
Delete a team from your organization
curl -X DELETE 'https://api.weir.ai/org/team/team_123456789' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"message": "Team deleted successfully",
"status": "success"
}
curl -X DELETE 'https://api.weir.ai/org/team/team_123456789' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'x-source: console'
{
"message": "Team deleted successfully",
"status": "success"
}
x-source: console header.
404 Not Found
{
"error": {
"code": "TEAM_NOT_FOUND",
"message": "Team not found",
"details": "The specified team does not exist or you do not have access"
},
"status": "error"
}
403 Forbidden
{
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "Insufficient permissions",
"details": "You do not have permission to delete this team"
},
"status": "error"
}
const deleteTeam = async (teamId, accessToken) => {
try {
const response = await fetch(`https://api.weir.ai/org/team/${teamId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${accessToken}`,
'x-source': 'console'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Delete team error:', error);
throw error;
}
};
// Usage with confirmation
if (confirm('Are you sure you want to delete this team?')) {
await deleteTeam('team_123456789', 'your_access_token');
console.log('Team deleted successfully');
}
Was this page helpful?