> ## 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 Extract Job

> Create a new extract job.

This endpoint creates an extraction job that runs **single-pass** LLM extraction
from a parse result or vector store search context. For agentic (decompose / ReAct)
extraction, use ``POST …/research`` instead; requests with ``use_agentic=True`` are rejected.

Args:
    request: Extract job request containing source_id and parameters

Returns:
    JobEntity: The created job entity

Raises:
    HTTPException: If source not found or workflow startup fails



## OpenAPI

````yaml https://dex.sgp.scale.com/openapi.json post /v1/projects/{project_id}/extract
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}/extract:
    post:
      tags:
        - Extract
      summary: Create Extract Job
      description: >-
        Create a new extract job.


        This endpoint creates an extraction job that runs **single-pass** LLM
        extraction

        from a parse result or vector store search context. For agentic
        (decompose / ReAct)

        extraction, use ``POST …/research`` instead; requests with
        ``use_agentic=True`` are rejected.


        Args:
            request: Extract job request containing source_id and parameters

        Returns:
            JobEntity: The created job entity

        Raises:
            HTTPException: If source not found or workflow startup fails
      operationId: create_extract_job_v1_projects__project_id__extract_post
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/ExtractFromParseResultJobRequest'
                - $ref: '#/components/schemas/ExtractFromVectorStoreJobRequest'
              title: Request
      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:
    ExtractFromParseResultJobRequest:
      properties:
        parameters:
          $ref: '#/components/schemas/ExtractionParameters'
          description: Extraction parameters including schema and prompts
        source_id:
          type: string
          title: Source Id
          description: The ID of the resource to extract from (file_... or job_...)
      type: object
      required:
        - parameters
        - source_id
      title: ExtractFromParseResultJobRequest
      description: Request model for creating an extract job from a parse result.
      example:
        parameters:
          extraction_schema:
            properties:
              invoice_id:
                description: The unique invoice identifier.
                type: string
              total_amount:
                description: The final amount due.
                type: number
            required:
              - invoice_id
              - total_amount
            type: object
          generate_citations: true
          model: openai/gpt-4
          system_prompt: >-
            You are an expert financial analyst. Extract data with high
            precision.
          user_prompt: >-
            The invoice total can be found near the bottom right. Pay close
            attention to the 'Total Due' label.
        source_id: job_parse_xyz...
    ExtractFromVectorStoreJobRequest:
      properties:
        parameters:
          $ref: '#/components/schemas/ExtractionParameters'
          description: Extraction parameters including schema and prompts
        search_config:
          $ref: '#/components/schemas/SearchConfig'
          description: The search config to use for the extract job
      type: object
      required:
        - parameters
        - search_config
      title: ExtractFromVectorStoreJobRequest
      description: Request model for creating an extract job from a vector store.
      example:
        parameters:
          extraction_schema:
            properties:
              invoice_id:
                description: The unique invoice identifier.
                type: string
              total_amount:
                description: The final amount due.
                type: number
            required:
              - invoice_id
              - total_amount
            type: object
          generate_citations: true
          model: openai/gpt-4
          system_prompt: >-
            You are an expert financial analyst. Extract data with high
            precision.
          user_prompt: >-
            The invoice total can be found near the bottom right. Pay close
            attention to the 'Total Due' label.
        search_config:
          filters:
            file_id: file_xyz...
          query_type: hybrid
          rerank_config:
            model: rerank-model-v1
            top_n: 5
          top_k: 10
          vector_store_id: vector_store_xyz...
    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
    ExtractionParameters:
      properties:
        model:
          type: string
          title: Model
          description: >-
            LLM model to use for extraction (e.g., 'openai/gpt-4',
            'anthropic/claude-3-sonnet')
        model_kwargs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Model Kwargs
          description: Additional kwargs for the LLM model
        extraction_schema:
          additionalProperties: true
          type: object
          title: Extraction Schema
          description: JSON schema defining the desired output structure
        system_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: System Prompt
          description: High-level instructions or context for the extraction model
        user_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: User Prompt
          description: Specific hints about the current document
        generate_citations:
          type: boolean
          title: Generate Citations
          description: Whether to return bounding boxes for extracted values
          default: true
        generate_confidence:
          type: boolean
          title: Generate Confidence
          description: Whether to return confidence scores for extracted values
          default: true
        use_agentic:
          type: boolean
          title: Use Agentic
          description: >-
            Must stay False on POST …/extract (400 if True). The extract
            endpoint only runs single-pass LLM extraction. For agentic
            (decompose / ReAct) extraction, use POST …/research with
            ResearchJobRequest.
          default: false
        agentic_tools:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/ResearchToolConfigEntry'
              type: object
            - type: 'null'
          title: Agentic Tools
          description: >-
            Research-shaped tool map; ignored by the extract HTTP path
            (single-pass only). Use POST …/research for per-tool config. Same
            key shape as ResearchJobRequest.tools.
        execute_dependent_subtask_tool_hints:
          type: boolean
          title: Execute Dependent Subtask Tool Hints
          description: >-
            Ignored by POST …/extract (single-pass only). When True on a
            Research job, dependent subtasks execute their warm-start tool hints
            as real searches instead of converting them to intent-only guidance.
          default: false
        agent_settings:
          anyOf:
            - $ref: '#/components/schemas/AgenticSettings'
            - type: 'null'
          description: >-
            Ignored by POST …/extract. If ``agent_settings.use_agentic`` is
            True, the extract request is rejected (400); configure agentic
            behaviour via POST …/research instead.
      type: object
      required:
        - model
        - extraction_schema
      title: ExtractionParameters
      description: Parameters for extraction operation.
    SearchConfig:
      properties:
        top_k:
          anyOf:
            - type: integer
            - type: 'null'
          title: Top K
          description: Number of results to return
        filters:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - additionalProperties: true
                    type: object
              type: object
            - type: 'null'
          title: Filters
          description: 'Filters to apply to the search. For example, {file_id: 123}'
        rerank_config:
          anyOf:
            - $ref: '#/components/schemas/RerankConfig'
            - type: 'null'
          description: >-
            Reranking configuration. This is only applicable for SGP Vector
            Stores.
        vector_store_id:
          type: string
          title: Vector Store Id
          description: ID of the vector store
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: >-
            Engine-specific external identifier for the vector store. When set,
            this is passed directly to the engine's search/delete methods
            instead of vector_store_id. Populated from
            VectorStoreEntity.external_id.
      additionalProperties: true
      type: object
      required:
        - vector_store_id
      title: SearchConfig
    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
    ResearchToolConfigEntry:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: When False, the tool is not offered to the agent
          default: true
        config:
          additionalProperties: true
          type: object
          title: Config
          description: Tool-specific configuration (e.g. top_k, filters, rerank_config)
      type: object
      title: ResearchToolConfigEntry
      description: >-
        Per-tool enablement and opaque config (e.g. search_config for
        similarity_search).
    AgenticSettings:
      properties:
        use_agentic:
          type: boolean
          title: Use Agentic
          description: >-
            Legacy mirror of ExtractionParameters.use_agentic. On POST
            …/extract, True causes a 400 rejection (extract is single-pass
            only). For agentic runs use POST …/research with ResearchJobRequest.
          default: false
        planning_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Planning Model
          description: >-
            Model for planning steps (deciding what to search, decomposing
            tasks). Defaults to the main extraction model.
        acting_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Acting Model
          description: >-
            Model for acting steps (producing the final extracted output).
            Defaults to the main extraction model.
        reflection_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Reflection Model
          description: >-
            Model for reflection steps (synthesizing search results, aggregating
            subtasks). Defaults to the main extraction model.
        max_turns:
          type: integer
          title: Max Turns
          description: >-
            Maximum number of agent turns (decompose→run→aggregate cycles)
            before forcing completion.
          default: 2
        max_context_tokens:
          type: integer
          title: Max Context Tokens
          description: Max tokens for LLM context (system + messages). Trims when exceeded.
          default: 100000
        max_reasoning_hops:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Reasoning Hops
          description: >-
            Max reasoning hops (search or extract actions) per subtask in the
            ReAct loop. Default is 10.
        max_waves:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Waves
          description: >-
            Max dependency waves per turn. Subtasks beyond this depth are
            promoted to the last wave. Default is 3.
        max_validation_fix_attempts:
          type: integer
          title: Max Validation Fix Attempts
          description: Max attempts to fix schema validation errors via LLM reflection.
          default: 2
        decompose_prompt_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Decompose Prompt Template
          description: Custom decompose prompt template. When None, uses the default.
        decompose_rules:
          anyOf:
            - type: string
            - type: 'null'
          title: Decompose Rules
          description: >-
            Extra rules appended to the decompose prompt. When None, uses
            built-in rules.
        search_rules:
          anyOf:
            - type: string
            - type: 'null'
          title: Search Rules
          description: >-
            Extra rules appended to the reasoning step search action. When None,
            uses built-in rules.
        extraction_rules:
          anyOf:
            - type: string
            - type: 'null'
          title: Extraction Rules
          description: >-
            Extra rules appended to the reasoning step extract action. When
            None, uses built-in rules.
      type: object
      title: AgenticSettings
      description: >-
        Configuration for the agentic extractor (models, turns, hop limits,
        prompt templates).


        Tool enablement and search-summary scope for vector-store agentic
        extract live on

        :class:`ExtractionParameters` as ``agentic_tools`` (Research-shaped
        map); dependent-hint

        execution uses
        ``ExtractionParameters.execute_dependent_subtask_tool_hints``.
    RerankConfig:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Reranking model to use (uses system default if not specified)
        top_n:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Top N
          description: Number of results to keep after reranking (defaults to top_k)
        instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: Instruction
          description: >-
            Custom instruction for the reranking model (e.g., 'Given a medical
            question, retrieve relevant clinical passages'). Only applies to
            instruction-following rerankers like Qwen3.
      type: object
      title: RerankConfig
    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

````