> For the complete documentation index, see [llms.txt](https://docs.samesystem.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.samesystem.dev/business-guides/employee-lifecycle-management/terminate-employees/delete-employee.md).

# Delete employee

{% hint style="info" %}
**Note:** Users can also be deleted using **API v1**. However, for user and contract integrations, we strongly recommend using **API v2**, and this guide therefore describes user deletions using API v2 only.

If you need to delete users using API v1, please refer to the [**API v1 OpenAPI specification**](https://docs.samesystem.dev/api-v1-reference/) for the available endpoint, request parameters, and data model.
{% endhint %}

There is an API endpoint for deleting a user. Using this endpoint will permanently remove the user and all associated data, including schedules, logs, files, and historical records.

When the delete endpoint is called, the user is immediately disabled, and the system schedules a background job to permanently destroy the user after 24 hours. During this 24-hour window, the user can still be restored. A user can only be restored by a supervisor in SameSystem.

**When should you delete a user?**

Only delete a user if:

* [x] data import was unsuccessful due to invalid data and re-importing the data would be easier than correcting it.\
  In these cases, deleting the user and importing the data again is the recommended approach.
* [x] you need to cancel a future hire.

If you need to remove a user due to termination of a contract, the recommended method is to terminate a user. Termination preserves all user data in the system and allows you to rehire the user later or review their historical information.

You will have this option to delete a user:

<details>

<summary>Delete a user</summary>

To delete a user and all the user data in a single call, the following endpoint can be used:

DELETE /{clientToken}/users/{id}

The parameter `{id}` is the unique id number of the user in SameSystem. The value is present in the user object: `user.id`.

It can also be a custom Id, like an employee id or payroll number from an external system. If a custom id is used, you must include the parameter `useCustomId=true` in the call.

The response will return an object conforming to the User schema.

If you get the error below, you will need permissions assigned to your API user to delete employees:

```json
{
    "errors": [
        {
            "message": "Client user action \"destroy\" is not allowed",
            "type": "validation_error",
            "field": "client_user",
            "short_message": "action \"destroy\" is not allowed"
        }
    ]
}
```

</details>

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.samesystem.dev/business-guides/employee-lifecycle-management/terminate-employees/delete-employee.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
