> ## 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 or close organization (owner only)

> ⚠️ SECURITY: Only the organization OWNER can perform this action. If the organization has never stamped a production CFDI, it is deleted PERMANENTLY (sandbox invoices included). If it has production CFDI, it is CLOSED instead: it becomes read-only, its CFDI are retained and downloadable until `retainedUntil`, API keys, webhooks and OAuth apps are deactivated, and the Stripe subscription is set to cancel at the end of the paid period (no refunds). Closing an already-closed organization returns the existing close. Use `GET /organizations/:id/close-preview` to know which will happen.



## OpenAPI

````yaml https://api.timbrix.mx/api/openapi.json delete /organizations/{id}
openapi: 3.0.0
info:
  title: Timbrix API
  description: >-
    API de facturación electrónica CFDI 4.0 para México, con servidor OAuth2
    para gestionar organizaciones, miembros y webhooks. Compatible con agentes
    de IA — ver la extensión `x-ai-agent-friendly` en la raíz de esta spec.


    REST API with OAuth2 server for managing organizations, members, and
    webhooks.
  version: '1.0'
  contact: {}
servers: []
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
  - name: request-logs
    description: API request log
paths:
  /organizations/{id}:
    delete:
      tags:
        - organizations
      summary: Delete or close organization (owner only)
      description: >-
        ⚠️ SECURITY: Only the organization OWNER can perform this action. If the
        organization has never stamped a production CFDI, it is deleted
        PERMANENTLY (sandbox invoices included). If it has production CFDI, it
        is CLOSED instead: it becomes read-only, its CFDI are retained and
        downloadable until `retainedUntil`, API keys, webhooks and OAuth apps
        are deactivated, and the Stripe subscription is set to cancel at the end
        of the paid period (no refunds). Closing an already-closed organization
        returns the existing close. Use `GET /organizations/:id/close-preview`
        to know which will happen.
      operationId: OrganizationsController_delete
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: >-
            `{ status: 'deleted' }` when deleted permanently, or `{ status:
            'closed', closedAt, retainedUntil }` when closed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteOrganizationResponseDto'
        '401':
          description: Authentication required. Provide a valid bearer token.
        '403':
          description: >-
            Access denied. Only the organization owner can delete or close the
            organization.
        '404':
          description: Organization not found with the provided ID.
        '409':
          description: >-
            ORGANIZATION_HAS_PENDING_OPERATIONS: a CFDI stamp or a cancellation
            is still in progress. Try again once it is resolved.
      security:
        - bearer: []
components:
  schemas:
    DeleteOrganizationResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - deleted
            - closed
          example: closed
          description: >-
            `deleted`: the organization had no production CFDI and was
            permanently deleted. `closed`: it has production CFDI, so it was
            closed (read-only) and its CFDI are retained.
        closedAt:
          type: string
          example: '2026-10-23T16:00:00.000Z'
          description: Present when `status` is `closed`.
        retainedUntil:
          type: string
          example: '2033-01-01T05:59:59.000Z'
          description: >-
            Present when `status` is `closed`: CFDI are retained and
            downloadable until this date.
      required:
        - status
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.