> 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/sdks/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).

This method is on the **Hub** surface (`norbix.hub.database`) — call it from admin tooling or IaC.

{% hint style="info" %}
These examples assume the SDK is installed and your credentials are set as environment variables — each client reads them automatically, so the constructors below take no arguments. See [Install a Norbix SDK](/codemash/sdks/install.md).
{% endhint %}

{% tabs %}
{% tab title="JavaScript / TypeScript" %}

```ts
import { Norbix } from '@norbix.ai/ts';
const norbix = new Norbix();

const result = await norbix.hub.database.seedCollectionRecords({
  collections: 'example-value',
  mode: 'example-value',
  databaseIntegrationId: 'int_4kX9mQvR2tYw7ZbC1dFgHj',
});
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using Norbix.Sdk;
using Norbix.Sdk.Types.Hub;

using var client = new NorbixClient();

var result = await client.Database.SeedCollectionRecordsAsync(new SeedCollectionRecords
{
    Collections = "example-value",
    Mode = "example-value",
    DatabaseIntegrationId = "int_4kX9mQvR2tYw7ZbC1dFgHj",
});
```

{% endtab %}

{% tab title="Python" %}

```python
from norbix_python import NorbixHub

norbix = NorbixHub()

result = norbix.database.seed_collection_records(
    collections="example-value",
    mode="example-value",
    databaseIntegrationId="int_4kX9mQvR2tYw7ZbC1dFgHj",
)
```

{% endtab %}

{% tab title="Go" %}

```go
c, _ := norbix.New(norbix.Options{})
ctx := context.Background()

var result map[string]any
err := c.Hub.Database.SeedCollectionRecords(ctx, map[string]any{
	"collections": "example-value",
	"mode": "example-value",
	"databaseIntegrationId": "int_4kX9mQvR2tYw7ZbC1dFgHj",
}, &result)
```

{% endtab %}

{% tab title="Dart / Flutter" %}

```dart
import 'package:norbix/norbix_hub.dart';

final hub = NorbixHub();

final result = await hub.database.seedCollectionRecords(body: {
  'collections': 'example-value',
  'mode': 'example-value',
  'databaseIntegrationId': 'int_4kX9mQvR2tYw7ZbC1dFgHj',
});
```

{% endtab %}

{% tab title="Swift" %}

```swift
import NorbixHub

let client = try NorbixHubClient()

let result = try await client.database.seedCollectionRecords([
    "collections": "example-value",
    "mode": "example-value",
    "databaseIntegrationId": "int_4kX9mQvR2tYw7ZbC1dFgHj",
])
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import ai.norbix.sdk.hub.NorbixHub

val hub = NorbixHub()

val result = hub.database.seedCollectionRecords(mapOf(
    "collections" to "example-value",
    "mode" to "example-value",
    "databaseIntegrationId" to "int_4kX9mQvR2tYw7ZbC1dFgHj",
))
```

{% endtab %}

{% tab title="CLI" %}

```sh
norbix hub db collection records seed --collections example-value --mode example-value --databaseIntegrationId int_4kX9mQvR2tYw7ZbC1dFgHj
```

{% endtab %}
{% endtabs %}

## In Cloud

Manage this visually in Cloud — see [Database → Collections](/codemash/cloud/database/collections.md).

## API reference

Full request and response for this endpoint: [Seed Collection Records](/codemash/api-reference/database/collections/seed-collection-records.md).
