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

# Delete an organization

> Deletes an organization.
- Allowed only if the organization has no users.
- Only the `organization owner` can access the API.
- The owner account will also be deleted.



## OpenAPI

````yaml /api-spec/ias-public-api.yaml delete /organizations/{orgId}
openapi: 3.0.3
info:
  title: IAM Service API
  description: APIs for IAM Service.
  version: 2.4.0
servers:
  - url: https://console.gmicloud.ai/api/v1
    description: IAM Service API
security: []
paths:
  /organizations/{orgId}:
    delete:
      tags:
        - organizations
      summary: Delete an organization
      description: |-
        Deletes an organization.
        - Allowed only if the organization has no users.
        - Only the `organization owner` can access the API.
        - The owner account will also be deleted.
      operationId: deleteOrganization
      parameters:
        - $ref: '#/components/parameters/orgIdParam'
      responses:
        '200':
          description: Successfully deleted the organization.
        '400':
          description: |
            - [group:**request**, code:**0**]: Invalid field in the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Invalid field in the request:
                  summary: Invalid field in the request.
                  value:
                    group: request
                    code: 0
                    validationDetail:
                      - field: orgId
                        expression: uuid
                        originalValue: ''
                        reason: Should be a valid UUID.
        '409':
          description: >
            - [group:**organization**, code:**10**]: Organization cannot be
            deleted because it still has users.

            - [group:**organization**, code:**11**]: Organization cannot be
            deleted because it still has resources.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Organization cannot be deleted because it still has users:
                  summary: Organization cannot be deleted because it still has users.
                  value:
                    group: organization
                    code: 10
                    message: Organization cannot be deleted because it still has users.
        '500':
          description: >
            - [group:**invitation**, code:**202**]: Delete invitation
            encountered error.

            - [group:**organization**, code:**12**]: Organization resource check
            encounter error.

            - [group:**organization**, code:**1200**]: Get organization grouping
            policy encountered error.

            - [group:**organization**, code:**1201**]: Get organization
            encountered DB error.

            - [group:**organization**, code:**1601**]: Delete organization
            encountered DB error.

            - [group:**session**, code:**5**]: Failed to delete session.

            - [group:**user**, code:**210**]: Delete user password reset data
            encountered error.

            - [group:**user**, code:**1200**]: Get user encountered DB error.

            - [group:**user**, code:**1600**]: Delete user data encountered DB
            error.

            - [group:**workflow**, code:**1200**]: Get workflows encountered
            error.

            - [group:**workflow**, code:**1400**]: Send signal to workflow
            encountered error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrStatusMsg'
              examples:
                Get organization grouping policy encountered error:
                  summary: Get organization grouping policy encountered error.
                  value:
                    group: organization
                    code: 1200
                    message: Get organization grouping policy encountered error.
                    traces:
                      - error occurred.
      security:
        - bearerAuth: []
components:
  parameters:
    orgIdParam:
      name: orgId
      in: path
      schema:
        type: string
        format: uuid
        x-go-type: uuid.UUID
        example: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
      required: true
      description: |
        The organization's ID.
        - Must be a valid UUID.
  schemas:
    ErrStatusMsg:
      type: object
      properties:
        group:
          type: string
          description: >-
            API function group\n -Will be "request" if there are invalid request
            parameters.
          x-oapi-codegen-extra-tags:
            binding: required
        code:
          type: integer
          description: The substatus error code for the API response.
          x-oapi-codegen-extra-tags:
            binding: required
        message:
          type: string
          description: The substatus error Message for API response.
          x-go-type-skip-optional-pointer: true
        traces:
          type: array
          items:
            type: string
          description: The original error messages.
          x-go-type-skip-optional-pointer: true
        validationDetail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationDetail'
          description: >-
            Returned when there are invalid request
            paremeters(group="request")\n List of invalid fields and the reason
            of error.
          x-go-type-skip-optional-pointer: true
      example:
        group: request
        code: 0
        validationDetail:
          - field: email
            expression: required
            originalValue: ''
            reason: This field is required.
      required:
        - group
        - code
    ValidationDetail:
      type: object
      properties:
        field:
          type: string
          description: The field of the request data.
          x-go-type-skip-optional-pointer: true
        expression:
          type: string
          description: The form of violation.
          x-go-type-skip-optional-pointer: true
        argument:
          type: string
          description: The number or data to support the expression.
          x-go-type-skip-optional-pointer: true
        originalValue:
          description: The original value from the request.
          x-go-type-skip-optional-pointer: true
        reason:
          type: string
          description: The reason for the validation error.
          x-go-type-skip-optional-pointer: true
      example:
        - field: fieldXXX
          expression: required
          originalValue: ''
          reason: This field is required.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        An access token used to authenticate a user and grant access to
        restricted APIs. It is issued by session APIs.

        For status codes related to this header, refer to the 

        [Common Headers
        Documentation](https://gmicloud.atlassian.net/wiki/spaces/CE/pages/47199534/Common+Headers#Authorization).

````