# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/connect/rest-api/end-users/deactivate-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
