> ## 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.

# Batch Classification

> Classify multiple documents by providing a list of inputs (up to 50). Each document is classified using the same categories and mode.

Returns a `BatchResponse` with per-item completion status.

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



## OpenAPI

````yaml /openapi-extraction-v2.json post /api/v2/classify/async
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/classify/async:
    post:
      tags:
        - Document Classification
      summary: Batch Classification
      description: >-
        Classify multiple documents by providing a list of inputs (up to 50).
        Each document is classified using the same categories and mode.


        Returns a `BatchResponse` with per-item completion status.


        > **Tip:** You can save and reuse classification settings (categories &
        mode) by creating a config via [Create
        Config](/docs/api-reference-v2/configuration-management/create-config).
        Pass the returned `config_id` instead of repeating
        `classification_config` each time.
      operationId: v2_classify_async
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyRequest'
            examples:
              batch:
                summary: Batch classification
                value:
                  input:
                    - file://a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    - file://c3d4e5f6-a7b8-9012-cdef-a12345678901
                  classification_config:
                    categories:
                      - name: Invoice
                      - name: Receipt
                    mode: document
      responses:
        '202':
          description: Batch classification queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    ClassifyRequest:
      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 classify config'
        classification_config:
          $ref: '#/components/schemas/ClassifyConfig'
    BatchResponse:
      type: object
      required:
        - success
        - message
        - total
        - items
      properties:
        success:
          type: boolean
        message:
          type: string
        batch_id:
          type: string
          format: uuid
        total:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/BatchItemStatus'
    ClassifyConfig:
      type: object
      required:
        - categories
      properties:
        categories:
          type: array
          items:
            $ref: '#/components/schemas/ClassifyCategory'
          minItems: 1
          maxItems: 50
          description: List of categories (max 50, names must be unique)
        mode:
          type: string
          enum:
            - document
            - split
          default: document
          description: >-
            `document`: single best-fit category for the whole file. `split`:
            page-level grouping by category.
    BatchItemStatus:
      type: object
      required:
        - input
        - status
      properties:
        input:
          type: string
        record_id:
          type: string
        file_id:
          type: string
        status:
          type: string
          enum:
            - queued
            - completed
            - failed
        error:
          type: string
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ClassifyCategory:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: Category name
        description:
          type: string
          maxLength: 1000
          description: Optional description to help with classification
    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'
    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`'

````