Overview
When you fetch pages, you can addcriteria: up to five yes or no questions about each page, such as “Does this page try to instruct an AI?” or “Is this page a product listing?”. A decision model reads each fetched page and returns a probability from 0 to 1 for each question. Your code uses those scores to decide what to do with each page, such as keep it, drop it, or set it aside for review, before your own LLM or agent sees it.
Each question uses the noul format of the Decisions API: a question or a statement to check, plus optional descriptions of what counts as yes and what counts as no.
You need the same setup and authentication as any Context API request. Everything else on the quickstart applies unchanged: formats, freshness control, rate limits, and per-URL errors.
Check Pages for Prompt Injection
An agent that reads pages from the open web can ask whether a page tries to give it instructions, and skip the pages that do:Response
Response
Question Fields
criteria is an object with 1 to 5 questions. Each key is a question ID that you choose, and the response uses the same IDs. An ID must match [A-Za-z0-9_-]{1,64}, and query is reserved. Each question has these fields:
There is no threshold field. Any field not in this table, such as
criteria.is_prompt_injection.threshold, returns 400 with error type unsupported_param.
Read the Scores
Each scored result has acriteria object keyed by question ID. criteria.<id>.noul is the probability that the answer is yes or the statement is true, from 0 to 1. Values near 0.5 mean the model is unsure. Read it at results[i].criteria.is_prompt_injection.noul.
Scoring never filters, reorders, or drops results. You still get one result per input URL, in request order, whatever the scores are. Compare noul to your own threshold in your code, as the examples do.
A result has criteria only when its status.type is ok and the page was scored. A failed URL or a not_modified result has no criteria. An ok page whose scoring failed has criteria_error instead of criteria: timeout (scoring ran out of time), overloaded (the scoring service was at capacity), or error (another failure). An ok page with no text to score, such as an image, has neither. The page content is still returned, so check for criteria before you read it. Criteria work with any formats value, including []. The URL limit for your usage tier applies unchanged.
Timeouts
Withcriteria, timeout_ms can be at most 95000, and scoring may add up to 15 seconds. A URL that does not finish in time comes back with status.type crawl_timeout, as without criteria.
Pricing
Scoring is billed as Decisions API input tokens, on top of the per-URL price. The tokens are the page text plus your questions, for each scored page.usage.criteria.input_tokens reports the count (0 when no page was scored), and usage.cost.total_cost includes their list price. usage.criteria is omitted when no URL was fetched, for example when every URL is invalid_url.
Errors
On top of the request errors every Context API request can return, a request withcriteria can fail with these errors:
Next Steps
Decisions API
The decision model and the noul question format behind criteria
API Reference
Request and response schemas for POST /v1/context
Prompt Injection Cookbook
A calibrated question, a caller-side cutoff, and tests