> 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/collections/seed-collection-records.md).

# Seed Collection Records

Seeds test records into several collections in one call, parents first, with real reference ids.

**Hub only.** Fills several collections with test records in one all-or-nothing call. The server reads the published schemas, inserts parent collections before the ones that reference them, and writes the real new record ids into reference fields — you never invent an id.

`POST /{version}/database/collections/seed`

| Field                    | Meaning                                                                                                                                                                                                                                                                                               |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`                   | `dummy` (default) — the server makes up schema-valid records; `realistic` — you send the documents.                                                                                                                                                                                                   |
| `collections` (required) | JSON **string** with an array of `{ "collectionName", "count"?, "documents"? }`. `count` (dummy mode, default 5, at most 100 per collection); `documents` (realistic mode). In a document, a reference to another seeded record is written as `{"$seedRef": {"collection": "families", "index": 0}}`. |
| `databaseIntegrationId`  | Optional; the default integration of the request's environment otherwise.                                                                                                                                                                                                                             |

The answer's `result` holds `insertOrder` (the order the collections were filled in) and a `report` per collection: `collectionName`, `requested`, `inserted`, `ids` and `errors`. Every document is validated first; when one fails, nothing is written.

```json
{ "mode": "dummy", "collections": "[{\"collectionName\":\"families\",\"count\":3},{\"collectionName\":\"pairs\",\"count\":5}]" }
```

Permission: `database:create` on `database:collection:all`. AI tool: `seed_collection_records` (asks for confirmation).

{% openapi src="/files/0gOkqzp7kyziG9XPpCBy" path="/{version}/database/collections/seed" 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

Not in Cloud — it is a developer / AI tool. See [What agents can do](/codemash/ai/developers/what-agents-can-do.md).

## Use it from code

TS `norbix.hub.database.seedCollectionRecords(…)` · Python `hub.database.seed_collection_records(…)` · Go `c.Hub.Database.SeedCollectionRecords(…)` · .NET `SeedCollectionRecordsAsync(new SeedCollectionRecords { … })` · CLI `norbix db seed --collections <json> [--mode realistic] --yes`.
