# deleteSubjects

This method is to delete one or more subjects.

{% hint style="danger" %}
Deleting a subject is **irreversible**. There is **no way** to recover a deleted subject.
{% endhint %}

_This method was added in Cortex 2.1_

## Parameters

| Name        | Type               | Required | Description                                                   |
| ----------- | ------------------ | -------- | ------------------------------------------------------------- |
| cortexToken | `string`           | yes      | A token returned by [authorize](../authentication/authorize). |
| subjects    | `array of strings` | yes      | A list a subject names.                                       |

A subject is identified by his/her name, so you must provide the name of the subjects you want to delete.

## Result

The result is an object that includes these fields:

| Name    | Type               | Description                                                                                                |
| ------- | ------------------ | ---------------------------------------------------------------------------------------------------------- |
| success | `array of objects` | For each subject you successfully deleted, this array contains an object with the name of deleted subject. |
| failure | `array of objects` | For each subject you failed to delete, this array contains an object that describes the error.             |

In case of success, you get an object with these fields:

| Name        | Type     | Description                      |
| ----------- | -------- | -------------------------------- |
| subjectName | `string` | The name of the deleted subject. |

In case of failure, you get an object with these fields:

| Name        | Type     | Description              |
| ----------- | -------- | ------------------------ |
| subjectName | `string` | The name of the subject. |
| code        | `number` | The error code.          |
| message     | `string` | The error message.       |

## Examples

{% tabs %}
{% tab title="Request" %}
```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "deleteSubjects",
    "params": {
        "cortexToken": "xxx",
        "subjects": ["Invalid Name", "Bob Smith"]
    }
}
```
{% endtab %}

{% tab title="Response" %}
```javascript
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "failure": [
            {
                "code": -32124,
                "message": "The subject was not found.",
                "subjectName": "Invalid Name"
            }
        ],
        "success": [
            {
                "subjectName": "Bob Smith"
            }
        ]
    }
}
```
{% endtab %}
{% endtabs %}

.
