Follow Discord
Sweep 06 Nov 2026 · 01:32Z Build v2.1.319 537 read Stable v2.1.311 Latest v2.1.319 Next v2.1.319 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

handling-stop-reasons changedbuild-with-claude/handling-stop-reasons

Nearest release: v2.1.318, published 4 hours 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 55 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits26to this page, all time

The whole hunk

from line 55, old and new numbered
/
lines
from line 55
5555 ```bash cURL
5656 curl https://api.anthropic.com/v1/messages \
5757 -H "x-api-key: $ANTHROPIC_API_KEY" \
58 -H "anthropic-version: 2023-06-01" \
58 -H "anthropic-version: 2026-10-21" \
5959 -H "content-type: application/json" \
6060 -d '{
6161 "model": "claude-opus-5-5",
from line 740
740740 ```bash cURL
741741 curl https://api.anthropic.com/v1/messages \
742742 -H "x-api-key: $ANTHROPIC_API_KEY" \
743 -H "anthropic-version: 2023-06-01" \
743 -H "anthropic-version: 2026-10-21" \
744744 -H "content-type: application/json" \
745745 -d '{
746746 "model": "claude-opus-5-5",
from line 1052
10521052 ```bash cURL
10531053 curl https://api.anthropic.com/v1/messages \
10541054 -H "x-api-key: $ANTHROPIC_API_KEY" \
1055 -H "anthropic-version: 2023-06-01" \
1055 -H "anthropic-version: 2026-10-21" \
10561056 -H "content-type: application/json" \
10571057 -d '{
10581058 "model": "claude-opus-5-5",
from line 1196
11961196 ```bash cURL
11971197 curl https://api.anthropic.com/v1/messages \
11981198 -H "x-api-key: $ANTHROPIC_API_KEY" \
1199 -H "anthropic-version: 2023-06-01" \
1199 -H "anthropic-version: 2026-10-21" \
12001200 -H "content-type: application/json" \
12011201 -d '{
12021202 "model": "claude-opus-5-5",
from line 1539
15391539 # on the response and re-POST with the assistant content appended.
15401540 curl https://api.anthropic.com/v1/messages \
15411541 -H "x-api-key: $ANTHROPIC_API_KEY" \
1542 -H "anthropic-version: 2023-06-01" \
1542 -H "anthropic-version: 2026-10-21" \
15431543 -H "content-type: application/json" \
15441544 -d '{
15451545 "model": "claude-opus-5-5",
from line 1757
17571757 ```bash cURL
17581758 curl https://api.anthropic.com/v1/messages \
17591759 -H "x-api-key: $ANTHROPIC_API_KEY" \
1760 -H "anthropic-version: 2023-06-01" \
1760 -H "anthropic-version: 2026-10-21" \
17611761 -H "content-type: application/json" \
17621762 -d '{
17631763 "model": "claude-opus-5-5",
from line 1894
18941894</CodeGroup>
18951895 
18961896<Tip>
1897 If you encounter `refusal` stop reasons frequently while using Claude Sonnet 4.5 ([deprecated](https://platform.claude.com/docs/en/about-claude/model-deprecations)) or Claude Opus 4.1 (the latter [retired, except on Bedrock and Claude Models on Google Cloud (Google managed)](https://platform.claude.com/docs/en/about-claude/model-deprecations)), you can try updating your API calls to use Haiku 4.5 (`claude-haiku-4-5-20251001`), which has different usage restrictions. Learn more about [understanding Sonnet 4.5’s API safety filters](https://support.claude.com/en/articles/12449294-understanding-sonnet-4-5-s-api-safety-filters).
1897 If you encounter `refusal` stop reasons frequently while using Claude Sonnet 4.5 ([deprecated](https://platform.claude.com/docs/en/about-claude/model-deprecations)) or Claude Opus 4.1 (the latter [retired, except on Claude Models on Google Cloud (Google managed) and Amazon Bedrock](https://platform.claude.com/docs/en/about-claude/model-deprecations)), you can try updating your API calls to use Claude Haiku 4.5 (`claude-haiku-4-5-20251001`), which has different usage restrictions. Learn more about [understanding Sonnet 4.5’s API safety filters](https://support.claude.com/en/articles/12449294-understanding-sonnet-4-5-s-api-safety-filters).
18981898</Tip>
18991899 
19001900On a refusal, the [`stop_details`](https://platform.claude.com/docs/en/api/messages/create#message.stop_details) object identifies the policy category that triggered it. The categories and the full refusal response shape are covered in [What a refusal looks like](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#refusal-response). `stop_details` is `null` for all stop reasons other than `refusal`.
from line 1913
19131913 ```bash cURL
19141914 curl https://api.anthropic.com/v1/messages \
19151915 -H "x-api-key: $ANTHROPIC_API_KEY" \
1916 -H "anthropic-version: 2023-06-01" \
1916 -H "anthropic-version: 2026-10-21" \
19171917 -H "content-type: application/json" \
19181918 -d '{
19191919 "model": "claude-opus-5-5",
from line 2703
27032703 # $? for errors and stop_reason for successful responses.
27042704 curl --fail-with-body https://api.anthropic.com/v1/messages \
27052705 -H "x-api-key: $ANTHROPIC_API_KEY" \
2706 -H "anthropic-version: 2023-06-01" \
2706 -H "anthropic-version: 2026-10-21" \
27072707 -H "content-type: application/json" \
27082708 -d '{
27092709 "model": "claude-opus-5-5",
from line 2917
29172917 # The message_delta event in the SSE stream carries stop_reason.
29182918 curl -N https://api.anthropic.com/v1/messages \
29192919 -H "x-api-key: $ANTHROPIC_API_KEY" \
2920 -H "anthropic-version: 2023-06-01" \
2920 -H "anthropic-version: 2026-10-21" \
29212921 -H "content-type: application/json" \
29222922 -d '{
29232923 "model": "claude-opus-5-5",
Feedback