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

# ADE Classify

> Classify each page of a document into classes you define. Accepts a PDF, an image, or an Office document, plus the list of candidate classes; returns one predicted class per page. Runs synchronously and returns the result inline.



## OpenAPI

````yaml /dpt3/openapi-adev2.json post /v1/ade/classify
openapi: 3.1.0
info:
  title: >-
    LandingAI Agentic Document Extraction (ADE) Gen2 API: Parse, Extract, and
    Ground Documents with DPT-3
  description: >-
    Parse and extract data from documents with DPT-3, a document parsing model
    from LandingAI, using the Agentic Document Extraction (ADE) v2 endpoints.
    Parse converts PDFs and images into structured Markdown and elements with
    per-element grounding (page numbers and coordinates) for RAG, search, and
    extraction pipelines. Extract pulls specific fields from parsed Markdown
    using a JSON schema. Ground maps extracted fields back to the source blocks,
    with page numbers and bounding boxes for each value. Documentation:
    https://docs.landing.ai
  version: 1.0.0
servers:
  - url: https://api.ade.landing.ai
    description: Production API
security: []
paths:
  /v1/ade/classify:
    post:
      tags:
        - Classify
      summary: ADE Classify
      description: >-
        Classify each page of a document into classes you define. Accepts a PDF,
        an image, or an Office document, plus the list of candidate classes;
        returns one predicted class per page. Runs synchronously and returns the
        result inline.
      operationId: v1-ade-classify_run_sync
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                document:
                  type: string
                  format: binary
                  description: >-
                    The file to process. Provide either `document` or
                    `document_url`, not both.
                document_url:
                  type: string
                  description: >-
                    A publicly accessible URL to the file to process. Provide
                    either `document` or `document_url`, not both.
                classes:
                  type: string
                  title: Classes
                  description: >-
                    The classes to assign to pages, as a JSON-encoded array of
                    objects with `class` (required) and `description` keys. Each
                    page receives one class, or `unknown` when no class fits.
                filename:
                  default: ''
                  title: Filename
                  type: string
                  description: Optional. Defaults to the document's own file name.
                content_type:
                  default: ''
                  title: Content Type
                  type: string
                  description: >-
                    Optional. Defaults to the document's own detected media
                    type.
                model:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    The classify model version to use. Accepts `classify-latest`
                    or a dated snapshot. Defaults to the latest version.
                  title: Model
              required:
                - classes
      responses:
        '200':
          description: v1-ade-classify result
          content:
            application/json:
              schema:
                description: The Classify API response body.
                properties:
                  classification:
                    description: One classification result per page, in page order.
                    items:
                      properties:
                        class:
                          description: Predicted class label, or 'unknown'.
                          type: string
                        reason:
                          description: Why the page was classified this way.
                          type: string
                        suggested_class:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: >-
                            A class the model proposes when the prediction is
                            'unknown'.
                        page:
                          description: Page number, zero-indexed (the first page is 0).
                          type: integer
                      required:
                        - class
                        - reason
                        - page
                      title: ClassificationItem
                      type: object
                    title: Classification
                    type: array
                  metadata:
                    $ref: '#/components/schemas/V1ClassifyMetadata'
                    description: Metadata for the classification request.
                required:
                  - classification
                  - metadata
                title: V1ClassifyResponse
                type: object
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1LegacyErrorResponse'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.ade.landing.ai/v1/ade/classify' \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -F 'document=@document.pdf' \
              -F 'classes=[{"class":"invoice","description":"A commercial bill with line items, totals, and payment terms"},{"class":"bank_statement","description":"A monthly summary of account transactions"}]'
        - lang: Python
          label: Python
          source: >-
            import json

            import requests


            url = 'https://api.ade.landing.ai/v1/ade/classify'

            headers = {'Authorization': 'Bearer YOUR_API_KEY'}


            files = {'document': open('document.pdf', 'rb')}

            data = {'classes': json.dumps([{"class": "invoice", "description":
            "A commercial bill with line items, totals, and payment terms"},
            {"class": "bank_statement", "description": "A monthly summary of
            account transactions"}])}


            response = requests.post(url, headers=headers, files=files,
            data=data)

            print(response.json())
        - lang: JavaScript
          label: Node.js
          source: >-
            const axios = require('axios');

            const FormData = require('form-data');

            const fs = require('fs');


            const form = new FormData();

            form.append('document', fs.createReadStream('document.pdf'));

            form.append('classes', JSON.stringify([{"class": "invoice",
            "description": "A commercial bill with line items, totals, and
            payment terms"}, {"class": "bank_statement", "description": "A
            monthly summary of account transactions"}]));


            axios.post('https://api.ade.landing.ai/v1/ade/classify', form, {
              headers: { 'Authorization': 'Bearer YOUR_API_KEY', ...form.getHeaders() }
            })
              .then(response => console.log(response.data))
              .catch(error => console.error(error));
components:
  schemas:
    V1ClassifyMetadata:
      description: Response metadata for a classify call.
      properties:
        page_count:
          description: Number of pages classified.
          title: Page Count
          type: integer
        duration_ms:
          description: End-to-end request duration in milliseconds.
          title: Duration Ms
          type: integer
        filename:
          default: ''
          description: Name of the classified file.
          title: Filename
          type: string
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Organization ID.
          title: Org Id
        credit_usage:
          default: 0
          description: Credits billed for this request.
          title: Credit Usage
          type: number
        job_id:
          default: ''
          description: >-
            The job ID for this request. When present, it correlates with the
            request's entry in your billing dashboard. Empty when no usage entry
            was recorded for the request.
          title: Job Id
          type: string
        version:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Resolved classify pipeline version that produced this response.
          title: Version
      required:
        - page_count
        - duration_ms
      title: V1ClassifyMetadata
      type: object
    V1LegacyErrorResponse:
      title: V1LegacyErrorResponse
      description: >-
        The v1 error envelope: `message` for a request-validation failure and
        for an authentication, payment or permission rejection (401/402/403),
        `error` for every other rejection, never both. `code` is always present.
      oneOf:
        - type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable snake_case error code.
            message:
              type: string
              description: Human-readable detail.
        - type: object
          required:
            - code
            - error
          properties:
            code:
              type: string
              description: Stable snake_case error code.
            error:
              type: string
              description: Human-readable detail.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.