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

# Bulk Delete

> Delete multiple employees by their IDs

# Bulk Delete

Delete multiple employees by their IDs in a single request. Progress is tracked via a processing job and real-time Redis notifications.

All employees must belong to the requesting organization. Employees from other organizations will be reported as failed in the response.

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Body Parameters

<ParamField body="employee_ids" type="string[]" required>
  List of employee UUIDs to delete (1–100,000)
</ParamField>

## Response

<ResponseField name="total" type="integer">
  Total number of employees processed
</ResponseField>

<ResponseField name="success" type="integer">
  Number of employees successfully deleted
</ResponseField>

<ResponseField name="failed" type="integer">
  Number of employees that failed to delete
</ResponseField>

<ResponseField name="errors" type="array[object]">
  Details of failed deletions
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST "https://api.dcycle.io/v2/employees/bulk-delete" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}" \
    -H "Content-Type: application/json" \
    -d '{
      "employee_ids": ["emp-uuid-1", "emp-uuid-2", "emp-uuid-3"]
    }'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  response = requests.post(
      "https://api.dcycle.io/v2/employees/bulk-delete",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
          "Content-Type": "application/json",
      },
      json={
          "employee_ids": ["emp-uuid-1", "emp-uuid-2", "emp-uuid-3"],
      },
  )

  result = response.json()
  print(f"Deleted {result['success']}/{result['total']} employees")
  if result["failed"] > 0:
      print(f"Failed: {result['failed']}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const { data } = await axios.post(
    'https://api.dcycle.io/v2/employees/bulk-delete',
    {
      employee_ids: ['emp-uuid-1', 'emp-uuid-2', 'emp-uuid-3'],
    },
    {
      headers: {
        'x-api-key': process.env.DCYCLE_API_KEY,
        'x-organization-id': process.env.DCYCLE_ORG_ID,
        'Content-Type': 'application/json',
      },
    }
  );

  console.log(`Deleted ${data.success}/${data.total} employees`);
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "total": 3,
  "success": 3,
  "failed": 0,
  "errors": []
}
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 422 Unprocessable Entity

**Cause:** Empty or invalid employee\_ids array

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["body", "employee_ids"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Bulk Delete by Filters" icon="filter" href="/api-reference/employees/bulk-delete-by-filters">
    Delete all employees matching filter criteria
  </Card>

  <Card title="Delete Employee" icon="trash" href="/api-reference/employees/delete">
    Delete a single employee
  </Card>
</CardGroup>
