> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Chunk Job

> Rechunk a parse result with a different chunking strategy.

This endpoint initiates rechunking of an existing parse result using the specified
chunking strategy. The operation is performed asynchronously via Temporal workflows.

Args:
    project_id: Project ID that the parse result belongs to
    parse_result_id: Parse result ID to rechunk
    request: Rechunk parse result request with chunking strategy and options

Returns:
    Job entity that can be used to track progress

Raises:
    HTTPException: If the parse result is not found or other errors occur



## OpenAPI

````yaml https://dex.sgp.scale.com/openapi.json post /v1/projects/{project_id}/parse/{parse_result_id}/rechunk
openapi: 3.1.0
info:
  title: Document Understanding API
  description: API for uploading and processing documents
  version: 0.4.5
servers: []
security:
  - ApiKey: []
    AccountId: []
tags:
  - name: Projects
    description: Operations related to project creation and management
  - name: Files
    description: Operations related to file upload and access
  - name: Parse
    description: Operations related to starting parse jobs and accessing their results
  - name: Vector Stores
    description: Operations related to vector store creation and management
  - name: Extract
    description: Operations related to starting extract jobs and accessing their results
  - name: Research
    description: Dex Research agent kickoff and results.
  - name: Jobs
    description: Operations related to monitoring jobs and their status
