Skip to content
Framework Docs

Create Classify Job

ClassifyJob classifier().jobs().create(JobCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/classifier/jobs

Create a classify job. Experimental: not production-ready and subject to change.

ParametersExpand Collapse
JobCreateParams params
Optional<String> organizationId
Optional<String> projectId
List<String> fileIds

The IDs of the files to classify

List<ClassifierRule> rules

The rules to classify the files

String description

Natural language description of what to classify. Be specific about the content characteristics that identify this document type.

maxLength500
minLength10
String type

The document type to assign when this rule matches (e.g., ‘invoice’, ‘receipt’, ‘contract’)

maxLength50
minLength1
Optional<Mode> mode

The classification mode to use

FAST("FAST")
MULTIMODAL("MULTIMODAL")
Optional<ClassifyParsingConfiguration> parsingConfiguration

The configuration for the parsing job

Optional<List<WebhookConfiguration>> webhookConfigurations

List of webhook configurations for notifications

Optional<List<String>> webhookEvents

Events that trigger this webhook. Options: ‘parse.success’ (job completed), ‘parse.error’ (job failed), ‘parse.partial_success’ (some pages failed), ‘parse.pending’, ‘parse.running’, ‘parse.cancelled’. If not specified, webhook fires for all events

Optional<WebhookHeaders> webhookHeaders

Custom HTTP headers to include in webhook requests. Use for authentication tokens or custom routing. Example: {‘Authorization’: ‘Bearer xyz’}

Optional<WebhookOutputFormat> webhookOutputFormat

Format of the webhook payload body. ‘string’ (default) sends the payload as a JSON-encoded string; ‘json’ sends it as a JSON object.

One of the following:
STRING("string")
JSON("json")
Optional<String> webhookUrl

HTTPS URL to receive webhook POST requests. Must be publicly accessible

ReturnsExpand Collapse
class ClassifyJob:

A classify job.

String id

Unique identifier

formatuuid
String projectId

The ID of the project

formatuuid
List<ClassifierRule> rules

The rules to classify the files

String description

Natural language description of what to classify. Be specific about the content characteristics that identify this document type.

maxLength500
minLength10
String type

The document type to assign when this rule matches (e.g., ‘invoice’, ‘receipt’, ‘contract’)

maxLength50
minLength1
StatusEnum status

The status of the classify job

One of the following:
PENDING("PENDING")
SUCCESS("SUCCESS")
ERROR("ERROR")
PARTIAL_SUCCESS("PARTIAL_SUCCESS")
CANCELLED("CANCELLED")
String userId

The ID of the user

Optional<LocalDateTime> createdAt

Creation datetime

formatdate-time
Optional<LocalDateTime> effectiveAt
Optional<String> errorMessage

Error message for the latest job attempt, if any.

Optional<String> jobRecordId

The job record ID associated with this status, if any.

Optional<Mode> mode

The classification mode to use

One of the following:
FAST("FAST")
MULTIMODAL("MULTIMODAL")
Optional<ClassifyParsingConfiguration> parsingConfiguration

The configuration for the parsing job

Optional<ParsingLanguages> lang

The language to parse the files in

One of the following:
AF("af")
AZ("az")
BS("bs")
CS("cs")
CY("cy")
DA("da")
DE("de")
EN("en")
ES("es")
ET("et")
FR("fr")
GA("ga")
HR("hr")
HU("hu")
ID("id")
IS("is")
IT("it")
KU("ku")
LA("la")
LT("lt")
LV("lv")
MI("mi")
MS("ms")
MT("mt")
NL("nl")
NO("no")
OC("oc")
PI("pi")
PL("pl")
PT("pt")
RO("ro")
RS_LATIN("rs_latin")
SK("sk")
SL("sl")
SQ("sq")
SV("sv")
SW("sw")
TL("tl")
TR("tr")
UZ("uz")
VI("vi")
AR("ar")
FA("fa")
UG("ug")
UR("ur")
BN("bn")
AS("as")
MNI("mni")
RU("ru")
RS_CYRILLIC("rs_cyrillic")
BE("be")
BG("bg")
UK("uk")
MN("mn")
ABQ("abq")
ADY("ady")
KBD("kbd")
AVA("ava")
DAR("dar")
INH("inh")
CHE("che")
LBE("lbe")
LEZ("lez")
TAB("tab")
TJK("tjk")
HI("hi")
MR("mr")
NE("ne")
BH("bh")
MAI("mai")
ANG("ang")
BHO("bho")
MAH("mah")
SCK("sck")
NEW("new")
GOM("gom")
SA("sa")
BGC("bgc")
TH("th")
CH_SIM("ch_sim")
CH_TRA("ch_tra")
JA("ja")
KO("ko")
TA("ta")
TE("te")
KN("kn")
Optional<Long> maxPages

The maximum number of pages to parse

Optional<List<Long>> targetPages

The pages to target for parsing (0-indexed, so first page is at 0)

Optional<LocalDateTime> updatedAt

Update datetime

formatdate-time

Create Classify Job

package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.classifier.jobs.ClassifierRule;
import com.llamacloud_prod.api.models.classifier.jobs.ClassifyJob;
import com.llamacloud_prod.api.models.classifier.jobs.JobCreateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv();

        JobCreateParams params = JobCreateParams.builder()
            .addFileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
            .addRule(ClassifierRule.builder()
                .description("contains invoice number, line items, and total amount")
                .type("invoice")
                .build())
            .build();
        ClassifyJob classifyJob = client.classifier().jobs().create(params);
    }
}
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "rules": [
    {
      "description": "contains invoice number, line items, and total amount",
      "type": "invoice"
    }
  ],
  "status": "PENDING",
  "user_id": "user_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "effective_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "job_record_id": "job_record_id",
  "mode": "FAST",
  "parsing_configuration": {
    "lang": "af",
    "max_pages": 0,
    "target_pages": [
      0
    ]
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "rules": [
    {
      "description": "contains invoice number, line items, and total amount",
      "type": "invoice"
    }
  ],
  "status": "PENDING",
  "user_id": "user_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "effective_at": "2019-12-27T18:11:19.117Z",
  "error_message": "error_message",
  "job_record_id": "job_record_id",
  "mode": "FAST",
  "parsing_configuration": {
    "lang": "af",
    "max_pages": 0,
    "target_pages": [
      0
    ]
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}