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

# Delete Collection

> Delete collection and drop its physical table.

Uses a two-phase approach to avoid transaction deadlocks on PostgreSQL:
1. Prepare deletion and generate migration (read-only)
2. Close session and apply migration (no locks held)
3. Delete collection record in new session

Only superadmins (users in the system account) can delete collections.



## OpenAPI

````yaml delete /api/v1/collections/{collection_id}
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/collections/{collection_id}:
    delete:
      tags:
        - collections
      summary: Delete Collection
      description: |-
        Delete collection and drop its physical table.

        Uses a two-phase approach to avoid transaction deadlocks on PostgreSQL:
        1. Prepare deletion and generate migration (read-only)
        2. Close session and apply migration (no locks held)
        3. Delete collection record in new session

        Only superadmins (users in the system account) can delete collections.
      operationId: delete_collection_api_v1_collections__collection_id__delete
      parameters:
        - name: collection_id
          in: path
          required: true
          schema:
            type: string
            title: Collection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '403':
          description: Superadmin access required
        '404':
          description: Collection not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````