paths:
  /v1/projects/{project_id}/parse/{parse_result_id}/rechunk:
    post:
      tags:
        - Parse
      summary: Create Chunk Job
      description: >-
        Rechunk a parse result with a different chunking strategy.


        This endpoint initiates rechunking of an existing parse result using the
        specified

        chunking strategy. The operation is performed asynchronously via
        Temporal workflows.


        Args:
            project_id: Project ID that the parse result belongs to
            parse_result_id: Parse result ID to rechunk
            request: Rechunk parse result request with chunking strategy and options

        Returns:
            Job entity that can be used to track progress

        Raises:
            HTTPException: If the parse result is not found or other errors occur
      operationId: >-
        create_chunk_job_v1_projects__project_id__parse__parse_result_id__rechunk_post
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
        - name: parse_result_id
          in: path
          required: true
          schema:
            type: string
            title: Parse Result Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RechunkParseResultRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobEntity'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RechunkParseResultRequest:
      properties:
        chunking_options:
          oneOf:
            - $ref: '#/components/schemas/TokenSizeChunkingOptions'
            - $ref: '#/components/schemas/RecursiveChunkingOptions'
            - $ref: '#/components/schemas/PageChunkingOptions'
            - $ref: '#/components/schemas/SectionChunkingOptions'
          title: Chunking Options
          description: Chunking options for rechunking
          discriminator:
            propertyName: strategy
            mapping:
              by_page:
                $ref: '#/components/schemas/PageChunkingOptions'
              by_section:
                $ref: '#/components/schemas/SectionChunkingOptions'
              recursive:
                $ref: '#/components/schemas/RecursiveChunkingOptions'
              token_size:
                $ref: '#/components/schemas/TokenSizeChunkingOptions'
      type: object
      required:
        - chunking_options
      title: RechunkParseResultRequest
      description: Request model for rechunking a parse result.
    JobEntity:
      properties:
        id:
          type: string
          title: Id
          description: ID of the entity
        project_id:
          type: string
          title: Project Id
          description: ID of the project
        object:
          type: string
          const: job
          title: Object
          default: job
        operation:
          $ref: '#/components/schemas/JobOperationType'
          description: Operation type (e.g., 'parse')
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Current job status
        source_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Id
          description: Source document/file ID
        correlation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Correlation Id
          description: Request correlation ID for tracing
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the job was created
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
          description: When the job started processing
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: When the job completed
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Result
          description: Job result payload when completed
        progress:
          anyOf:
            - $ref: '#/components/schemas/BatchParseProgress'
            - type: 'null'
          description: Live progress payload (used by batch jobs)
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if job failed
        history:
          anyOf:
            - items:
                $ref: '#/components/schemas/JobHistoryEvent'
              type: array
            - type: 'null'
          title: History
          description: Timeline of job execution events
      type: object
      required:
        - id
        - project_id
        - operation
        - status
        - created_at
      title: JobEntity
      description: Job response model representing an asynchronous operation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TokenSizeChunkingOptions:
      properties:
        strategy:
          type: string
          const: token_size
          title: Strategy
          description: The chunking strategy
          default: token_size
        chunk_size:
          type: integer
          exclusiveMinimum: 0
          title: Chunk Size
          description: Target size of each chunk in tokens
          default: 512
        chunk_overlap:
          type: integer
          minimum: 0
          title: Chunk Overlap
          description: Number of overlapping tokens between chunks
          default: 50
        encoding_name:
          type: string
          title: Encoding Name
          description: Tiktoken encoding name (e.g., cl100k_base for GPT-4)
          default: cl100k_base
      type: object
      title: TokenSizeChunkingOptions
      description: >-
        Token-based chunking: Splits text into chunks by token count using a
        tokenizer (e.g., tiktoken). Best for LLM APIs with token limits,
        embedding models, and cost optimization. Use when you need precise
        control over token usage.
    RecursiveChunkingOptions:
      properties:
        strategy:
          type: string
          const: recursive
          title: Strategy
          description: The chunking strategy
          default: recursive
        chunk_size:
          type: integer
          exclusiveMinimum: 0
          title: Chunk Size
          description: Target size of each chunk in characters
          default: 1000
        chunk_overlap:
          type: integer
          minimum: 0
          title: Chunk Overlap
          description: Number of overlapping characters between chunks
          default: 200
        separators:
          items:
            type: string
          type: array
          title: Separators
          description: List of separators to try in order
          default:
            - |+


            - |+

            - ' '
            - ''
        keep_separator:
          type: boolean
          title: Keep Separator
          description: Whether to keep the separator in the chunks
          default: true
      type: object
      title: RecursiveChunkingOptions
      description: >-
        Recursive text splitting: Uses a hierarchy of separators (paragraphs →
        sentences → words) to preserve natural text boundaries. Best for
        articles, documentation, and RAG systems where readability and semantic
        coherence matter.
    PageChunkingOptions:
      properties:
        strategy:
          type: string
          const: by_page
          title: Strategy
          description: The chunking strategy
          default: by_page
        pages_per_chunk:
          type: integer
          exclusiveMinimum: 0
          title: Pages Per Chunk
          description: Number of pages to include in each chunk
          default: 1
      type: object
      title: PageChunkingOptions
      description: >-
        Page-based chunking: Splits documents by page boundaries, grouping
        complete pages together. Best for legal documents, forms, and reports
        where page references are important and page structure should be
        preserved.
    SectionChunkingOptions:
      properties:
        strategy:
          type: string
          const: by_section
          title: Strategy
          description: The chunking strategy
          default: by_section
        section_headers:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Section Headers
          description: Markdown-style headers that denote sections
        include_header_in_chunk:
          type: boolean
          title: Include Header In Chunk
          description: Whether to include the section header in the chunk
          default: true
      type: object
      title: SectionChunkingOptions
      description: >-
        Section-based chunking: Splits text by section headers (e.g., markdown
        #, ##, ###) to keep complete topics together. Best for structured
        documents like technical manuals, wikis, and academic papers where
        semantic coherence within topics is crucial.
    JobOperationType:
      type: string
      enum:
        - parse
        - batch_parse
        - extract
        - research
        - vector_store
        - chunk
        - summarization
        - create_index
        - update_index
      title: JobOperationType
      description: Enum for job operation values.
    JobStatus:
      type: string
      enum:
        - pending
        - running
        - succeeded
        - partially_succeeded
        - failed
        - cancelled
      title: JobStatus
      description: Enum for job status values.
    BatchParseProgress:
      properties:
        total:
          type: integer
          title: Total
          description: Total number of files in the batch
        succeeded:
          type: integer
          title: Succeeded
          description: Number of successfully parsed files
        failed:
          type: integer
          title: Failed
          description: Number of files that failed to parse
        cancelled:
          type: integer
          title: Cancelled
          description: Number of cancelled child jobs
        pending:
          type: integer
          title: Pending
          description: Number of files still pending (0 when job is terminal)
        child_jobs:
          items:
            $ref: '#/components/schemas/BatchChildJobInfo'
          type: array
          title: Child Jobs
          description: Per-child job status
      type: object
      required:
        - total
        - succeeded
        - failed
        - cancelled
        - pending
        - child_jobs
      title: BatchParseProgress
      description: Live progress tracking for a batch parse job.
    JobHistoryEvent:
      properties:
        step:
          type: string
          title: Step
          description: Human-readable step name
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: When this event occurred
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
          description: Duration in milliseconds (for completed steps)
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: Event status (e.g., 'completed', 'failed')
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Additional event details
      type: object
      required:
        - step
        - timestamp
      title: JobHistoryEvent
      description: A single event in the job execution timeline.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    BatchChildJobInfo:
      properties:
        source_document_id:
          type: string
          title: Source Document Id
          description: Source document ID
        job_id:
          type: string
          title: Job Id
          description: Child job ID
        status:
          $ref: '#/components/schemas/JobStatus'
          description: Status of the child job
        parse_result_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parse Result Id
          description: Parse result ID if succeeded
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message if failed
      type: object
      required:
        - source_document_id
        - job_id
        - status
      title: BatchChildJobInfo
      description: Status of a single child job within a batch.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication
    AccountId:
      type: apiKey
      in: header
      name: x-selected-account-id
      description: Selected Account ID

````