Bearer Auth (In: header)Authorization: Bearer <YOUR_API_KEY>Bearer <YOUR_API_KEY>. Format: Authorization: Bearer sk-xxxxxx.| Field | Type | Range | Description |
|---|---|---|---|
id | string | - | The current chat task id. |
object | string | - | The type of object returned by the API. In this case it is always task. |
status | string | pending processing success failed | Current status of the task. |
created_at | number | - | Unix timestamp (in seconds) indicating when the task was created. |
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | ✅ | claude-opus-4-6 | The model ID to use for this request. |
messages | string | array<object> | ✅ | - | An array of message objects representing the conversation history. |
max_tokens | integer | ✅ | 1024 | The maximum number of tokens the model can generate in the response. Range 1-32000 |
tools | array<object> | ✅ | - | Array of tool objects. For web search, must include the web_search tool configuration with type web_search_20250305. |
async | boolean | - | false | Whether to return an asynchronous response. Only supported for non-streaming requests. See Tools. |
stream | boolean | - | false | If true, returns a stream of server-sent events (SSE) as the response is generated. |
system | string | array<object> | - | - | System prompt that sets the behavior and context for the assistant. |
temperature | number | - | 1.0 | Controls the randomness of the output. Lower values produce more focused responses, higher values produce more creative outputs. Range 0.0-1.0 |
top_p | number | - | 1.0 | Nucleus sampling parameter. The model considers tokens with top_p cumulative probability mass. Range 0.0-1.0 |
top_k | integer | - | - | Limits token selection to the K most probable tokens at each step. |
stop_sequences | array<string> | - | - | An array of strings that will stop generation when encountered. |
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | The tool type. Must be web_search_20250305 for web search. |
name | string | ✅ | Override the default tool name. Default: web_search. |
max_uses | integer | - | Maximum number of web search requests allowed per model turn. Range 1-20. |
allowed_domains | array<string> | - | Only include search results from these domains. Cannot be used with blocked_domains. |
blocked_domains | array<string> | - | Never include search results from these domains. Cannot be used with allowed_domains. |
user_location | object | - | Approximate user location for localized search results. |
>user_location.type | string | - | Must be approximate if provided. |
>user_location.city | string | - | City name (e.g., "San Francisco"). |
>user_location.region | string | - | Region or state (e.g., "California"). |
>user_location.country | string | - | Two-letter country code (e.g., "US"). |
>user_location.timezone | string | - | IANA timezone (e.g., "America/New_York"). |
max_uses parameter limits the number of searches performed. If Claude attempts more searches than allowed, the web_search_tool_result will be an error with the max_uses_exceeded error code.
example.com instead of https://example.com)example.com covers docs.example.com)docs.example.com returns only results from that subdomain, not from example.com or api.example.com)example.com/blog)allowed_domains or blocked_domains, but not both in the same request