> For the complete documentation index, see [llms.txt](https://docs.nosto.com/techdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nosto.com/techdocs/apis/graphql-an-introduction/graphql-using-mutations/updating-categories.md).

# Updating Categories

Mutations can be used to update the category listing in Nosto. The `upsertCategories` mutation allows you to update one or more category at one go. If the category doesn't already exist, a new one is created.

A category can have the following fields:

* `id` The category identifier. If a category with this id doesn't already exist, a new one is created.
* `name` The displayed name for the category.
* `urlPath` The path that can be used to generate the URL of the category listing.
* `available` If the category is visible on the store. This can be set to false to soft delete the category in an upsert.

Some stores support hierarchical categories i.e. a category may have parent and child categories. The following fields can be used for hierarchical categories:

* `parentId` The identifier of the parent category.
* `fullName` The name of every category in the hierarchy.

```
curl -0 -v -X POST https://api.nosto.com/v1/graphql \
-u ":<token>" \
-H 'Content-Type: application/graphql' \
-d @- << EOF
mutation {
  upsertCategories(categories: [{
    id: "123",
    name: "Shoes",
    parentId: "456",
    urlPath: "/categories/mens/shoes",
    fullName: "/Mens/Shoes",
    available: true
  }]) {
    categoryResult {
      errors {
        field
        message
      }
      category {
        id
        name
        parentId
        urlPath
        fullName
        available
      }
    }
  }
}
EOF
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nosto.com/techdocs/apis/graphql-an-introduction/graphql-using-mutations/updating-categories.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
