Skip to content
Get started

Create Classify Job

client.classifier.jobs.create(JobCreateParams { file_ids, rules, organization_id, 4 more } params, RequestOptionsoptions?): ClassifyJob { id, project_id, rules, 9 more }
POST/api/v1/classifier/jobs

Create a classify job. Experimental: This endpoint is not yet ready for production use and is subject to change at any time.

ParametersExpand Collapse
params: JobCreateParams { file_ids, rules, organization_id, 4 more }
file_ids: Array<string>

Body param: The IDs of the files to classify

rules: Array<ClassifierRule { description, type } >

Body param: The rules to classify the files

description: string

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

maxLength500
minLength10
type: string

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

maxLength50
minLength1
organization_id?: string | null

Query param

formatuuid
project_id?: string | null

Query param

formatuuid
mode?: "FAST" | "MULTIMODAL"

Body param: The classification mode to use

Accepts one of the following:
"FAST"
"MULTIMODAL"
parsing_configuration?: ClassifyParsingConfiguration { lang, max_pages, target_pages }

Body param: The configuration for the parsing job

The language to parse the files in

Accepts one of the following:
"af"
"az"
"bs"
"cs"
"cy"
"da"
"de"
"en"
"es"
"et"
"fr"
"ga"
"hr"
"hu"
"id"
"is"
"it"
"ku"
"la"
"lt"
"lv"
"mi"
"ms"
"mt"
"nl"
"no"
"oc"
"pi"
"pl"
"pt"
"ro"
"rs_latin"
"sk"
"sl"
"sq"
"sv"
"sw"
"tl"
"tr"
"uz"
"vi"
"ar"
"fa"
"ug"
"ur"
"bn"
"as"
"mni"
"ru"
"rs_cyrillic"
"be"
"bg"
"uk"
"mn"
"abq"
"ady"
"kbd"
"ava"
"dar"
"inh"
"che"
"lbe"
"lez"
"tab"
"tjk"
"hi"
"mr"
"ne"
"bh"
"mai"
"ang"
"bho"
"mah"
"sck"
"new"
"gom"
"sa"
"bgc"
"th"
"ch_sim"
"ch_tra"
"ja"
"ko"
"ta"
"te"
"kn"
max_pages?: number | null

The maximum number of pages to parse

target_pages?: Array<number> | null

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

webhook_configurations?: Array<WebhookConfiguration>

Body param: List of webhook configurations for notifications

webhook_events?: Array<string> | null

List of events that trigger webhook notifications

webhook_headers?: Record<string, unknown> | null

Custom headers to include in webhook requests

webhook_url?: string | null

Webhook URL for receiving parsing notifications

ReturnsExpand Collapse
ClassifyJob { id, project_id, rules, 9 more }

A classify job.

id: string

Unique identifier

formatuuid
project_id: string

The ID of the project

formatuuid
rules: Array<ClassifierRule { description, type } >

The rules to classify the files

description: string

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

maxLength500
minLength10
type: string

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

maxLength50
minLength1
status: StatusEnum

The status of the classify job

Accepts one of the following:
"PENDING"
"SUCCESS"
"ERROR"
"PARTIAL_SUCCESS"
"CANCELLED"
user_id: string

The ID of the user

created_at?: string | null

Creation datetime

formatdate-time
effective_at?: string
error_message?: string | null

Error message for the latest job attempt, if any.

job_record_id?: string | null

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

mode?: "FAST" | "MULTIMODAL"

The classification mode to use

Accepts one of the following:
"FAST"
"MULTIMODAL"
parsing_configuration?: ClassifyParsingConfiguration { lang, max_pages, target_pages }

The configuration for the parsing job

The language to parse the files in

Accepts one of the following:
"af"
"az"
"bs"
"cs"
"cy"
"da"
"de"
"en"
"es"
"et"
"fr"
"ga"
"hr"
"hu"
"id"
"is"
"it"
"ku"
"la"
"lt"
"lv"
"mi"
"ms"
"mt"
"nl"
"no"
"oc"
"pi"
"pl"
"pt"
"ro"
"rs_latin"
"sk"
"sl"
"sq"
"sv"
"sw"
"tl"
"tr"
"uz"
"vi"
"ar"
"fa"
"ug"
"ur"
"bn"
"as"
"mni"
"ru"
"rs_cyrillic"
"be"
"bg"
"uk"
"mn"
"abq"
"ady"
"kbd"
"ava"
"dar"
"inh"
"che"
"lbe"
"lez"
"tab"
"tjk"
"hi"
"mr"
"ne"
"bh"
"mai"
"ang"
"bho"
"mah"
"sck"
"new"
"gom"
"sa"
"bgc"
"th"
"ch_sim"
"ch_tra"
"ja"
"ko"
"ta"
"te"
"kn"
max_pages?: number | null

The maximum number of pages to parse

target_pages?: Array<number> | null

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

updated_at?: string | null

Update datetime

formatdate-time

Create Classify Job

import LlamaCloud from '@llamaindex/llama-cloud';

const client = new LlamaCloud({
  apiKey: process.env['LLAMA_CLOUD_API_KEY'], // This is the default and can be omitted
});

const classifyJob = await client.classifier.jobs.create({
  file_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
  rules: [
    { description: 'contains invoice number, line items, and total amount', type: 'invoice' },
  ],
});

console.log(classifyJob.id);
{
  "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"
}