> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_stats/api/delete.md).

# Delete

{% hint style="danger" %}
You should always make sure that you are calling these events after the rcore\_stats script is initialized.

To make sure, check the Step 1 in the [Integration](/paid-resources/rcore_stats/api/integration.md) guide.
{% endhint %}

## Delete order

{% hint style="warning" %}
When deleting any data using API events, you must make sure to follow a certain order.
{% endhint %}

Reason for this is that some data is dependent on other data.

Achievements are dependent on stat types, and stat types are dependent on categories. If you try to delete a category first and some stat type will depend on it, you will get an SQL error.

Correct order:

1. Delete achievement
2. Delete stat type
3. Delete category

## Delete Events

{% hint style="warning" %}
All events are SERVER SIDE.
{% endhint %}

### Deleting achievements

```lua
-- @param key string - unique key of the achievement
TriggerEvent('rcore_stats:api:deleteAchievement', key)

-- Example to delete the achievement "basket_hoops_1"
TriggerEvent('rcore_stats:api:deleteAchievement', "basket_hoops_1")
```

### Deleting stat types

```lua
-- @param key string - unique key of the stat type
TriggerEvent('rcore_stats:api:deleteStatType', key)

-- Example to delete the stat type "total_basket_hoops"
TriggerEvent('rcore_stats:api:deleteStatType', "total_basket_hoops")
```

### Deleting categories

```lua
-- @param key string - unique key of the category
TriggerEvent('rcore_stats:api:deleteCategory', key)

-- Example to delete the category "minigames"
TriggerEvent('rcore_stats:api:deleteCategory', "minigames")
```
