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

# Delete a Security Groups

> Deletes a security group and all its associated rules.

**Note:** A security group cannot be deleted if it is currently attached to any resources.




## OpenAPI

````yaml DELETE /api/v1/accounts/{accountId}/projects/{projectId}/security-groups/{securityGroupId}
openapi: 3.0.3
info:
  title: AION Firewall (Security Groups) API
  description: >
    API for managing firewall security groups and rules in AION Cloud Platform.


    Security groups act as virtual firewalls that control inbound and outbound
    traffic 

    for resources within a project.
  version: 1.0.0
  contact:
    name: AION Platform Team
    email: platform@aion.xyz
servers:
  - url: https://api.aion.xyz
    description: Production
  - url: https://api.staging.aion.xyz
    description: Staging
  - url: http://localhost:8080
    description: Local Development
security:
  - BearerAuth: []
tags:
  - name: Security Groups
    description: Firewall security group management
paths:
  /api/v1/accounts/{accountId}/projects/{projectId}/security-groups/{securityGroupId}:
    delete:
      tags:
        - Security Groups
      summary: Delete a security group
      description: >
        Deletes a security group and all its associated rules.


        **Note:** A security group cannot be deleted if it is currently attached
        to any resources.
      operationId: deleteSecurityGroup
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/SecurityGroupId'
        - $ref: '#/components/parameters/XAccountId'
        - $ref: '#/components/parameters/XUserId'
        - $ref: '#/components/parameters/XRequestId'
      responses:
        '200':
          description: Security group deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteSecurityGroupResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Conflict - Security group is in use
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    AccountId:
      name: accountId
      in: path
      required: true
      description: Account external ID
      schema:
        type: string
        pattern: ^acct-[a-zA-Z0-9]+-v1$
      example: acct-abc123xyz-v1
    ProjectId:
      name: projectId
      in: path
      required: true
      description: Project external ID
      schema:
        type: string
        pattern: ^proj-[a-zA-Z0-9]+-v1$
      example: proj-def456uvw-v1
    SecurityGroupId:
      name: securityGroupId
      in: path
      required: true
      description: Security group external ID
      schema:
        type: string
        pattern: ^sg-[a-zA-Z0-9]+-v1$
      example: sg-ghi789rst-v1
    XAccountId:
      name: x-account-id
      in: header
      description: Account ID from authentication (must match path accountId)
      schema:
        type: string
    XUserId:
      name: x-user-id
      in: header
      description: User ID performing the action
      schema:
        type: string
    XRequestId:
      name: X-Request-ID
      in: header
      description: Unique request ID for tracing
      schema:
        type: string
  schemas:
    DeleteSecurityGroupResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Security group deleted successfully
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        code:
          type: string
          description: Error code
        details:
          type: object
          description: Additional error details
  responses:
    BadRequest:
      description: Bad request - Invalid input parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: 'Validation failed: name is required'
            code: BAD_REQUEST
    Unauthorized:
      description: Unauthorized - Authentication required or account mismatch
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: account_id mismatch between header and path
            code: UNAUTHORIZED
    NotFound:
      description: Not found - Resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Security group not found
            code: NOT_FOUND
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Internal server error
            code: INTERNAL_ERROR
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token from authentication service

````