openapi: 3.0.0
servers:
- url: api.doc-extractor.curacel.co/api
  description: Production
info:
  version: 1.0.0
  title: Curacel Doc Extractor API Docs
  description: |
    # Introduction
    Curacel Doc Extractor is an AI-powered document processing platform that enables automated data extraction from various document types including PDFs, images, and other file formats. This API allows developers to integrate intelligent document processing capabilities into their applications, extracting structured data from unstructured documents with high accuracy.
    This API gives you access to:

      - **Document Processing**
      - **Data Extraction**
      - **Field Mapping**

    In this API reference, you'll find all the information you need about each endpoint and resource.
    - Tip: Make sure to also visit our Developer Portal for guides on Getting started with Doc Extractor https://docs.curacel.co/docs/get-started-with-doc-extractor , and Setting up your environment https://docs.curacel.co/docs/environment
    ## Environment
    We provide a production environment for document processing.
    | Environment | Purpose | Access | | ----------- | ------- | ------ | | `Production` | The Production environment is for live applications that process real documents. You will need real credentials to process documents in this environment, and you will be pulling real data from the documents. | Base URL (cURL): api.doc-extractor.curacel.co/api |
    ## Note
    You'll need to [generate API keys](https://docs.curacel.co/docs/guides/curacel-doc-extractor/authentication) to access the production environment.
  contact:
    email: support@curacel.ai
  license:
    name: Curacel Terms And Agreement
    url: https://curacel.co/terms-and-conditions.php
paths:
  "/extract":
    post:
      tags:
      - Document Processing
      summary: Extract data from documents
      description: Process documents and extract structured data based on specified
        fields
      operationId: extractDocumentData
      requestBody:
        description: Document extraction request
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - files
              - fields
              properties:
                files:
                  type: array
                  description: Array of files to process
                  items:
                    type: object
                    required:
                    - type
                    - file
                    properties:
                      type:
                        type: string
                        enum:
                        - url
                        - base64
                        - file
                        description: Type of file input
                      file:
                        type: object
                        required:
                        - name
                        - content
                        properties:
                          name:
                            type: string
                            description: Name of the file
                          content:
                            type: string
                            description: File content (URL, base64, or file path)
                fields:
                  type: array
                  description: List of fields to extract from the document
                  items:
                    type: string
                options:
                  type: object
                  description: Additional processing options
                  properties:
                    confidence_threshold:
                      type: number
                      minimum: 0
                      maximum: 1
                      default: 0.8
                      description: Minimum confidence threshold for extracted data
                    language:
                      type: string
                      default: en
                      description: Document language for better extraction accuracy
                    format:
                      type: string
                      enum:
                      - json
                      - xml
                      - csv
                      default: json
                      description: Output format for extracted data
      responses:
        '200':
          description: Successful extraction
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    description: Object with filename as key and extracted fields
                      as value
                    additionalProperties:
                      type: object
                      description: Extracted fields for each file
                      additionalProperties:
                        type: string
                        description: Field name mapped to extracted value
                  message:
                    type: string
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
  "/extract/batch":
    post:
      tags:
      - Document Processing
      summary: Batch extract data from multiple documents
      description: Process multiple documents in a single request for improved efficiency
      operationId: batchExtractDocumentData
      requestBody:
        description: Batch document extraction request
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - files
              - fields
              properties:
                files:
                  type: array
                  description: Array of files to process
                  maxItems: 10
                  items:
                    type: object
                    required:
                    - type
                    - file
                    properties:
                      type:
                        type: string
                        enum:
                        - url
                        - base64
                        - file
                        description: Type of file input
                      file:
                        type: object
                        required:
                        - name
                        - content
                        properties:
                          name:
                            type: string
                            description: Name of the file
                          content:
                            type: string
                            description: File content (URL, base64, or file path)
                fields:
                  type: array
                  description: List of fields to extract from the documents
                  items:
                    type: string
                options:
                  type: object
                  description: Additional processing options
                  properties:
                    confidence_threshold:
                      type: number
                      minimum: 0
                      maximum: 1
                      default: 0.8
                    language:
                      type: string
                      default: en
                    format:
                      type: string
                      enum:
                      - json
                      - xml
                      - csv
                      default: json
      responses:
        '200':
          description: Successful batch extraction
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    description: Object with filename as key and extracted fields
                      as value
                    additionalProperties:
                      type: object
                      description: Extracted fields for each file
                      additionalProperties:
                        type: string
                        description: Field name mapped to extracted value
                  message:
                    type: string
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
  "/extract/status/{job_id}":
    get:
      tags:
      - Document Processing
      summary: Get extraction job status
      description: Check the status of a batch extraction job
      operationId: getExtractionJobStatus
      parameters:
      - name: job_id
        in: path
        required: true
        description: Unique identifier for the extraction job
        schema:
          type: string
      responses:
        '200':
          description: Job status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      job_id:
                        type: string
                      status:
                        type: string
                        enum:
                        - pending
                        - processing
                        - completed
                        - failed
                      progress:
                        type: number
                        minimum: 0
                        maximum: 100
                        description: Processing progress percentage
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                      files_processed:
                        type: integer
                      total_files:
                        type: integer
                      estimated_completion:
                        type: string
                        format: date-time
                        description: Estimated completion time
                  message:
                    type: string
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
  "/extract/result/{job_id}":
    get:
      tags:
      - Document Processing
      summary: Get extraction job results
      description: Retrieve the results of a completed extraction job
      operationId: getExtractionJobResults
      parameters:
      - name: job_id
        in: path
        required: true
        description: Unique identifier for the extraction job
        schema:
          type: string
      responses:
        '200':
          description: Extraction results retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    description: Object with filename as key and extracted fields
                      as value
                    additionalProperties:
                      type: object
                      description: Extracted fields for each file
                      additionalProperties:
                        type: string
                        description: Field name mapped to extracted value
                  message:
                    type: string
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                  message:
                    type: string
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token for authentication
  schemas:
    FileInput:
      type: object
      required:
      - type
      - file
      properties:
        type:
          type: string
          enum:
          - url
          - base64
          - file
          description: Type of file input
        file:
          type: object
          required:
          - name
          - content
          properties:
            name:
              type: string
              description: Name of the file
            content:
              type: string
              description: File content (URL, base64, or file path)
    ExtractionOptions:
      type: object
      properties:
        confidence_threshold:
          type: number
          minimum: 0
          maximum: 1
          default: 0.8
          description: Minimum confidence threshold for extracted data
        language:
          type: string
          default: en
          description: Document language for better extraction accuracy
        format:
          type: string
          enum:
          - json
          - xml
          - csv
          default: json
          description: Output format for extracted data
    ExtractedData:
      type: object
      properties:
        file_name:
          type: string
          description: Name of the processed file
        extracted_fields:
          type: object
          description: Extracted field values
          additionalProperties:
            type: string
        confidence_scores:
          type: object
          description: Confidence scores for each extracted field
          additionalProperties:
            type: number
        processing_time:
          type: number
          description: Time taken to process the file in seconds
security:
- ApiKeyAuth: []
- BearerAuth: []
