Reference · Tools

Grok Collections

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

Action AI v1

Grok Collections manages the document collections that back retrieval-augmented workflows on xAI: create a collection, list what exists, fetch one by ID, or delete it. It is the housekeeping half of RAG on Grok — pair it with Grok Collections Upload to populate a collection, then query it from a Grok model.

Node type
Action
Parameters
7
Outputs
Output, Error
Credentials
xAI

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

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires xAI credentials. See the Credentials Guide for setup instructions.

Operations

OperationValueDescription
CreatecreateCreate a new document collection.
ListlistList all document collections.
GetgetGet a specific collection by ID.
DeletedeleteDelete a collection by ID.

Parameters

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

Create (create)

ParameterTypeRequiredDefaultDescription
Collection NamestringNoName 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 DefinitionsjsonNo[]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)

ParameterTypeRequiredDefaultDescription
Collection IDstringNoThe ID of the collection. Falls back to the input item’s “collectionId” field. Supports expressions.

Delete (delete)

ParameterTypeRequiredDefaultDescription
Collection IDstringNoThe ID of the collection. Falls back to the input item’s “collectionId” field. Supports expressions.

All Operations

ParameterTypeRequiredDefaultDescription
OptionscollectionNo{}Optional output settings — add only the fields you want to override.
— Response Field NamestringNocollectionThe output field name where the API response will be stored.
Include InputbooleanNofalseWhether to include the original input item fields in the output.
Max ConcurrencynumberNo10Maximum 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.

OperationWhat lands in the response field
createThe newly created collection object, including its generated collection ID
listThe listing xAI returns for the account’s collections
getThe requested collection object
deleteThe 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:

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

Create a collection with no custom metadata fields:

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

Create a collection that records an author on every document:

{
  "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:

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

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes 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.

Frequently asked questions

How does this relate to Grok Collections Upload?

This node manages collections themselves — creating, listing, fetching and deleting them. Uploading documents into a collection is the separate Grok Collections Upload node, which needs a collection to exist first.

What does the output look like?

A collection object, or an array of them for a list operation, each carrying its ID and metadata. Capture the ID when creating a collection — the upload node needs it.

Is deleting a collection reversible?

No. Deletion removes the collection on the xAI side, so anything relying on it for retrieval stops finding results. Treat it as permanent.

Which credential does it need?

An xAI credential — the same one used by the other Grok nodes, so collections, uploads and queries all share one credential.

Build with the Grok Collections node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need xAI credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.