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

# Synchronous Parse

> Parse a document into Markdown or HTML synchronously. Returns the full result immediately.

Provide a `file://<uuid>` URI (from file upload) or a public URL as input. Optionally reference a saved config or provide inline parameters.

> **Tip:** You can save and reuse parse settings by creating a config via [Create Config](/docs/api-reference-v2/configuration-management/create-config). Pass the returned `config_id` instead of repeating `parse_config` each time.



## OpenAPI

````yaml /openapi-extraction-v2.json post /api/v2/parse/sync
openapi: 3.1.0
info:
  title: Nanonets V2 API
  description: >-
    Stateful document processing API with file management, reusable configs, and
    JSON-body endpoints for parse, extract, and classify operations.


    **Key differences from V1:**

    - JSON request bodies instead of multipart/form-data

    - Upload files once via `POST /files`, then reference them with
    `file://<uuid>` URIs

    - Save and reuse processing configurations via `config://<uuid>` URIs

    - Batch processing via list inputs on async endpoints (up to 50 items)

    - Document classification with `document` and `split` modes
  version: 2.0.0
  contact:
    name: Nanonets Support
    email: info@nanonets.com
servers:
  - url: https://extraction-api.nanonets.com
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v2/parse/sync:
    post:
      tags:
        - Document Parsing
      summary: Synchronous Parse
      description: >-
        Parse a document into Markdown or HTML synchronously. Returns the full
        result immediately.


        Provide a `file://<uuid>` URI (from file upload) or a public URL as
        input. Optionally reference a saved config or provide inline parameters.


        > **Tip:** You can save and reuse parse settings by creating a config
        via [Create
        Config](/docs/api-reference-v2/configuration-management/create-config).
        Pass the returned `config_id` instead of repeating `parse_config` each
        time.
      operationId: v2_parse_sync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ParseRequest'
            examples:
              with_file_uri:
                summary: Using uploaded file
                value:
                  input: file://a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  parse_config:
                    output_format: markdown
              with_url:
                summary: Using public URL
                value:
                  input: https://example.com/document.pdf
                  parse_config:
                    output_format: html
                    custom_instructions: Preserve table formatting
              with_saved_config:
                summary: Using saved config
                value:
                  input: file://a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  config_id: config://b2c3d4e5-f6a7-8901-bcde-f12345678901
      responses:
        '200':
          description: Parse completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Response'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    ParseRequest:
      type: object
      required:
        - input
      properties:
        input:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
              maxItems: 50
          description: '`file://<uuid>` URI or public URL. Async accepts a list (max 50).'
        config_id:
          type: string
          description: '`config://<uuid>` of a saved parse config'
        parse_config:
          $ref: '#/components/schemas/ParseConfig'
    V2Response:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
        message:
          type: string
        record_id:
          type: string
          description: Job ID for retrieving results
        file_id:
          type: string
          description: '`file://<uuid>` reference'
        config_id:
          type: string
          description: '`config://<uuid>` reference'
        status:
          type: string
          enum:
            - completed
            - processing
            - failed
        result:
          $ref: '#/components/schemas/V2Result'
        processing_time:
          type: number
          description: Time in seconds
        filename:
          type: string
        output_format:
          type: string
        file_size:
          type: integer
          description: Size in bytes
    ParseConfig:
      type: object
      properties:
        output_format:
          type: string
          enum:
            - markdown
            - html
          default: markdown
          description: Output format
        custom_instructions:
          type: string
          maxLength: 8000
          description: Custom parsing instructions
        prompt_mode:
          type: string
          enum:
            - append
            - replace
          default: append
          description: >-
            `append`: add to base prompt, `replace`: use only custom
            instructions
        markdown_options:
          type: string
          description: Markdown-specific options (e.g. `financial-docs`)
        include_metadata:
          type: string
          description: 'Comma-separated: `confidence_score`, `bounding_boxes`'
    V2Result:
      type: object
      properties:
        content:
          oneOf:
            - type: string
            - type: object
            - type: array
          description: Extracted or parsed content
        elements:
          type: array
          items:
            type: object
          description: >-
            Element-wise breakup with bounding boxes (parse only, when metadata
            requested)
        overall_confidence:
          type: integer
          minimum: 0
          maximum: 100
          description: Document-level confidence score
        page_confidence:
          type: object
          additionalProperties:
            type: integer
          description: Per-page confidence scores
        confidence_source:
          type: string
          description: Source of confidence scores
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            oneOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string
  responses:
    BadRequest:
      description: Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/HTTPValidationError'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'API key as Bearer token: `Authorization: Bearer YOUR_API_KEY`'

````