SuperAI Flow Platform

Sections

Theme switcher

Delete organization

Permanently delete an organization and all associated data.

This endpoint performs a hard delete of the organization and ALL related entities including users, flows, executions, and task data. This operation is IRREVERSIBLE. For temporary deactivation, use PATCH /deactivate instead.

Context: - HARD DELETE: Data is permanently removed from database - Cascades to all related entities (users, flows, executions, tasks) - Cannot be undone - use with extreme caution - Recommended to deactivate first and delete only after confirmation - Running workflows may fail if organization is deleted - For data retention compliance, consider soft delete via deactivate - No response body returned (204 No Content status)

Behavior: 1. Validates organization exists by ID 2. Checks for foreign key constraints 3. Deletes all related entities in order: - User records - Flow definitions - Flow executions - Task outputs - Task statuses 4. Deletes organization record 5. Returns 204 No Content Use Cases: - Remove test/sandbox organizations after development - Comply with GDPR "right to be forgotten" requests - Clean up organizations created by mistake - Decommission organizations with no production data - Automated cleanup of expired trial organizations

Safer Alternative: For reversible deactivation, use: PATCH /admin/organizations/{id}/deactivate

Related Endpoints: - PATCH /admin/organizations/{id}/deactivate - Soft deactivation (recommended) - GET /admin/organizations/{id} - Verify organization before deletion - GET /admin/organizations/{id}/users/count - Check user count before delete

Header Parameters

Authorizationstring

Path Parameters

organization_idstring Required

Unique identifier of the organization to delete. Organization must exist and all deletion constraints must be satisfied.

Response

204
Object
Organization deleted successfully
400
Object
Invalid UUID format or organization has dependencies

Response Attributes

errorobject Required

Standard error detail structure.

This model matches the error format returned by the centralized exception handlers in app/api/errors/handlers.py.

Show child attributes

request_idnull
403
Object
Forbidden - Insufficient permissions to access this resource

Response Attributes

errorobject Required

Standard error detail structure.

This model matches the error format returned by the centralized exception handlers in app/api/errors/handlers.py.

Show child attributes

request_idnull
404
Object
Organization not found

Response Attributes

errorobject Required

Standard error detail structure.

This model matches the error format returned by the centralized exception handlers in app/api/errors/handlers.py.

Show child attributes

request_idnull
422
Object
Validation Error

Response Attributes

detailarray

Show child attributes

500
Object
Internal Server Error - An unexpected error occurred

Response Attributes

errorobject Required

Standard error detail structure.

This model matches the error format returned by the centralized exception handlers in app/api/errors/handlers.py.

Show child attributes

request_idnull
Was this section helpful?

What made this section unhelpful for you?

DELETE

/

Select
1

Response

Was this section helpful?

What made this section unhelpful for you?

View as Markdown

Ask an AI

Open in ChatGPTOpen in ClaudeOpen in Perplexity

Code with AI

Open in Copilot