# Deleting resources

### Overview

Deleting resources in R0

"Soft Delete" is a feature where, instead of permanently removing data from our database, we mark it as deleted using a timestamp in a `deleted_at` field. This feature ensures better data management and provides flexibility for data recovery.

### Changes to data tables

A `deleted_at` field has been added to most of our data tables. This field stores a UTC timestamp indicating when a record was soft deleted. Please note that some data types, such as reminders, do not support this feature due to the nature and volume of their data. The default behavior is outlined in the reference docs under each of the DELETE endpoints.

### Default behavior

When a DELETE request is made via the API or web interface, the default action will be a "soft delete". Instead of permanently removing the data, a timestamp will be added to the `deleted_at` field.

### Permanent delete option

For permanent deletion of a resource, include a `soft_delete=false` parameter in the DELETE request. This will remove the resource entirely from the database.

### Requesting deleted resources

Please note that requesting a deleted resource via a webpage will return a 404 error, deleted resources are only available via the API. If you've found this page and are not a developer, you can contact support to request a resource be "un-deleted".

### List retrieval

When retrieving a list of resources, only active resources (those without a `deleted_at` timestamp) will be returned by default.

### Inclusion of deleted resources

To include both active and soft deleted resources in the retrieved list, add an `include[]=deleted` query parameter to your request. Soft deleted resources will have a `deleted_at` field with a timestamp.

### Single resource requests

When making a GET request for a single resource via the API, the resource will be returned regardless of its deletion status. The `deleted_at` field will be included in the response body, enabling the identification of soft deleted resources.

Please consider these changes when making API calls. The introduction of Soft Delete provides you with more control and security over your data.


---

# 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.r0app.com/api/introduction/deleting-resources.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.
