Overview

The delete_organization function permanently deletes an organization from the system.

Function Signature

pub async fn delete_organization(organization_id: &str) -> Result<()>

Parameters

organization_id
&str
required
The unique identifier of the organization to delete

Return Value

Returns Result<()> indicating success or failure.

Basic Usage

use wacht::api::organizations::*;

delete_organization("52057194421551105").await?;
println!("Organization deleted successfully");

Error Handling

match delete_organization("52057194421551105").await {
    Ok(()) => {
        println!("Organization deleted successfully");
    }
    Err(Error::Api { status, message, .. }) => {
        match status.as_u16() {
            404 => println!("Organization not found"),
            403 => println!("Access denied: {}", message),
            409 => println!("Cannot delete organization with active members: {}", message),
            _ => println!("API error {}: {}", status, message),
        }
    }
    Err(e) => println!("Request failed: {}", e),
}

Important Notes

  • This operation is irreversible
  • All organization data including members, roles, and workspaces will be deleted
  • You must be an organization owner to delete an organization
  • Organizations with active members cannot be deleted unless all members are removed first

Rate Limits

  • Delete operations: 20 requests per minute
  • Burst limit: 5 requests per second