Classify Document
Lightweight routing step that runs before /extract. Given a raw document
(file upload or file_url) and a set of caller-defined classifications,
it returns which classification the document belongs to — plus that classification’s
pipeline_id, so you can send the document to the right pipeline next.
By default, it evaluates the first five pages. For PDFs and images,
billing is based on the effective page_range. For Office and HTML
files, billing applies to every page.
Billed at 0.5 credits per page — half the /extract rate.
Accepted document types are identical to /extract, including the same
size limits and URL validation.
Set async: true to return immediately with a job_id for polling via
GET /job/. Otherwise processes synchronously.
Overview
/extract settings) a document should be routed to.POST /classify is a lightweight routing step that runs before /extract. Given a raw document and a set of caller-defined classifications, it returns which classification the document belongs to — plus that classification’s pipeline_id, so you can send the document to the right pipeline next.
Why classify before extract: extraction settings (chunking, schema, tables, …) differ per document type, so you need to know the type before you extract. By default, /classify evaluates the first five pages and costs 0.5 credits per page — half the /extract rate. See Credits.
Accepted Document Types
/classify accepts the same document formats and upload methods as /extract, including direct file uploads and file_url. See Supported File Types.
Async Mode
Setasync: true to return immediately with a job ID for polling. See Polling for Results. On completion, the job’s result carries the same body as the sync response.
Request
Provide eitherfile (multipart upload) or file_url (JSON body) — not both.
Request Body
Classify Config (classify_config)
<name>is any label you choose; Pulse returns exactly one of these names.descriptiontells Pulse what belongs in each class — make it specific and mutually distinct.pipeline_idis optional routing metadata. When provided, it must reference a pipeline your organization owns (otherwise the request is rejected withPIPELINE_003). The matched classification’spipeline_idis echoed back so you can route the document next.
Response
Synchronous Response (200)
Async Response (202)
Example Usage
Example Response
Routing to a Pipeline
/classify only tells you which pipeline to use — it does not execute it. Take the returned pipeline_id and run that pipeline with the same document; its own extraction settings then apply.
classify can also be used as the first step of an ad-hoc pipeline, where it classifies the raw document before the downstream steps run. It cannot be combined with batch_extract (classify needs a single document), and it is currently supported with inline config only.
Credits
/classify is billed at 0.5 credits per page — half the /extract rate (1 credit/page).
- PDFs / images: billed for the pages in the (defaulted/clamped)
page_range. - Office / HTML: billed for every page, even when
page_rangeis smaller.
Error Responses
Best Practices
Include a catch-all classification
Include a catch-all classification
"other" with a description such as “Any document that does not fit the other classifications” so unexpected documents don’t get force-fitted into a wrong class.Write specific, mutually distinct descriptions
Write specific, mutually distinct descriptions
Keep the default page range unless you have a reason not to
Keep the default page range unless you have a reason not to
page_range has no hard cap, but large ranges scale credits linearly.Treat the result as routing guidance
Treat the result as routing guidance
/classify is persisted — the routed pipeline’s /extract produces the durable output.Authorizations
Body
Request body for classifying a document. Provide exactly one of
file (multipart upload) or file_url (JSON body). In
multipart/form-data requests, classify_config is sent as a JSON
string form field.
Candidate classifications the document is matched against.
Document to upload directly (multipart/form-data only). Required unless file_url is provided.
Public or pre-signed URL that Pulse will download and classify. Required unless file is provided.
Pages to inspect, e.g. "1-5" or "1,3,5-7". Defaults to the first 5 pages, clamped to the document length. For Office/HTML formats, every page is billed.
If true, returns immediately with a job_id for polling via GET /job/{jobId}. Otherwise processes synchronously.
Optional parent job id for tracking.
Response
Classification result (when async=false or omitted)
Result of document classification.
The winning classification name — one of the keys from the request's classifications object.
Details of the winning classification.
Identifier of the request for tracking and support.
Number of credits consumed by this request.