handle-streaming-refusals changedtest-and-evaluate/strengthen-guardrails/handle-streaming-refusals
Nearest release: v2.1.330, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+10added
Lines−10removed
From line
328
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits24to this page, all time
The whole hunk
from line 328, old and new numbered
/
from line 328
328328
329329The API currently handles refusals in three different ways:
330330
331| Refusal type | Response format | When it occurs |
332| ---------------------------------- | ---------------------------- | ----------------------------------------------- |
333| Streaming classifier refusals | **`stop_reason`: `refusal`** | During streaming when content violates policies |
334| API input and copyright validation | 400 error codes | When input fails validation checks |
335| Model-generated refusals | Standard text responses | When the model itself refuses |
331| Refusal type | Response format | When it occurs |
332| ----- | ----- | ----- |
333| Streaming classifier refusals | **`stop_reason`: `refusal`** | During streaming when content violates policies |
334| API input and copyright validation | 400 error codes | When input fails validation checks |
335| Model-generated refusals | Standard text responses | When the model itself refuses |
336336
337337## Best practices
338338
from line 384
384384* Availability: Always on
385385* Usage: The stream ends with `stop_reason` `"refusal"`, and `stop_details` (`category` and `explanation`) arrives on the `message_delta` event.
386386
387| Status | Cloud platforms |
388| --------- | ----------------------- |
387| Status | Cloud platforms |
388| ----- | ----- |
389389| Available | All supported platforms |
390390
391391#### [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview)
from line 393
393393* Availability: Always on
394394* Usage: A refused turn ends, and the session goes idle. Treat a turn as refused if `stop_details.type` or `stop_reason.type` on the `session.status_idle` event is `"refusal"`. On a refused turn, `stop_reason.type` can be `"end_turn"`. `stop_details` is `null` on any other turn, and can be `null` on a refused turn too.
395395
396| Status | Cloud platforms |
397| ------ | ------------------------------------------------------------------------------------------------------------------ |
398| Beta | Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws) |
396| Status | Cloud platforms |
397| ----- | ----- |
398| Beta | Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws) |
399399
No line in this hunk matches that.