> ## 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 the pages of a document into classes you define.

This endpoint accepts PDFs, images, and other supported file types
(either as a `document` upload or `document_url`) together with a
list of `classes`, and returns a classification result for each page.

For EU users, use this endpoint:

`https://api.va.eu-west-1.landing.ai/v1/ade/classify`.



## OpenAPI

````yaml /ade/va_openapi_ade2.json post /v1/ade/classify
openapi: 3.1.0
info:
  title: Vision Tools API
  version: 0.1.0
servers:
  - url: https://api.va.landing.ai
    description: Production vision tools API
security: []
paths:
  /v1/ade/classify:
    post:
      tags:
        - Tools
      summary: ADE Classify
      description: |-
        Classify the pages of a document into classes you define.

        This endpoint accepts PDFs, images, and other supported file types
        (either as a `document` upload or `document_url`) together with a
        list of `classes`, and returns a classification result for each page.

        For EU users, use this endpoint:

        `https://api.va.eu-west-1.landing.ai/v1/ade/classify`.
      operationId: tool_ade_classify_v1_ade_classify_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ClassifyRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClassifyResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Basic Auth: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl -X POST 'https://api.va.landing.ai/v1/ade/classify' \
              -H 'Authorization: Bearer YOUR_API_KEY' \
              -F 'classes=[{"class":"Class 1","description":"Description of Class 1"},{"class":"Class 2","description":"Description of Class 2"}]' \
              -F 'document=@document.pdf'
        - lang: Python
          label: Python
          source: >-
            import requests

            import json


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


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


            classes = [
                {'class': 'Class 1', 'description': 'Description of Class 1'},
                {'class': 'Class 2', 'description': 'Description of Class 2'}
            ]


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

            data = {'classes': json.dumps(classes)}


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

            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'));

            const classes = [
              { class: 'Class 1', description: 'Description of Class 1' },
              { class: 'Class 2', description: 'Description of Class 2' }
            ];
            form.append('classes', JSON.stringify(classes));

            axios.post('https://api.va.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:
    ClassifyRequest:
      properties:
        classes:
          items:
            $ref: '#/components/schemas/ClassifyClass'
          type: array
          title: Classes
          description: >-
            The possible classes that can be assigned to pages in the document.
            Each entry is an object with a `class` name and an optional
            `description`. Only one class is assigned per page; unclassifiable
            pages receive 'unknown'. Can be provided as a JSON string in form
            data.
        document:
          anyOf:
            - type: string
              format: binary
            - type: 'null'
          title: Document
          description: >-
            A file to be classified. Either this parameter or the `document_url`
            parameter must be provided.
        document_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Url
          description: >-
            The URL of the document to be classified. Either this parameter or
            the `document` parameter must be provided.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Classification model version. Defaults to the latest.
      type: object
      required:
        - classes
      title: ClassifyRequest
    ClassifyResponse:
      properties:
        classification:
          items:
            $ref: '#/components/schemas/ClassificationItem'
          type: array
          title: Classification
        metadata:
          $ref: '#/components/schemas/ClassifyMetadata'
      type: object
      required:
        - classification
        - metadata
      title: ClassifyResponse
      description: Response model for the classify endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ClassifyClass:
      properties:
        class:
          type: string
          title: Class
          description: Name of the class.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Detailed description of what this class represents.
      type: object
      required:
        - class
      title: ClassifyClass
      description: 'A single classification option: a class name plus optional description.'
    ClassificationItem:
      properties:
        class:
          type: string
          title: Class
          description: Predicted class label or 'unknown'.
        reason:
          type: string
          title: Reason
          description: Reason for the classification (for debugging).
          default: ''
        suggested_class:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggested Class
          description: Proposed class when the prediction is 'unknown'.
        page:
          type: integer
          title: Page
          description: Page number (0-based).
      type: object
      required:
        - class
        - page
      title: ClassificationItem
      description: A single page-level classification result.
    ClassifyMetadata:
      properties:
        filename:
          type: string
          title: Filename
        org_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Org Id
        page_count:
          type: integer
          title: Page Count
        duration_ms:
          type: integer
          title: Duration Ms
        credit_usage:
          type: number
          title: Credit Usage
        job_id:
          type: string
          title: Job Id
          default: ''
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
      type: object
      required:
        - filename
        - page_count
        - duration_ms
        - credit_usage
      title: ClassifyMetadata
      description: Metadata for the classify response.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    Basic Auth:
      type: http
      description: >-
        Your unique API key for authentication.


        Get your API key here: https://va.landing.ai/settings/api-key.


        If using the EU endpoint, get your API key here:
        https://va.eu-west-1.landing.ai/settings/api-key.
      scheme: bearer
      bearerFormat: Basic

````