# Deleting Targets

**URL:** <https://discuss.konghq.com/t/deleting-targets/5595>\
**Category:** Questions\
**Created:** [February 20, 2020, 9:09pm UTC](https://discuss.konghq.com/t/deleting-targets/5595 "2020-02-20T21:09:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbranch](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/cbranch/32/1732_2.png) [@cbranch](https://discuss.konghq.com/u/cbranch)\
**Post date:** [February 20, 2020, 9:09pm UTC](https://discuss.konghq.com/t/deleting-targets/5595/1 "2020-02-20T21:09:10Z")

</div>

The [documentation](https://docs.konghq.com/1.4.x/admin-api/#target-object) for Target Object includes this paragraph:

> Because the upstream maintains a history of target changes, the targets cannot be deleted or modified. To disable a target, post a new one with weight=0; alternatively, use the DELETE convenience method to accomplish the same.

Is this still accurate for 1.4.2 and later? I tried the following:

1. Create upstream
2. Create target for the upstream
3. Verify the target exists via the API and also via a database query (select \* from targets)
4. Delete the target

After these steps, the database table is empty (select \* from targets). Also, the following request returns an empty response:

[http://localhost:8001/upstreams/{upstream\_id}/targets/all](http://localhost:8001/upstreams/%7Bupstream_id%7D/targets/all)

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [February 20, 2020, 11:15pm UTC](https://discuss.konghq.com/t/deleting-targets/5595/2 "2020-02-20T23:15:21Z")

</div>

@Tieske Something seems wrong here…

---

<div class="post-metadata">

**Author:** ![Tieske](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/tieske/32/54_2.png) [@Tieske](https://discuss.konghq.com/u/Tieske)\
**Post date:** [February 21, 2020, 3:45pm UTC](https://discuss.konghq.com/t/deleting-targets/5595/3 "2020-02-21T15:45:14Z")

</div>

This is on Kong 1.4.2

```auto
/kong # http :8001/upstreams name=tieske
/kong # http :8001/upstreams/tieske/targets target=localhost:8000
/kong # http :8001/upstreams/tieske/targets
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 192
Content-Type: application/json; charset=utf-8
Date: Fri, 21 Feb 2020 15:41:48 GMT
Server: kong/1.4.2
X-Kong-Admin-Latency: 3

{
    "data": [
        {
            "created_at": 1582299697.327,
            "id": "b3832396-fa16-42a5-9b95-96280b87d1d7",
            "target": "localhost:8000",
            "upstream": {
                "id": "7c3cdd44-e753-4a70-aebd-dc62a1c2e28e"
            },
            "weight": 100
        }
    ],
    "next": null
}

/kong # http :8001/upstreams/tieske/targets/all
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 204
Content-Type: application/json; charset=utf-8
Date: Fri, 21 Feb 2020 15:41:54 GMT
Server: kong/1.4.2
X-Kong-Admin-Latency: 8

{
    "data": [
        {
            "created_at": 1582299697.327,
            "id": "b3832396-fa16-42a5-9b95-96280b87d1d7",
            "tags": null,
            "target": "localhost:8000",
            "upstream": {
                "id": "7c3cdd44-e753-4a70-aebd-dc62a1c2e28e"
            },
            "weight": 100
        }
    ],
    "next": null
}

/kong # http -f :8001/upstreams/tieske/targets target=localhost:8000 weight=0
/kong # http :8001/upstreams/tieske/targets
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 23
Content-Type: application/json; charset=utf-8
Date: Fri, 21 Feb 2020 15:42:23 GMT
Server: kong/1.4.2
X-Kong-Admin-Latency: 2

{
    "data": [],
    "next": null
}

/kong # http :8001/upstreams/tieske/targets/all
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 23
Content-Type: application/json; charset=utf-8
Date: Fri, 21 Feb 2020 15:42:28 GMT
Server: kong/1.4.2
X-Kong-Admin-Latency: 6

{
    "data": [],
    "next": null
}

/kong # 

```

---

<div class="post-metadata">

**Author:** ![Tieske](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/tieske/32/54_2.png) [@Tieske](https://discuss.konghq.com/u/Tieske)\
**Post date:** [February 21, 2020, 3:48pm UTC](https://discuss.konghq.com/t/deleting-targets/5595/4 "2020-02-21T15:48:15Z")

</div>

also tested on 2.0.1, exact same result

---

<div class="post-metadata">

**Author:** ![Tieske](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/tieske/32/54_2.png) [@Tieske](https://discuss.konghq.com/u/Tieske)\
**Post date:** [February 21, 2020, 3:54pm UTC](https://discuss.konghq.com/t/deleting-targets/5595/5 "2020-02-21T15:54:20Z")

</div>

filed an issue: [https://github.com/Kong/kong/issues/5593](https://github.com/Kong/kong/issues/5593)
