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

# Delete a principal

> Delete a principal, revoking every key it owns plus its policy row (admin only).

Refused (409) when a login-attaching accounts provider owns the principal's login — that
provider's users door deletes it and cleans the login row. A principal no attaching
provider claims (service, OIDC-provisioned human, keys-only owner) is deleted here;
deleting the last enabled admin principal is refused (409) behind the store's
advisory-locked guard. A missing principal is a 404.



## OpenAPI

````yaml /openapi.json delete /api/auth/principals/{user_id}
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 18.0.1
servers: []
security: []
paths:
  /api/auth/principals/{user_id}:
    delete:
      tags:
        - access-control
      summary: Delete a principal
      description: >-
        Delete a principal, revoking every key it owns plus its policy row
        (admin only).


        Refused (409) when a login-attaching accounts provider owns the
        principal's login — that

        provider's users door deletes it and cleans the login row. A principal
        no attaching

        provider claims (service, OIDC-provisioned human, keys-only owner) is
        deleted here;

        deleting the last enabled admin principal is refused (409) behind the
        store's

        advisory-locked guard. A missing principal is a 404.
      operationId: delete_api_auth_principals_user_id
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/PrincipalDeleted'
                required:
                  - data
                type: object
          description: Success.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Conflict with the current resource state.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PrincipalDeleted:
      description: Acknowledges a principal deletion.
      properties:
        deleted:
          title: Deleted
          type: boolean
        user_id:
          title: User Id
          type: string
      required:
        - user_id
        - deleted
      title: PrincipalDeleted
      type: object
    Error:
      properties:
        code:
          description: >-
            Stable machine-readable reason a client keys a dedicated error state
            on, present on refusals that opt in (e.g. a 501 not-configured
            refusal). Optional: absent when the error carries only a
            human-readable message.
          type: string
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````