> For the complete documentation index, see [llms.txt](https://lern.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lern.sunbird.org/use/developer-guide/user-and-org-service/apis/user-management/user-deletion-api.md).

# User Deletion API

### Overview

The User Deletion API allows authorized users to delete a user from the system. This API requires the user ID of the user to be deleted and is accessible via an HTTP POST request.

### Delete a user

<mark style="color:green;">`POST`</mark> /api/user/v1/delete

### **Headers**

| Name                                                         | Value                     |
| ------------------------------------------------------------ | ------------------------- |
| Content-Type<mark style="color:red;">\*</mark>               | `application/json`        |
| Authorization<mark style="color:red;">\*</mark>              | `Bearer <token>`          |
| X-Authenticated-User-token<mark style="color:red;">\*</mark> | `<keycloak-access-token>` |

### Body

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

```json
{
    "request": {
        "userId": "user id to be deleted"
    }
}
```

{% endtab %}

{% tab title="Schema" %}

| Name                                     | Type   | Description                        |
| ---------------------------------------- | ------ | ---------------------------------- |
| userId<mark style="color:red;">\*</mark> | string | User id  of the user to be deleted |
| {% endtab %}                             |        |                                    |
| {% endtabs %}                            |        |                                    |

### **Response**

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

```json
{
    "id": "api.user.delete",
    "ver": "v1",
    "ts": "2024-05-20 10:08:56:812+0000",
    "params": {
        "resmsgid": "e413d019f31bcb2d3736b7054f1fd6e2",
        "msgid": "e413d019f31bcb2d3736b7054f1fd6e2",
        "err": null,
        "status": "SUCCESS",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "response": "SUCCESS"
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "id": "api.user.delete",
    "ver": "v1",
    "ts": "2024-05-20 10:09:45:837+0000",
    "params": {
        "resmsgid": "4abb4c0bdd99feea7a7070eeade15aaa",
        "msgid": "4abb4c0bdd99feea7a7070eeade15aaa",
        "err": "UOS_USRDLT0008",
        "status": "FAILED",
        "errmsg": "User is already deleted."
    },
    "responseCode": "CLIENT_ERROR",
    "result": {}
}
```

{% endtab %}

{% tab title="403" %}

```json
You do not have permission to perform this operation
```

{% endtab %}
{% endtabs %}


---

# 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 dynamically by asking a question.

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

```
GET https://lern.sunbird.org/use/developer-guide/user-and-org-service/apis/user-management/user-deletion-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
