<!-- BusyBot node reference — https://busybot.net/tools/grok-collections/ -->

> Node: Grok Collections (`grok_collections`) · Action · v1
> Category: AI · Credentials: xAI (`xai`)
> Updated: 2026-08-16

# Grok Collections

> Manage Grok document collections — create, list, get, delete.

## Overview

Grok Collections manages document collections on the xAI platform for retrieval-augmented generation. Supports four operations: create a new collection, list all collections, get a specific collection by ID, and delete a collection.

**Category:** AI  
**Tool Name:** `grok_collections`  
**Version:** 1

**Appearance:** Icon: `brain` | Color: `#000000`

## Node Type

**Action** — processes input items and produces output

## Input / Output

| Direction | Port(s) |
|-----------|--------|
| Input | `Input` |
| Output | `Output`, `Error` |

## Credentials

This tool requires **xAI** credentials.
See the [Credentials Guide](https://busybot.net/credentials/xai/) for setup instructions.

### Operations

| Operation | Value | Description |
|-----------|-------|-------------|
| Create | `create` | Create a new document collection. |
| List | `list` | List all document collections. |
| Get | `get` | Get a specific collection by ID. |
| Delete | `delete` | Delete a collection by ID. |

### Parameters

`List` takes no parameters of its own — see All Operations.

#### Create (`create`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Collection Name | `string` | No | — | Name for the new collection. Falls back to the input item's "collectionName" field. Supports expressions. If neither is set, the collection is created as "New Collection". |
| Field Definitions | `json` | No | `[]` | Optional metadata schema for documents in this collection — a JSON array of field definitions (e.g. [{"name":"author","type":"string","required":false,"unique":false}]). Leave as [] for no custom fields. xAI requires this array on create. |

#### Get (`get`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Collection ID | `string` | No | — | The ID of the collection. Falls back to the input item's "collectionId" field. Supports expressions. |

#### Delete (`delete`)

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Collection ID | `string` | No | — | The ID of the collection. Falls back to the input item's "collectionId" field. Supports expressions. |

#### All Operations

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| Options | `collection` | No | `{}` | Optional output settings — add only the fields you want to override. |
| — Response Field Name | `string` | No | `collection` | The output field name where the API response will be stored. |
| Include Input | `boolean` | No | `false` | Whether to include the original input item fields in the output. |
| Max Concurrency | `number` | No | `10` | Maximum number of items to process concurrently. |

## Output Data

One output item per input item. The xAI response is written unchanged to the field named by Response Field Name (`collection` by default). The rest of the input JSON is carried over only when Include Input is on; binary data from the input item is forwarded.

| Operation | What lands in the response field |
|-----------|----------------------------------|
| `create` | The newly created collection object, including its generated collection ID |
| `list` | The listing xAI returns for the account's collections |
| `get` | The requested collection object |
| `delete` | The deletion result xAI returns |

Reference the result downstream by expression, e.g. `{{ $json.collection }}`. Because `list` returns everything on a single item, follow it with a Split Out node to fan the collections out one per item.

## Usage Examples

- Create a new Grok document collection for RAG
- List all existing collections in your xAI account
- Get details of a specific collection by ID
- Delete a collection that is no longer needed
- Manage collections as part of a RAG pipeline

## Example Configuration

List every collection on the account:

```json
{
  "type": "grok_collections",
  "parameters": {
    "operation": "list"
  }
}
```

Create a collection with no custom metadata fields:

```json
{
  "type": "grok_collections",
  "parameters": {
    "operation": "create",
    "collectionName": "Product Documentation {{ $json.quarter }}",
    "fieldDefinitions": []
  }
}
```

Create a collection that records an author on every document:

```json
{
  "type": "grok_collections",
  "parameters": {
    "operation": "create",
    "collectionName": "Support Articles",
    "fieldDefinitions": [
      { "name": "author", "type": "string", "required": false, "unique": false }
    ],
    "options": {
      "responseFieldName": "createdCollection"
    }
  }
}
```

Delete collections named by upstream items, a few at a time:

```json
{
  "type": "grok_collections",
  "parameters": {
    "operation": "delete",
    "collectionId": "{{ $json.collectionId }}",
    "includeInput": true,
    "maxConcurrency": 3
  }
}
```

### Error Handling

| Mode | Behavior |
|------|----------|
| **stop** | Halts workflow on first error |
| **continue** | Skips failed items, passes successful ones through |
| **errorPort** | Routes failed items to Error output port |

## Tips

Grok Collections manages document collections on the xAI platform, supporting create, list, get, and delete operations via the xAI Collections API. Use it when you need to organize or retrieve document sets for Retrieval-Augmented Generation workflows before querying Grok models with contextual knowledge. It outputs a collection object or list of collection objects with IDs and metadata on the main channel, or routes failures to the error output.