> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/connect/rest-api/end-users/deactivate-user.md).

# Deactivate User

<table data-header-hidden><thead><tr><th width="90.20703125" align="center"></th><th></th></tr></thead><tbody><tr><td align="center"><mark style="color:red;"><strong>DELETE</strong></mark> </td><td>https://api.sfox.com/v1/enterprise/account/:user_id</td></tr></tbody></table>

Deactivates a user account. &#x20;

***

Deactivating the account will remove any connection between you and the user's account.&#x20;

* You will no longer be able to [generate User Auth Tokens](/connect/rest-api/end-users/create-user-auth-token.md) for this user.
* The user will no longer appear when [retrieving End Users](/connect/rest-api/end-users/get-end-user.md).

{% hint style="info" %}
Requests to deactivate a user will fail unless the user's account balances are zero. Please be sure to have the user withdraw balances from their account prior to attempting deactivation.
{% endhint %}

## Request

### Path Parameters

<table><thead><tr><th width="210">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>user_id</code> <mark style="color:red;"><strong>required</strong></mark></td><td>string</td><td>User ID of the user's account to be disabled</td></tr></tbody></table>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```sh
curl -X DELETE \
-H "Authorization: Bearer ${ENTERPRISE_API_KEY}"  \
'https://api.sfox.com/v1/enterprise/account/${USER_ID}'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

const config = {
  method: 'delete',
  url: 'https://api.sfox.com/v1/enterprise/account/${USER_ID}',
  headers: {
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  }
}

axios(config)
  .then(response => {
    console.log(response.status)
    console.log(response.data)
  }).catch(err => {
    console.error(err.response.status)
    console.error(err.respones.data)
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

data = requests.delete(
  "https://api.sfox.com/v1/enterprise/account/${USER_ID}",
  headers={
    "Authorization": f"Bearer {os.environ['${ENTERPRISE_API_KEY}']}"
  }
)
print(data.status_code)
print(data.json())
```

{% endtab %}
{% endtabs %}

## Response

### Responses

<details>

<summary><mark style="color:green;">200 OK</mark></summary>

```
No body returned
```

</details>

<details>

<summary><mark style="color:red;">422 Unprocessable Content</mark></summary>

```json
{
    "error": "Can not disable account with non-zero balances. Please remove all balances and try again."
}
```

</details>

<details>

<summary><mark style="color:red;">404 Not Found</mark></summary>

```json
{
"error": "The account does not exist to be disabled."
}
```

</details>


---

# 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.sfox.com/connect/rest-api/end-users/deactivate-user.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.
