# Create/update collection

**URL:** <https://discourse.getcockpit.com/t/create-update-collection/1543>\
**Category:** Support\
**Created:** [July 8, 2020, 8:30am UTC](https://discourse.getcockpit.com/t/create-update-collection/1543 "2020-07-08T08:30:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnagnu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/gnagnu/32/572_2.png) [@gnagnu](https://discourse.getcockpit.com/u/gnagnu)\
**Post date:** [July 8, 2020, 8:30am UTC](https://discourse.getcockpit.com/t/create-update-collection/1543/1 "2020-07-08T08:30:11Z")

</div>

Hello,

I’m trying to use the API to create/update collection schema.

As per the documentation, it should be possible to update but I’m getting 404. Below is my request.

Is it otherwise possible to create a new collection using the same/another endpoint?

Thanks

Hang

```
POST /api/collections/updateCollection/apitest HTTP/1.1
Host: https://mycockpit.com
Cockpit-Token: mytoken
Content-Type: application/json

{
    "fields": [
        {
            "name": "display_name",
            "label": "Display Name",
            "type": "text",
            "default": "",
            "info": "Name of the country as displayed to customers",
            "group": "",
            "localize": false,
            "options": [],
            "width": "1-1",
            "lst": true,
            "acl": [],
            "required": false
        }
    ]
}
```

---

<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 9, 2020, 2:47pm UTC](https://discourse.getcockpit.com/t/create-update-collection/1543/2 "2020-07-09T14:47:44Z")

</div>

You have to wrap your object with a data object, see: [https://getcockpit.com/documentation/api/collections](https://getcockpit.com/documentation/api/collections)

```json
{
    "data": {
        "fields": [
            {
                "name": "display_name",
                "label": "Display Name",
                "type": "text",
                "default": "",
                "info": "Name of the country as displayed to customers",
                "group": "",
                "localize": false,
                "options": [],
                "width": "1-1",
                "lst": true,
                "acl": [],
                "required": false
            }
        ]
    }
}

```
