Skip to content
Get started

Classify

classify.run(ClassifyRunParams**kwargs) -> ClassifyRunResponse
POST/v1/classify

Classify

ParametersExpand Collapse
file: File

File to classify, either as raw data or a URL

One of the following:
class FileData:
file_data: str

Raw file data encoded as bytes

class FileURL:
file_url: str

URL pointing to the file to be processed

maxLength2083
minLength1
formaturi

List of classification types to classify the document into

description: str

Description of the classified type

name: str

Name of the classified type

ReturnsExpand Collapse
class ClassifyRunResponse:
credit_used: int

Cost in EUR (€) for this classification (per page for PDFs, flat for images)

result: Result

Classification result for the provided document

confidence: float

Confidence score between 0 and 1

maximum1
minimum0
type: str

Type of the classified result

Classify

import os
from parseocr import Parseocr

client = Parseocr(
    api_key=os.environ.get("PARSEOCR_API_KEY"),  # This is the default and can be omitted
)
response = client.classify.run(
    file={
        "file_data": "JVBERi0xLjcKJcfs...KqldOIQo="
    },
    types=[{
        "description": "Invoices request payment for goods or services provided.",
        "name": "invoice",
    }, {
        "description": "Quotes provide an estimate of costs for goods or services before they are provided.",
        "name": "quote",
    }],
)
print(response.credit_used)
{
  "credit_used": 0,
  "result": {
    "confidence": 0.98,
    "type": "invoice"
  }
}
Returns Examples
{
  "credit_used": 0,
  "result": {
    "confidence": 0.98,
    "type": "invoice"
  }
}