Classify pages
The Laya page classifier, laya-page-role, reads a web page's text, not its address, and gives one of five labels, detail, listing, landing, not_vacancy or unresolved, with the model's calibrated probability for each. Workspace specialists answer the same call with their own results. This page is about sending work; Jobs, progress and results is about following it.
Status. Live since 2026-10-08, with the upload time measured that day; specialists, fetched pages and the per-call options were added to this guide on 2026-11-16.
Two kinds of model
| Page classifier | Workspace specialist | |
|---|---|---|
| Model ID | laya-page-role, the default | Any model your catalog lists with classify among its operations, such as laya-link-scorer or laya-vacancy-extractor |
| Input | Page text | Fetched pages: url, final_url, http_status, content_type, sha256 and body_b64 |
| Answer | One of the five labels, with probabilities | Its own result per page: labels from a classifier, fields from an extractor |
| How it runs | As a job: one call or a batch of any size | In the call, by its own pool: no job, no batch |
| Charged | Per page answered | Per token, at that pool's declared prices |
| Available | To every workspace | Only where your catalog lists it |
Read GET /v1/models to see which you have. The id laya-page-role can name both: sent as text it is the five-label classifier; sent as fetched pages from a workspace that has a specialist pool or a registered version under that id, it is that specialist, which answers page roles of its own. The rest of this page is about the five-label classifier unless it says otherwise.
One call or a batch
Every piece of work becomes a job; the two calls differ in how long they hold you.
| One call: POST /v1/classify | Batch: POST /v1/jobs | |
|---|---|---|
| Pages | 1 to 256 | any number your credit pays for |
| Answer | 200 with the results when the model is ready and they finish within 300 s; else 202 with the job and Retry-After | 201 with the job as soon as the upload is stored |
| Queue | ahead of batch work | after single calls |
| Price per page | the same | the same |
Both take an Idempotency-Key, so a retry returns the first answer rather than a second job (Errors and limits).
A batch as NDJSON
Send anything large as NDJSON: one object per line with the page's text and, if you want it back, your id. The model goes in the query string:
curl -s "https://weights.fyi/run/v1/jobs?model=laya-page-role" \
-H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/x-ndjson" \
-H "Idempotency-Key: pages-batch-1" \
--data-binary @pages.ndjson{"text": "Senior data engineer, Utrecht. Apply today.", "id": "page-000001"}
{"text": "All open positions: 24 results. Filter by city or team.", "id": "page-000002"}The upload is read as it arrives; 200,000 pages took 129 s on the live service on 2026-10-08. It is all or nothing: a bad line (400, with its number, never its content) or pages beyond your credit (402 queue_exceeds_credit, with pages_allowed) refuse the whole upload, and nothing runs. Because that answer can come before your upload is read to the end, some clients report a reset connection instead; curl prints the answer.
A small batch can also go as JSON, {"model": "laya-page-role", "pages": ["text", {"text": "…", "id": "…"}]}, up to 16 MiB in all. Every page must be non-empty text that fits one call to the model, 16 MiB with its envelope.
When the service is busy
the service holds a bounded amount of unfinished work for all accounts together, and refuses new work beyond it with 429 overloaded and a Retry-After, keeping nothing of it (Errors and limits). A single call can also ask not to be queued: with "options": {"rejectIfBusy": true}, POST /v1/classify answers 429 overloaded when the model is not ready or every call slot is taken, instead of 202. The option's name and behaviour follow Cloudflare's Workers AI; the call and the error shape stay this service's own.
Options on one call
POST /v1/classify takes these beside its pages; a batch takes none of them.
| Option | What it does |
|---|---|
options.rejectIfBusy | 429 overloaded instead of a queued job when the model is not ready or every call slot is taken. |
options.waitCold | Keeps waiting for the results while the model starts, within the same 300 s, instead of answering 202 at once. |
jurisdictions, or the header X-Weights-Jurisdictions | Country codes, EU or EEA: the call runs only where the model's known location is inside them, else 409 jurisdiction_refused. |
retain: "none" | Zero retention: the answer is not stored for replay, so a retry with the same Idempotency-Key gets 409 replay_not_retained and a digest, not the answer. Only a specialist pool that answers in the call can do it; the five-label classifier keeps results and answers 409 retain_none_unavailable. The usage record of the call, its tokens and charge, is still kept. |
version_id, calibration_sha256 | Pin a registered version of a specialist and its calibration; each result then names both. |
A confidential workspace sends every call sealed; a plain one answers 400 encrypted_envelope_required (POST /v1/workspaces).