# How to remove fields that doesn't exist after removing them from API?

**URL:** <https://discourse.getcockpit.com/t/how-to-remove-fields-that-doesnt-exist-after-removing-them-from-api/909>\
**Category:** Support\
**Created:** [July 6, 2019, 12:24pm UTC](https://discourse.getcockpit.com/t/how-to-remove-fields-that-doesnt-exist-after-removing-them-from-api/909 "2019-07-06T12:24:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [July 7, 2019, 1:05pm UTC](https://discourse.getcockpit.com/t/how-to-remove-fields-that-doesnt-exist-after-removing-them-from-api/909/2 "2019-07-07T13:05:29Z")

</div>

This is a bug and a feature as well, so it never got fixed. If contents would be removed automatically, Cockpit must know, if it really should delete them or if the fields are just hidden from the admin ui.

Have a look here for a solution with a cli command:

> [@API Returns fields that have been removed from collection](https://discourse.getcockpit.com/t/api-returns-fields-that-have-been-removed-from-collection/150):
>
> I’m just getting started with cockpit, so I’m playing around with it to see what I can do. I modified a collection to remove a field. This field had been entered on some entries before removing it. Now when I call the /collections/get API, the data for that field is being included in the response. Is this intended behavior? I may not be using this right, but it seems like that would just inflate the size of the response json.

And some thoughts, why automatic removing is complicated:

> <https://github.com/agentejo/cockpit/issues/821>
>
> How can we remove 'old' (removed) fields from the API requests and possibly even… the database?

---

_[View the full topic](https://discourse.getcockpit.com/t/how-to-remove-fields-that-doesnt-exist-after-removing-them-from-api/909)._
