> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/database/taxonomies/new.md).

# Create a taxonomy

Create a taxonomy — its name, description, parent taxonomy, additional categories and term fields.

**Where:** Database → Taxonomies → **Add New** · `/projects/<project>/db/taxonomies/new`

## Before you start

* To give the taxonomy a **Parent** or **Additional categories**, create those taxonomies first (for example `Regions` before `Countries`).
* You need `database:create` on `database:taxonomy:all`.

## Steps

1. Open **Database → Taxonomies** and press **Add New**. The form **Add New taxonomy** has two tabs: **Taxonomy** and **Term fields**.

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-b072263bdc4fbfed295d4a0298589e0a3da4393c%2Ftaxonomies-new-1.png?alt=media" alt="Add New taxonomy, Taxonomy tab: empty Taxonomy name and Description, Parent — None —, Additional categories with the checkboxes Regions and Tags, Cancel and Save"><figcaption><p>The empty taxonomy form.</p></figcaption></figure>
2. Fill in the **Taxonomy** tab:

   | Field                 | Required | What it does                                                                                                     | Example                   |
   | --------------------- | -------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------- |
   | Taxonomy name         | yes      | The name; the API addresses term lists by it (`/taxonomies/Countries/terms`). At most 40 characters.             | `Countries`               |
   | Description           | no       | Shown in the taxonomies list.                                                                                    | `Countries we deliver to` |
   | Parent                | no       | One other taxonomy, or **— None —**. With a parent, every term of this taxonomy must pick a parent term from it. | `Regions`                 |
   | Additional categories | no       | Other taxonomies whose terms can also be attached to this taxonomy's terms.                                      | `Tags`                    |

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-c0ce2f8ae46b43c677927400d5e071ae5c5f95bd%2Ftaxonomies-new-2.png?alt=media" alt="The Taxonomy tab filled in: Taxonomy name Countries, Description Countries we deliver to, Parent Regions, Additional categories Tags ticked"><figcaption><p>Countries under Regions, with Tags as an additional category.</p></figcaption></figure>

   A taxonomy cannot be both the **Parent** and an **Additional category**: the form says *A taxonomy cannot be both the Parent and an Additional category. Remove it from one.*
3. Optional: open **Term fields** to give every term extra fields, for example **Capital** and **Population** — see [Term fields](/codemash/cloud/database/taxonomies/term-fields.md).
4. Press **Save**. **Cancel** leaves without saving.

## Result

Cloud goes back to **Database → Taxonomies**. The new row shows the description and, under **Parent(s)**, `Regions, Tags`. Click the name to [add its terms](/codemash/cloud/database/taxonomies/terms.md).

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-a8a50e58ac30f6e93041ae461bd302b90a2416dc%2Ftaxonomies-list-1.png?alt=media" alt="Taxonomies list with Regions, Tags and the new Countries (Parent(s) Regions, Tags)"><figcaption><p>The new taxonomy in the list.</p></figcaption></figure>

## Change or remove it later

* **Edit** — row menu → **Edit taxonomy** — see [Edit a taxonomy](/codemash/cloud/database/taxonomies/edit.md).
* **Delete** — **Delete** in the taxonomy form — see [Delete a taxonomy](/codemash/cloud/database/taxonomies/delete.md).

## Do it from code

```ts
const { list } = await norbix.hub.database.getDatabaseTaxonomies();
const countries = list.items.find((t) => t.taxonomyName === 'Countries');
const { id } = await norbix.hub.database.saveDatabaseTaxonomy({
  taxonomyName: 'Cities',
  description: 'Cities we deliver to',
  parentId: countries.viewId,
});
```

```sh
norbix hub database taxonomy save --taxonomyName Cities --description "Cities we deliver to" --parentId txn_2ecJhU8RtC0chrKoXPOMJR
```

`dependencies` (a list of taxonomy ids) sets the additional categories. The client setup is on the [Database page](/codemash/cloud/database.md#use-it-from-code). API: [Save Database Taxonomy](/codemash/api-reference/database/taxonomies/save-database-taxonomy.md)
