> ## Documentation Index
> Fetch the complete documentation index at: https://docs.timbrix.mx/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Organization

> ⚠️ SECURITY: Only the organization OWNER can delete the organization. This action is PERMANENT and cannot be undone. All members, invites, and data will be deleted.

Permanently deletes an organization and all associated data.

## Authentication

This endpoint requires authentication via Bearer token:

* **Authorization**: `Bearer <token>`

## ⚠️ Security Warning

**Only the organization OWNER can delete the organization.**

This is a **destructive action** that **cannot be undone**. All data will be permanently removed.

## Path Parameters

| Parameter | Type   | Required | Description       |
| --------- | ------ | -------- | ----------------- |
| `id`      | string | Yes      | Organization UUID |

## What Gets Deleted

When an organization is deleted, the following data is also permanently removed:

### Organization Data

* Organization profile and settings
* All organization members
* All pending invitations

### API Resources

* All OAuth applications and tokens
* All webhooks and delivery history
* All API keys

### Billing Data

* Stripe subscription (will be cancelled)
* Billing history is preserved in Stripe

This is enforced through database **CASCADE constraints** to ensure data integrity.

## Example Request

```bash theme={null}
curl -X DELETE http://localhost:3001/api/organizations/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer <your_token>"
```

## Example Response

```
Status: 204 No Content
```

A successful deletion returns no response body, only a 204 status code.

## Common Errors

### 403 Forbidden

Only the owner can delete the organization.

```json theme={null}
{
  "statusCode": 403,
  "message": "Access denied. Only the organization owner can delete the organization"
}
```

### 404 Not Found

The organization with the specified ID does not exist.

```json theme={null}
{
  "statusCode": 404,
  "message": "Organization not found"
}
```

## Before You Delete

**Important considerations:**

1. **Export your data** - There is no way to recover deleted data
2. **Cancel subscriptions** - Stripe subscription will be cancelled automatically
3. **Notify team members** - Members will lose access immediately
4. **Backup API keys** - All API keys will stop working
5. **Save webhooks** - Webhook URLs and settings will be lost

## Alternative: Archive Instead

Consider implementing an **archive** feature instead of permanent deletion:

* Preserve historical data
* Maintain audit trails
* Allow potential restoration
* Keep billing records

Contact support if you need to archive instead of delete.


## OpenAPI

````yaml DELETE /organizations/{id}
openapi: 3.1.0
info:
  title: Timbrix API
  description: >-
    REST API with OAuth2 server for managing organizations, members, and
    webhooks
  version: '1.0'
  contact: {}
servers:
  - url: http://sandbox.mintlify.com
    description: Sandbox environment
  - url: http://localhost:3001/api
    description: Local development
security: []
tags:
  - name: organizations
    description: Organization management endpoints
  - name: oauth
    description: OAuth2 authentication and authorization
  - name: webhooks
    description: Webhook configuration and delivery
  - name: users
    description: User information endpoints
  - name: api-keys
    description: API Keys management and validation
paths:
  /organizations/{id}:
    delete:
      tags:
        - organizations
      summary: Delete organization (owner only)
      description: >-
        ⚠️ SECURITY: Only the organization OWNER can delete the organization.
        This action is PERMANENT and cannot be undone. All members, invites, and
        data will be deleted.
      operationId: OrganizationsController_delete
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: Organization deleted permanently. All associated data removed.
        '401':
          description: Authentication required. Provide a valid bearer token.
        '403':
          description: >-
            Access denied. Only the organization owner can delete the
            organization.
        '404':
          description: Organization not found with the provided ID.
      security:
        - bearer: []
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````