> 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/api-reference/database/schemas/apply-database-schema-bundle.md).

# Apply Database Schema Bundle

Creates every collection and taxonomy of a schema bundle, linked and published, in one call.

Creates working collections from the reviewed schema **catalog** (or from your own intermediate-format entities) in one deterministic call: the server compiles the bundle, creates each taxonomy it needs under a readable title **with its terms**, creates the collections in dependency order, links every taxonomy and collection field so the Cloud pickers resolve, and publishes new collections as version 1. Running it again finds what exists and updates drafts instead of creating duplicates.

`POST /{version}/database/schemas/apply-bundle`

| Field          | Meaning                                                                                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entities`     | Comma-separated catalog entity ids, e.g. `blog_posts,comments`. The usual input — the server loads the reviewed documents itself.                                                                                               |
| `bundleJson`   | Only for entities the catalog does not have: one entity object `{ entity, display_name, description, fields: [{ name, kind, label }] }` or an array; or a catalog reference with `add_fields` / `remove_fields`. A JSON string. |
| `tier`         | `minimal`, `standard` (default) or `extended` — how many fields to compile.                                                                                                                                                     |
| `translatable` | `true` marks free-text fields (title, body, excerpt …) translatable. Default `false`.                                                                                                                                           |
| `publish`      | `false` leaves every collection as a draft. Default `true`.                                                                                                                                                                     |

The answer lists the `taxonomies` (catalog id, id, slug, title, `created` or `reused`, terms created), the `collections`, the `decisions` the server made and any `errors`.

Permission: every taxonomy, term and schema goes through the normal save and publish commands, so the caller needs the rights to create taxonomies, terms and schemas (`database:create`) and to publish. AI tool: `apply_database_schema_bundle` (asks for confirmation) — the way the AI assistant creates collections.

{% openapi src="/files/0gOkqzp7kyziG9XPpCBy" path="/{version}/database/schemas/apply-bundle" method="post" %}
[norbix-hub-swagger.json](https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-7c7445e68689b62620e59cb01a3523deb46b865b%2Fnorbix-hub-swagger.json?alt=media)
{% endopenapi %}

## In Cloud

The schema builder's AI assistant uses the same catalog — see [Create a Schema](/codemash/cloud/database/collections/create-schema.md#create-with-the-ai-assistant) and [What agents can do](/codemash/ai/developers/what-agents-can-do.md).

## Use it from code

TS `norbix.hub.database.applyDatabaseSchemaBundle({ entities: 'blog_posts,comments' })` · Python `hub.database.apply_database_schema_bundle(entities="blog_posts,comments")` · Go `c.Hub.Database.ApplyDatabaseSchemaBundle(…)` · .NET `ApplyDatabaseSchemaBundleAsync(new ApplyDatabaseSchemaBundleRequest { Entities = "blog_posts,comments" })`.
