---
title: "Create a new Data Deletion Rule"
method: POST
path: "/v1/dataDeletionRules"
tags: ["dataDeletionRules"]
---

# Create a new Data Deletion Rule

`POST /v1/dataDeletionRules`

Create a new data deletion rule to delete logs.

## Request body

- CreateDeletionRuleRequest
  - `ruleName` string, required — Name of the deletion rule.
  - `ruleReason` string, required — Reason mentioning what data is being deleted and why.
  - `query` string, required — query to filter out the logs that need to be deleted.
  - `startMillis` integer, required — Start time of the search as a number of milliseconds.
  - `endMillis` integer, required — End time of the search as a number of milliseconds.
  - `byReceiptTime` boolean — Flag to order the search results in the order collector received it. This has the value `true` if the search is to be run by receipt time and `false` if it is to be run by message time.
  - `timezone` string — Timezone for the resolving timerange from startMillis,endMillis
  - `parsingMode` string — Define the parsing mode to scan the JSON format log messages. Possible values are: 1. `AutoParse` 2. `Manual` In AutoParse mode, the system automatically figures out fields to parse based on the search query. While in the Manual mode, no fields are parsed out automatically. For more information see [Dynamic Parsing](https://help.sumologic.com/?cid=0011).

## Response `200`

The data deletion Rule that has been created

- DeletionRuleDefinition
  - `ruleName` string, required — Name of the deletion rule.
  - `ruleReason` string, required — Reason mentioning what data is being deleted and why.
  - `query` string, required — query to filter out the logs that need to be deleted.
  - `startMillis` integer, required — Start time of the search as a number of milliseconds.
  - `endMillis` integer, required — End time of the search as a number of milliseconds.
  - `byReceiptTime` boolean — Flag to order the search results in the order collector received it. This has the value `true` if the search is to be run by receipt time and `false` if it is to be run by message time.
  - `timezone` string — Timezone for the resolving timerange from startMillis,endMillis
  - `parsingMode` string — Define the parsing mode to scan the JSON format log messages. Possible values are: 1. `AutoParse` 2. `Manual` In AutoParse mode, the system automatically figures out fields to parse based on the search query. While in the Manual mode, no fields are parsed out automatically. For more information see [Dynamic Parsing](https://help.sumologic.com/?cid=0011).
  - `id` string — Identifier for the deletion rule.
  - `createdAt` string, date-time — Creation timestamp in UTC.
  - `modifiedAt` string, date-time — Last modification timestamp in UTC in [RFC3339](https://tools.ietf.org/html/rfc3339) format.
  - `error` string — Errors related to the deletion rule.
  - `status` string — Status of the deletion rule.
  - `createdBy` string — Identifier of the user who created the deletion rule.
  - `modifiedBy` string — Identifier of the user who last modified the resource.
  - `deletedRanges` DeletedRange[] — List of the different units of deleted ranges since the deletion rule has been created.
    - `startTime` string, date-time, required — Start of the timestamp for each unit of filled ranges, expressed in timeZone specified in rule.
    - `endTime` string, date-time, required — End of the timestamp for each unit of filled ranges, expressed in timeZone specified in rule.

## Other responses

- `default` — Operation failed with an error

---

[API](https://skmtc.net/sumologic/apis/sumo-logic-api.md) · [All operations](https://skmtc.net/sumologic/apis/sumo-logic-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sumologic/sumo-logic-api/revisions/18a824df1e78/schema)
