Create Collection from Local File
Upload a local file via multipart/form-data with chunking and training settings to create a collection and start indexing.
Endpoint Overview
- Method :
POST - Path :
/api/core/dataset/collection/create/localFile - Module : Datasets / Create Collections
- Authentication :
Authorization: Bearer <apiKey>—Personal API Key (access scoped by team member permissions) (see API Getting Started ) - Interactive Try-It-Out : Open in Scalar API Explorer (self-hosted instances: replace the origin with
<instance>/apidoc/systemopenapi#tag/%E9%9B%86%E5%90%88%E5%88%9B%E5%BB%BA/POST/core/dataset/collection/create/localFile)
Description & Notes
Upload a local file via multipart/form-data ( file binary part + JSON-serialized data part), store it in S3, create the collection, and trigger training.
Request Parameters
Request Body ( multipart/form-data )
| Field | Type | Required | Default | Constraints & Description |
|---|---|---|---|---|
file | binary (file) | Yes | - | Uploaded binary file |
data | object | Yes | - | Collection parameters passed as a serialized JSON string |
data.trainingType | string (enum) | No | - | Training mode. Allowed values: chunk , qa , imageParse , backup , template , auto |
data.chunkTriggerType | string (enum) | No | - | Chunk trigger mode. Allowed values: minSize , forceChunk , maxSize |
data.chunkTriggerMinSize | number | No | - | Minimum size threshold to trigger chunking |
data.dataEnhanceCollectionName | boolean | No | - | Prepend collection name to chunks |
data.imageIndex | boolean | No | - | Enable image indexing |
data.autoIndexes | boolean | No | - | Auto-generate vector indexes |
data.indexPrefixTitle | boolean | No | - | Prefix title for indexes |
data.chunkSettingMode | string (enum) | No | - | Chunk setting preset ( auto , custom , or intelligent ). Allowed values: auto , custom , intelligent |
data.chunkSplitMode | string (enum) | No | - | Chunk splitting mode. Allowed values: paragraph , size , char |
data.paragraphChunkAIMode | string (enum) | No | - | AI paragraph chunking mode. Allowed values: auto , force , forbid |
data.paragraphChunkDeep | number | No | - | Paragraph heading split depth |
data.paragraphChunkMinSize | number | No | - | Minimum paragraph chunk size |
data.chunkSize | number | No | - | Target chunk size |
data.chunkSplitter | string | No | - | Custom primary chunk separator |
data.indexSize | number | No | - | Vector index chunk size |
data.qaPrompt | string | No | - | Custom prompt for Q&A extraction |
data.parentId | string | null | No | - | Parent folder ID |
data.metadata | object | No | - | Metadata |
data.customPdfParse | boolean | No | - | Custom PDF parser |
data.datasetId | string | Yes | - | Dataset ID |
data.tags | string | object[] | No | - | List of collection tags. String items map to legacy default_tag tags; object items { tag, value } resolve by tag name. |
Request Examples
Replace YOUR_API_KEY and placeholder IDs before running. Self-hosted users should replace the base URL with <instance>/api .
cURL Example
curl --fail-with-body -X POST "https://cloud.fastgpt.io/api/core/dataset/collection/create/localFile" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/document.pdf" \
-F 'data={"datasetId":"string"};type=application/json'Minimal Valid JSON Body
{
"datasetId": "string"
}Response Schema & Examples
Successful /api/* calls return the standard FastGPT envelope { "code": 200, "statusText": "", "message": "", "data": ... } , where data matches the 200 schema below (when a payload schema is declared; otherwise refer to the status description for runtime data semantics).
HTTP 200
Successfully returned collection ID and chunk insertion results
Returns the standard FastGPT success envelope ( { "code": 200, "statusText": "", "message": "", "data": ... } ). The exact data payload schema is not declared in this OpenAPI contract; refer to the status description above or inspect runtime responses.
Last updated