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

# Delete Users

> Remove Users from an Organization or a Document.

Use this API to remove Users from:

1. **Organization:** This will remove their access from all the documents and data in the organization. It will also remove these users from the contact list of the organization.
2. **Document:** This will remove their access from the specified document. It will also remove these users from the contact list of the document. If you pass the `documentId`, then the users will be removed from the document.

# Endpoint

`POST https://api.velt.dev/v1/users/delete`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string">
      Document IDs. Provide this if you want to delete users from a specific document.
    </ParamField>

    <ParamField body="folderId" type="string">
      Folder ID. Either provide `documentId` or `folderId`.
    </ParamField>

    <ParamField body="userIds" type="string[]" required>
      Array of user Ids.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Delete users in a specific organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "userIds": [
      "yourUserId1"
    ]
  }
}
```

#### 2. Delete users in a specific document within an organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "userIds": [
      "yourUserId1"
    ]
  }
}
```

#### 3. Delete users in a specific folder within an organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "folderId": "yourFolderId",
    "userIds": [
      "yourUserId1"
    ]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "User(s) deleted successfully.",
    "data": {
      "yourUserId1": {
        "success": true,
        "message": "User removed."
      }
    }
  }
}
```

#### User(s) Not Found

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "User(s) deleted successfully.",
    "data": {
      "yourUserId1": {
        "success": true,
        "message": "User removed."
      },
      {
      "yourUserId2": {
        "success": false,
        "message": "User does not exist."
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "User(s) deleted successfully.",
      "data": {
        "yourUserId1": {
          "success": true,
          "message": "User removed."
        }
      }
    }
  }
  ```
</ResponseExample>
