You can mark segments as used by sending POST requests to the datasource, but the Coordinator may subsequently mark segments as unused if they meet any configured [drop rules](../operations/rule-configuration.md#drop-rules).
Even if these API requests update segments to used, you still need to configure a [load rule](../operations/rule-configuration.md#load-rules) to load them onto Historical processes.
When you use these APIs concurrently with an indexing task or a kill task, the behavior is undefined.
Druid terminates some segments and marks others as used.
Furthermore, it is possible that all segments could be unused, yet an indexing task might still be able to read data from these segments and complete successfully.
The following headers are required for this request:
```json
Content-Type: application/json
Accept: application/json, text/plain
```
#### Responses
<Tabs>
<TabItemvalue="1"label="200 SUCCESS">
*Successfully updated segment*
</TabItem>
</Tabs>
---
#### Sample request
The following example updates the segment `wikipedia_hour_2015-09-12T16:00:00.000Z_2015-09-12T17:00:00.000Z_2023-08-10T04:12:03.860Z` from datasource `wikipedia_hour` as `unused`.
The following headers are required for this request:
```json
Content-Type: application/json
Accept: application/json, text/plain
```
#### Responses
<Tabs>
<TabItemvalue="4"label="200 SUCCESS">
*Successfully updated segments*
</TabItem>
</Tabs>
---
#### Sample request
The following example updates the segment with ID `wikipedia_hour_2015-09-12T18:00:00.000Z_2015-09-12T19:00:00.000Z_2023-08-10T04:12:03.860Z` to used.
<Tabs>
<TabItemvalue="5"label="cURL">
```shell
curl --request POST "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/datasources/wikipedia_hour/segments/wikipedia_hour_2015-09-12T18:00:00.000Z_2015-09-12T19:00:00.000Z_2023-08-10T04:12:03.860Z" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain'
```
</TabItem>
<TabItemvalue="6"label="HTTP">
```HTTP
POST /druid/coordinator/v1/datasources/wikipedia_hour/segments/wikipedia_hour_2015-09-12T18:00:00.000Z_2015-09-12T19:00:00.000Z_2023-08-10T04:12:03.860Z HTTP/1.1
Host: http://ROUTER_IP:ROUTER_PORT
Content-Type: application/json
Accept: application/json, text/plain
```
</TabItem>
</Tabs>
#### Sample response
<details>
<summary>Show sample response</summary>
```json
{
"segmentStateChanged": true
}
```
</details>
### Mark a group of segments unused
Marks the state of a group of segments as unused, using an array of segment IDs or an interval.
Pass the array of segment IDs or interval as a JSON object in the request body.
For the interval, specify the start and end times as ISO 8601 strings to identify segments inclusive of the start time and exclusive of the end time.
Druid only updates the segments completely contained within the specified interval; partially overlapping segments are not affected.
The following headers are required for this request:
```json
Content-Type: application/json
Accept: application/json, text/plain
```
#### Responses
<Tabs>
<TabItemvalue="20"label="200 SUCCESS">
*Successfully updated segments*
</TabItem>
</Tabs>
---
#### Sample request
The following example updates all unused segments of `wikipedia_hour` to used.
`wikipedia_hour` contains one unused segment eligible to be marked as used.
<Tabs>
<TabItemvalue="21"label="cURL">
```shell
curl --request POST "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/datasources/wikipedia_hour" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain'
```
</TabItem>
<TabItemvalue="22"label="HTTP">
```HTTP
POST /druid/coordinator/v1/datasources/wikipedia_hour HTTP/1.1
Host: http://ROUTER_IP:ROUTER_PORT
Content-Type: application/json
Accept: application/json, text/plain
```
</TabItem>
</Tabs>
#### Sample response
<details>
<summary>Show sample response</summary>
```json
{
"numChangedSegments": 1
}
```
</details>
## Segment deletion
### Permanently delete segments
The DELETE endpoint sends a [kill task](../ingestion/tasks.md) for a given interval and datasource. The interval value is an ISO 8601 string delimited by `_`. This request permanently deletes all metadata for unused segments and removes them from deep storage.
Note that this endpoint returns an HTTP `200 OK` response code even if the datasource doesn't exist.
This endpoint supersedes the deprecated endpoint: `DELETE /druid/coordinator/v1/datasources/:datasource?kill=true&interval=:interval`
The following example sends a kill task to permanently delete segments in the datasource `wikipedia_hour` from the interval `2015-09-12` to `2015-09-13`.