---
agentTools:
  projectIndex: https://preemo.readme.io/llms.txt
---

# Create RAG collection

Creates a new collection of RAG documents.

# OpenAPI definition

```json
{
  "externalDocs": {
    "description": "Gradient AI documentation",
    "url": "https://docs.gradient.ai"
  },
  "info": {
    "contact": {
      "email": "support@gradient.ai",
      "name": "Gradient AI Support",
      "url": "https://docs.gradient.ai/discuss"
    },
    "description": "Interface for interacting with Gradient AI.",
    "title": "Gradient AI API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "security": [
    {
      "AccessToken": []
    }
  ],
  "servers": [
    {
      "description": "Production endpoint",
      "url": "https://api.gradient.ai/api"
    },
    {
      "url": "http://localhost:3026/api"
    }
  ],
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "components": {
    "securitySchemes": {
      "AccessToken": {
        "scheme": "bearer",
        "type": "http"
      }
    },
    "schemas": {
      "CreateRagCollectionSuccess": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "id"
        ]
      },
      "CreateRagCollectionError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "message"
        ]
      },
      "fileChunker": {
        "type": "object",
        "properties": {
          "chunkerType": {
            "type": "string",
            "enum": [
              "fileChunker"
            ]
          }
        },
        "required": [
          "chunkerType"
        ]
      },
      "meaningBasedChunker": {
        "type": "object",
        "properties": {
          "chunkerType": {
            "type": "string",
            "enum": [
              "meaningBasedChunker"
            ]
          },
          "overlap": {
            "type": "integer",
            "nullable": true,
            "minimum": 0
          },
          "sentenceGroupLength": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "similiarityPercentThreshold": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 100
          },
          "size": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true
          }
        },
        "required": [
          "chunkerType"
        ]
      },
      "normalChunker": {
        "type": "object",
        "properties": {
          "chunkerType": {
            "type": "string",
            "enum": [
              "normalChunker"
            ]
          },
          "overlap": {
            "type": "integer",
            "nullable": true,
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true
          }
        },
        "required": [
          "chunkerType"
        ]
      },
      "sentenceWithContextChunker": {
        "type": "object",
        "properties": {
          "chunkerType": {
            "type": "string",
            "enum": [
              "sentenceWithContextChunker"
            ]
          },
          "contextSentences": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "overlap": {
            "type": "integer",
            "nullable": true,
            "minimum": 0
          },
          "size": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true
          }
        },
        "required": [
          "chunkerType"
        ]
      },
      "CreateRagCollectionBodyParams": {
        "type": "object",
        "properties": {
          "chunker": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/fileChunker"
              },
              {
                "$ref": "#/components/schemas/meaningBasedChunker"
              },
              {
                "$ref": "#/components/schemas/normalChunker"
              },
              {
                "$ref": "#/components/schemas/sentenceWithContextChunker"
              },
              {
                "nullable": true
              }
            ],
            "discriminator": {
              "mapping": {
                "fileChunker": "#/components/schemas/fileChunker",
                "meaningBasedChunker": "#/components/schemas/meaningBasedChunker",
                "normalChunker": "#/components/schemas/normalChunker",
                "sentenceWithContextChunker": "#/components/schemas/sentenceWithContextChunker"
              },
              "propertyName": "chunkerType"
            }
          },
          "files": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                },
                "name": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "id",
                "name"
              ]
            },
            "maxItems": 20
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "slug": {
            "type": "string",
            "enum": [
              "bge-large"
            ]
          }
        },
        "required": [
          "name",
          "slug"
        ]
      }
    }
  },
  "paths": {
    "/rag-collections": {
      "post": {
        "description": "Creates a new collection of RAG documents.",
        "operationId": "CreateRagCollection",
        "summary": "Create RAG collection",
        "tags": [
          "RAG"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "x-gradient-workspace-id",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRagCollectionBodyParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRagCollectionSuccess"
                }
              }
            }
          },
          "4XX": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRagCollectionError"
                }
              }
            }
          }
        }
      }
    }
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 201,
      "2": 83,
      "3": 144,
      "4": 228,
      "5": 32,
      "6": 103,
      "7": 0,
      "8": 117,
      "9": 236,
      "10": 84,
      "11": 142
    }
  }
}
```