---
title: "Create Chunking Job"
method: POST
path: "/document/chunking/create_job"
tags: ["Chunking"]
---

# Create Chunking Job

`POST /document/chunking/create_job`

## Endpoint to Create a Chunking Job
This endpoint creates a chunking job and returns the job ID that can be used to get the status of the job.

***

## Request Body

| Field               | Type   | Description                      |
|---------------------|--------|----------------------------------|
| extraction_job_id   | str    | The ID of the extraction job.    |
| chunking_strategy   | str    | The chunking strategy to use.    |
| chunking_params     | Optional[ChunkingParams] | Optional parameters for the chunking strategy. |

***

#### Chunking Strategies

- **fixed_size**: Chunks the file into fixed-size segments.
- **recursive**: Recursively splits the file into smaller segments based on a delimiter.

***

#### Chunking Parameters

| Field               | Type   | Description                      |
|---------------------|--------|----------------------------------|
| chunk_size          | int    | The size of each chunk in character. |
| chunk_overlap       | int    | The number of overlapping characters between chunks. |

***

## Example Request Body

```json

{
    "extraction_job_id": "123456",
    "chunking_strategy": "fixed_size",
    "chunking_params": {
        "chunk_size": 1000,
        "chunk_overlap": 100
    }
}

```

***

## Response Body

| Field               | Type   | Description                      |
|---------------------|--------|----------------------------------|
| chunking_job_id     | str    | The ID of the created job.       |
| extraction_job_id   | str    | The ID of the extraction job.     |
| status              | str    | The status of the created job. Returns WAITING_QUEUE_ALLOCATION if the job is created successfully. |
| total_file_count    | int    | The total number of files to be chunked. |

***

#### Errors

- **400 Bad Request**: If a chunking job with status 'WAITING_QUEUE_ALLOCATION' already exists.
- **400 Bad Request**: If the extraction job is not in COMPLETED or COMPLETED_WITH_ERRORS state.
- **500 Internal Server Error**: If there is an unexpected error during the creation of the chunking job.

## Request body

- CreateChunkingJobRequest
  - `extraction_job_id` string, required
  - `chunking_strategy` 'fixed_size' | 'recursive' | 'page', required
  - `chunking_params` ChunkingParams
    - `chunk_size` integer
    - `chunk_overlap` integer

## Response `200`

Successful Response

- CreateChunkingJobResponse
  - `chunking_job_id` string, required
  - `extraction_job_id` string, required
  - `status` string, required
  - `total_file_count` integer, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/aws-samples/apis/generative-ai-foundational-platform-api.md) · [All operations](https://skmtc.dev/aws-samples/apis/generative-ai-foundational-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/aws-samples/generative-ai-foundational-platform-api/revisions/8831d08902e9/schema)
