> This documentation belongs to Invofox, an AI-powered document processing
> platform. The API extracts structured data (fields) from unstructured
> documents (invoices, contracts, forms, bank statements, and more).
> Key concepts: Account, Environment, Document Type, Field, File, Import,
> and Document. When answering, prefer the exact terminology defined in the
> Glossary and cite the relevant API Reference endpoint when applicable.

# Delete a list of users.

DELETE https://api.invofox.com/users
Content-Type: application/json

Reference: https://developers.invofox.com/api-reference/main-reference/users/delete-a-list-of-users

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Request

### Query parameters

- `account` (string, required)
- `ids` (list of string, required)

### Body (application/json)

This endpoint expects an object.

- `preview` (boolean, optional) — Whether to preview the changes or not

## Response

### 200

Preview of the changes.

- `result` (UsersDeleteResponsesContentApplicationJsonSchemaResult, optional)

## Errors

### 400 Bad Request Error

There was an issue deleting the users.

- `status` (double, optional)
- `code` (enum, optional)
  - Allowed values: `ERR_SOME_USERS_CANNOT_BE_DELETED`
- `message` (string, optional)

### 500 Internal Server Error

Unkown server error

- `code` (string, optional)

## Types

### UsersDeleteResponsesContentApplicationJsonSchemaResult

- `valid` (list of UsersDeleteResponsesContentApplicationJsonSchemaResultValidItems, optional)
- `error` (list of UsersDeleteResponsesContentApplicationJsonSchemaResultErrorItems, optional)
- `warning` (list of UsersDeleteResponsesContentApplicationJsonSchemaResultWarningItems, optional)

### UsersDeleteResponsesContentApplicationJsonSchemaResultValidItems

- `item` (User, optional)

### UsersDeleteResponsesContentApplicationJsonSchemaResultErrorItems

- `item` (User, optional)
- `reason` (enum, optional)
  - Allowed values: `ERR_USER_CANNOT_DELETE_ITSELF`, `ERR_USER_ALREADY_DELETED`

### UsersDeleteResponsesContentApplicationJsonSchemaResultWarningItems

- `item` (User, optional)
- `reason` (enum, optional)
  - Allowed values: `WARN_USER_HAS_LOCKED_DOCUMENTS`

### User

- `_id` (string, optional)
- `account` (string, optional)
- `creator` (string, optional)
- `name` (string, optional)
- `email` (string, optional)
- `lang` (string, optional)
- `creation` (string, optional)
- `securityGroups` (list of string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "result": {
    "valid": [
      {
        "item": {
          "_id": "28b05b800123456789000000",
          "account": "28b05b800123456789000000",
          "creator": "28b05b800123456789000000",
          "name": "John Doe",
          "email": "john.doe@example.com",
          "lang": "en",
          "creation": "2024-01-15T09:30:00Z",
          "securityGroups": [
            "28b05b800123456789000000"
          ]
        }
      }
    ],
    "error": [
      {
        "item": {
          "_id": "28b05b800123456789000000",
          "account": "28b05b800123456789000000",
          "creator": "28b05b800123456789000000",
          "name": "John Doe",
          "email": "john.doe@example.com",
          "lang": "en",
          "creation": "2024-01-15T09:30:00Z",
          "securityGroups": [
            "28b05b800123456789000000"
          ]
        },
        "reason": "ERR_USER_CANNOT_DELETE_ITSELF"
      }
    ],
    "warning": [
      {
        "item": {
          "_id": "28b05b800123456789000000",
          "account": "28b05b800123456789000000",
          "creator": "28b05b800123456789000000",
          "name": "John Doe",
          "email": "john.doe@example.com",
          "lang": "en",
          "creation": "2024-01-15T09:30:00Z",
          "securityGroups": [
            "28b05b800123456789000000"
          ]
        },
        "reason": "WARN_USER_HAS_LOCKED_DOCUMENTS"
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.invofox.com/users"

querystring = {"account":"28b05b800123456789000000","ids":"[\"28b05b800123456789000000\"]"}

payload = {}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D';
const options = {
  method: 'DELETE',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D");
var request = new RestRequest(Method.DELETE);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.invofox.com/users?account=28b05b800123456789000000&ids=%5B%2228b05b800123456789000000%22%5D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```