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

# Delete user

> Removes a user from the given organization. The user is marked as deleted and is no longer listed. It is also removed from the organization's administrators, approvers and reminder receivers, its vehicles are removed from the organization's fleet account, and any pending invitation to the organization for the user's email address is withdrawn. The person behind the user keeps their users in other organizations.

When the organization requires a minimum number of users with the PRO license, its last PRO users can only be deleted when no other users remain; deleting one of them otherwise returns 403 with the code `USER_CAN_NOT_BE_DELETED`. When the organization is read-only, no user can be deleted and the request returns 403 with the code `ORGANIZATION_READ_ONLY`.

Returns 403 when the organization does not exist or the authenticated user is not an administrator of it, so a caller cannot tell an organization they lack access to from a missing one. Also returns 403 when the organization has no user with the given ID, including a user that is already deleted.




## OpenAPI

````yaml /openapi/findity-admin-api.json delete /organizations/{organizationId}/users/{userId}
openapi: 3.1.0
info:
  title: Findity Admin API
  description: Findity Admin API
  version: 1.0.0
servers:
  - url: https://stage-api.findity.com/api/v1/admin
  - url: https://api.findity.com/api/v1/admin
security:
  - bearerAuth: []
paths:
  /organizations/{organizationId}/users/{userId}:
    delete:
      tags:
        - Users
      summary: Delete user
      description: >
        Removes a user from the given organization. The user is marked as
        deleted and is no longer listed. It is also removed from the
        organization's administrators, approvers and reminder receivers, its
        vehicles are removed from the organization's fleet account, and any
        pending invitation to the organization for the user's email address is
        withdrawn. The person behind the user keeps their users in other
        organizations.


        When the organization requires a minimum number of users with the PRO
        license, its last PRO users can only be deleted when no other users
        remain; deleting one of them otherwise returns 403 with the code
        `USER_CAN_NOT_BE_DELETED`. When the organization is read-only, no user
        can be deleted and the request returns 403 with the code
        `ORGANIZATION_READ_ONLY`.


        Returns 403 when the organization does not exist or the authenticated
        user is not an administrator of it, so a caller cannot tell an
        organization they lack access to from a missing one. Also returns 403
        when the organization has no user with the given ID, including a user
        that is already deleted.
      operationId: adminDeleteOrganizationUser
      parameters:
        - name: organizationId
          in: path
          required: true
          description: >
            Required. String. Identifies the organization the user is deleted
            from. Accepts either the organization's internal ID (32-character
            hexadecimal string) or its `externalSourceId` (the string an
            integration set on the organization). This endpoint supports
            externalId: when the value has the format of an internal ID and an
            organization with that ID exists, the internal ID takes precedence;
            otherwise the value is looked up as `externalSourceId`.
          schema:
            type: string
          example: 11adfe2a080040e3892ffb89c21ec44e
        - name: userId
          in: path
          required: true
          description: >
            Required. String. Identifies the user to delete, as returned in the
            `id` or `externalSourceId` field of the list response: either the
            user's internal ID (32-character hexadecimal string) or its
            `externalSourceId` (the non-empty string an integration set on the
            user). Only the users of the given organization are searched. This
            endpoint supports externalId: when a user of the organization has
            that internal ID, the internal ID takes precedence; otherwise the
            value is looked up as `externalSourceId`.
          schema:
            type: string
          example: 8a6c2f0e5b1d4c7f9e3a2b1c0d9e8f7a
      responses:
        '204':
          description: No Content — the user was deleted
        '403':
          description: >
            Forbidden — the organization was not found or access is denied, the
            organization has no user with the given ID (also when the user is
            already deleted), the user is one of the organization's last
            required PRO users (code `USER_CAN_NOT_BE_DELETED`), or the
            organization is read-only (code `ORGANIZATION_READ_ONLY`)
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/403Error'
                  - type: object
                    properties:
                      code:
                        type: string
                        description: >
                          Only present when the user is one of the
                          organization's last required PRO users
                          (`USER_CAN_NOT_BE_DELETED`) or the organization is
                          read-only (`ORGANIZATION_READ_ONLY`).
                        enum:
                          - USER_CAN_NOT_BE_DELETED
                          - ORGANIZATION_READ_ONLY
              examples:
                Organization not found or access denied:
                  value:
                    result: error
                    description: Organization not found or access denied
                User not found or access denied:
                  value:
                    result: error
                    description: User not found or access denied
                Last PRO user:
                  value:
                    result: error
                    code: USER_CAN_NOT_BE_DELETED
                    description: >-
                      Organizations must have at least one user with Fastpris
                      (PRO) license
                Organization read-only:
                  value:
                    result: error
                    code: ORGANIZATION_READ_ONLY
                    description: Settings are readonly for this organization
components:
  schemas:
    403Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        description: Not allowed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````