/v1/agentCreate Agent ResponseGenerate a response for the provided input with optional web search and reasoning.
Request body
requiredapplication/json
ResponsesRequest
backgroundbooleanRun the response asynchronously. With `stream: false`, the request returns immediately with `status: "queued"`; poll `GET /v1/responses/{id}` until the response reaches a terminal status. Background runs are durable, so you can also stream them and reconnect after a drop.
inputvaluerequiredInput content - either a string or array of input items
Show child attributes
oneOf · 2 options
StringInput
InputItemArray
Show array items
oneOf · 3 options
InputMessage
contentvaluerequiredMessage content - either a string or array of content parts
Show child attributes
oneOf · 2 options
StringContent
ContentPartArray
Show array items
image_urlstringtextstringtypestringrequiredrolestringrequiredtypestringrequiredFunctionCallOutputInput
call_idstringrequiredThe call_id from function_call output
idnull | stringReplay metadata populated when this item was returned by the API.
namestringFunction name (required by some providers)
outputvaluerequiredFunction result as a JSON string or an array of input_text and input_image content parts.
Show child attributes
oneOf · 2 options
StringOutput
OutputPartArray
Show array items
oneOf · 2 options
FunctionCallOutputTextPart
textstringrequiredtypestringrequiredFunctionCallOutputImagePart
detailnull | stringAccepted for OpenAI replay compatibility; native tool-result forwarding ignores this hint.
image_urlstringrequiredA fully qualified HTTP(S) URL or base64 image data URI.
typestringrequiredstatusnull | stringReplay metadata populated when this item was returned by the API.
thought_signaturestringBase64-encoded signature from function_call
typestringrequiredFunctionCallInput
argumentsstringrequiredFunction arguments (JSON string)
call_idstringrequiredThe call_id that correlates with function_call_output
namestringrequiredThe function name
thought_signaturestringBase64-encoded signature for thinking models
typestringrequiredinstructionsstringSystem instructions for the model
language_preferencestringISO 639-1 language code for response language
max_output_tokensinteger · int32Maximum tokens to generate. This is a shared optional Agent API request parameter, but it is required when using anthropic/* models. If omitted for an Anthropic model, the API returns HTTP 400 with: validation failed: max_output_tokens is required when using Anthropic models.
max_stepsinteger · int32Maximum number of research loop steps. If provided, overrides the preset's max_steps value. For requests that specify model or models without a preset, the default is 1. Set max_steps to at least 3 when using finance_search with a direct model so the agent has enough steps to initialize and run the tool. Must be >= 1 if specified. Maximum allowed is 100.
modelstringModel ID in provider/model format (e.g., "openai/gpt-5.6-terra", "anthropic/claude-sonnet-4-6"). If models is also provided, models takes precedence. Required if neither models nor preset is provided.
modelsarray of stringModel fallback chain. Each model is in provider/model format. Models are tried in order until one succeeds. Max 5 models allowed. If set, takes precedence over single model field. The response.model will reflect the model that actually succeeded.
Show child attributes
presetstringPreset configuration name (e.g., "fast", "low", "medium", "high", "xhigh"). Pre-configured model with system prompt and search parameters. Required if model is not provided.
previous_response_idstringOpenAI-compatible previous response id for multi-turn response chains. When set, the new response continues from the completed prior response's saved state. The prior response must belong to the same account and have completed.
profilevalueSaved, versioned configuration to run with. The version is resolved when the request is admitted. Cannot be combined with preset.
Show child attributes
allOf · 1 option
ProfileReference
idstringrequiredtypestringrequiredversionstringVersion to bind to, or "latest". Omitted means "latest".
reasoningobjectShow child attributes
effortstringHow much effort the model should spend on reasoning
response_formatobjectSpecifies the desired output format for the model response
Show child attributes
json_schemaobjectDefines a JSON schema for structured output validation
Show child attributes
descriptionstringOptional description of the schema
namestringrequiredName of the schema (1-64 alphanumeric chars)
schemaobjectrequiredThe JSON schema object
strictbooleanWhether to enforce strict schema validation
typestringrequiredThe type of response format
skillsarray of valueBuilt-in, request-scoped inline, and organization-owned custom skills available to the model. Skill metadata is disclosed to the model up front; full instructions are loaded on demand through the load_skill tool. Selecting any skill enables the sandbox tool for the request. Requests with skills run on the durable backend and skills are not echoed back on Response objects.
Show child attributes
Show array items
oneOf · 3 options
BuiltinSkill
namestringrequiredBuilt-in skill to make available to the model. office is the full Office bundle (enables all four leaves). office/docx, office/pdf, office/pptx, office/xlsx each create polished documents of that type from scratch, with structural validation and visual QA.
typestringrequiredInlineSkill
descriptionstringrequiredShort discovery description, limited to 1,024 UTF-8 bytes.
instructionsstringrequiredInstructions returned by load_skill, limited to 65,536 UTF-8 bytes per skill and 262,144 bytes across the request.
namestringrequiredRequest-scoped lowercase ASCII name separated by single hyphens.
typestringrequiredCustomSkill
idstringrequiredIdentifier of an organization-owned skill stored in Perplexity, in the form skill_<id>.
typestringrequiredversionstringRevision to load, or "latest". Omitted means "latest".
storebooleanOpenAI-compatible storage toggle. When false, the response is hidden from later retrieve calls, and the echoed response reports `store: false`. It can still be used as a `previous_response_id` continuation source.
streambooleanIf true, returns SSE stream instead of JSON
temperaturenumber · doubleOpenAI-compatible sampling temperature forwarded to generation.
toolsarray of valueTools available to the model
Show child attributes
Show array items
oneOf · 8 options
WebSearchTool
Web search tool configuration for the Responses API
filtersvalueShow child attributes
allOf · 2 options
SearchDomainFilter
search_domain_filterarray of stringLimit search results to specific domains (max 20)
Show child attributes
DateFilters
last_updated_after_filterstringInput: MM/DD/YYYY, Output: YYYY-MM-DD
last_updated_before_filterstringInput: MM/DD/YYYY, Output: YYYY-MM-DD
search_after_date_filterstringInput: MM/DD/YYYY, Output: YYYY-MM-DD
search_before_date_filterstringInput: MM/DD/YYYY, Output: YYYY-MM-DD
search_recency_filterstringTime-based recency filter for search results
max_resultsinteger · int32Upper bound on the number of search results collected per call. Must be between 1 and 50; values outside that range are rejected with a 400 error.
max_tokensinteger · int32Maximum total tokens for search context
max_tokens_per_pageinteger · int32Maximum tokens to extract per search result page
search_context_sizestringNamed search context budget. Explicit max_tokens / max_tokens_per_page budgets override it.
search_typestringSearch type for this tool. `web` uses standard web search. `fast` uses the lower-latency Fast Search path, billed at $1.00 per 1,000 invocations plus model tokens. When omitted, inherits the preset's search type if configured; otherwise uses `web`.
typestringrequiredTool type identifier
user_locationobjectUser's geographic location for search personalization
Show child attributes
citystringCity name
countrystringISO 3166-1 alpha-2 country code
latitudenumber · doubleLatitude coordinate
longitudenumber · doubleLongitude coordinate
regionstringState or region name
FinanceSearchTool
Finance search tool configuration for the Agent API
typestringrequiredTool type identifier
PeopleSearchTool
People search tool configuration for the Agent API
typestringrequiredTool type identifier
FetchUrlTool
max_urlsinteger · int32Maximum number of URLs to fetch per tool call
typestringrequiredFunctionTool
descriptionstringA description of what the function does
namestringrequiredThe name of the function
parametersobjectJSON Schema defining the function's parameters
strictbooleanWhether to enable strict schema validation
typestringrequiredSandboxTool
Sandbox tool configuration for the Responses API. Executes code in an isolated container during an Agent API request.
typestringrequiredTool type identifier
McpTool
Connects a user-supplied remote MCP server. Agent API discovers the server's tools when the request starts and calls them like native tools. Matches OpenAI's mcp tool. `defer_loading: true` keeps discovered definitions out of the initial model context and lets the model search, inspect, and call them as needed. `require_approval` and `connector_id` are ignored: every call auto-runs, and only bring-your-own `server_url` is honored.
allowed_toolsarray of stringOptional allowlist of tool names. Empty exposes all discovered tools.
Show child attributes
authorizationstringAn access token passed to the remote MCP server for authentication. Provide the raw token value. Never logged or echoed.
defer_loadingbooleanWhen true, keeps discovered tool definitions out of the initial model context and lets the model load relevant schemas as needed. Defaults to false.
headersobjectExtra request headers.
server_labelstringrequiredUnique per request, ^[a-zA-Z0-9_-]{1,64}$. Namespaces the server's tools.
server_urlstringrequiredHTTPS URL of the remote MCP server. Must be a Streamable HTTP MCP endpoint; the legacy SSE transport is not supported.
typestringrequiredConnectorTool
A Perplexity-managed connector scoped to the authenticated API organization.
allowed_toolsarray of stringOptional exact-name allowlist. Omitted or empty admits every live tool.
Show child attributes
idstringrequiredOpaque connector identifier.
server_descriptionstringOptional model-facing namespace description.
server_labelstringrequiredUnique per request, ^[a-zA-Z0-9_-]{1,64}$. Namespaces the connector's tools.
typestringrequiredtop_pnumber · doubleOpenAI-compatible nucleus sampling parameter forwarded to generation.
{
"background": true,
"input": "string",
"instructions": "string",
"language_preference": "string",
"max_output_tokens": 0,
"max_steps": 0,
"model": "string",
"models": [
"string"
],
"preset": "string",
"previous_response_id": "string",
"profile": {
"id": "string",
"type": "custom",
"version": "string"
},
"reasoning": {
"effort": "high"
},
"response_format": {
"json_schema": {
"description": "string",
"name": "string",
"schema": {
"additionalProp1": null
},
"strict": true
},
"type": "json_schema"
},
"skills": [
{
"name": "office",
"type": "builtin"
}
],
"store": true,
"stream": true,
"temperature": 0,
"tools": [
{
"allowed_tools": [
"string"
],
"id": "string",
"server_description": "string",
"server_label": "string",
"type": "connector"
}
],
"top_p": 0
}Responses
ResponsesResponse
Non-streaming response returned when stream is false
created_atinteger · int64requiredUnix timestamp when the response was created
errorobjectError information returned when a request fails
Show child attributes
codestringError code
messagestringrequiredHuman-readable error message
typestringError type category
idstringrequiredUnique identifier for the response
modelstringrequiredModel used for generation
objectstringrequiredObject type in API responses
outputarray of valuerequiredArray of output items (messages, search results, tool calls)
Show child attributes
Show array items
oneOf · 10 options
MessageOutputItem
contentarray of objectrequiredShow child attributes
Show array items
annotationsarray of objectShow child attributes
Show array items
Text annotation (URL citation)
end_indexinteger · int32End character index of the annotated text
start_indexinteger · int32Start character index of the annotated text
titlestringTitle of the cited source
typestringAnnotation type (url_citation)
urlstringURL of the cited source
textstringrequiredtypestringrequiredType of a content part
idstringrequiredrolestringrequiredRole in a message
statusstringrequiredStatus of a response or output item
typestringrequiredSearchResultsOutputItem
queriesarray of stringShow child attributes
resultsarray of objectrequiredShow child attributes
Show array items
A single search result used in LLM responses
datestringPublication date of the result
idinteger · int64requiredUnique numeric identifier for the result
last_updatedstringDate the result was last updated
snippetstringrequiredText snippet from the search result
sourcestringSource of search results
titlestringrequiredTitle of the search result page
urlstringrequiredURL of the search result page
typestringrequiredFetchUrlResultsOutputItem
contentsarray of objectrequiredShow child attributes
Show array items
Content fetched from a URL
snippetstringrequiredThe fetched content snippet
titlestringrequiredThe title of the page
urlstringrequiredThe URL from which content was fetched
typestringrequiredFinanceResultsOutputItem
Intermediate output item emitted when the finance_search tool runs. One item is emitted per tool invocation; the requested categories and tickers are echoed at the envelope level alongside the per-result entries.
categoriesarray of stringFinance categories the tool was asked to retrieve for this invocation (for example, "quote").
Show child attributes
resultsarray of objectrequiredStructured finance results returned for the invocation.
Show child attributes
Show array items
A single structured finance result returned by the finance_search tool.
categorystringrequiredFinance category this result belongs to (for example, "quote").
contentstringrequiredStructured content for the result, typically a markdown-formatted table or snippet.
sourcesarray of stringSource URLs backing the structured content.
Show child attributes
tickersarray of stringTicker symbols this result pertains to.
Show child attributes
tickersarray of stringTicker symbols the tool was asked to retrieve for this invocation.
Show child attributes
typestringrequiredPeopleSearchResultsOutputItem
Intermediate output item emitted when the people_search tool runs. Mirrors the shape of search_results: the agent's generated queries plus a list of per-person result entries.
queriesarray of stringSearch queries the agent generated for this people_search invocation.
Show child attributes
resultsarray of objectrequiredPer-person result entries. Shape matches SearchResult (id, url, title, snippet, source, last_updated).
Show child attributes
typestringrequiredFunctionCallOutputItem
argumentsstringrequiredJSON string of arguments
call_idstringrequiredCorrelates with function_call_output input
idstringrequirednamestringrequiredstatusstringrequiredStatus of a response or output item
thought_signaturestringBase64-encoded opaque signature for thinking models
typestringrequiredSandboxResultsOutputItem
Result of a sandbox tool invocation. Contains the executed code and its output.
codestringThe code that was executed inside the sandbox.
duration_msinteger · int64Wall-clock duration of the sandbox execution, in milliseconds.
exit_codeinteger · int32Process exit code. Non-zero indicates a runtime error.
statusstringrequiredExecution status. One of `completed`, `timed_out`, `failed`.
stderrstringStandard error captured from the sandbox execution.
stdoutstringStandard output captured from the sandbox execution.
typestringrequiredMcpListToolsOutputItem
Tools discovered on one external MCP server when the request starts. Matches OpenAI's mcp_list_tools item.
connector_idstringPresent only when the item originated from a managed connector.
errorstringPresent only when the server's tools could not be listed. Absent on success.
idstringrequiredserver_labelstringrequiredtoolsarray of objectrequiredShow child attributes
Show array items
One tool discovered on a remote MCP server.
descriptionstringinput_schemaobjectrequiredThe server's JSON Schema for the tool, passed through unmodified.
namestringrequiredtypestringrequiredMcpCallOutputItem
One tool call executed against an external MCP server, modeled on OpenAI's mcp_call item.
argumentsstringrequiredJSON-encoded arguments the model passed.
connector_idstringPresent only when the item originated from a managed connector.
errornull | stringThe failure string when the call failed (also returned to the model in-band); null on success, matching OpenAI's mcp_call.
idstringrequirednamestringrequiredoutputstringTool output text; empty when the call failed.
server_labelstringrequiredtypestringrequiredToolSearchOutputItem
Complete public definitions matched by one hosted external-tool search.
argumentsstringExact argument text authored by the model for hosted search.
call_idnull | stringrequiredAlways null for hosted search.
executionstringrequiredExecution location. Currently `server`. Clients must tolerate unknown values.
idstringrequiredstatusstringrequiredCurrent execution status. Known values are `in_progress`, `completed`, and `incomplete`. Clients must tolerate unknown values.
toolsarray of objectrequiredShow child attributes
Show array items
A response-only namespace containing complete external tool definitions.
descriptionstringrequirednamestringrequiredtoolsarray of objectrequiredShow child attributes
Show array items
One function definition discovered by hosted external-tool search.
descriptionstringnamestringrequiredparametersobjectThe server's JSON Schema for the tool, passed through unmodified.
typestringrequiredtypestringrequiredtypestringrequiredstatusstringrequiredStatus of a response or output item
usageobjectToken usage and cost information for a Responses API request
Show child attributes
costobjectCost breakdown for a Responses API request
Show child attributes
cache_creation_costnumber · doubleCost for cache creation in USD
cache_read_costnumber · doubleCost for cache reads in USD
currencystringrequiredCurrency code for cost values
input_costnumber · doublerequiredCost for input tokens in USD
output_costnumber · doublerequiredCost for output tokens in USD
tool_calls_costnumber · doubleCost for tool call invocations in USD
total_costnumber · doublerequiredTotal cost for the request in USD
input_tokensinteger · int64requiredNumber of input tokens used
input_tokens_detailsobjectShow child attributes
cache_creation_input_tokensinteger · int64Tokens used for cache creation
cache_read_input_tokensinteger · int64Tokens read from cache
output_tokensinteger · int64requiredNumber of output tokens generated
tool_calls_detailsobjectDetails about tool call invocations
total_tokensinteger · int64requiredTotal tokens used (input + output)
ResponseStreamEvent
SSE stream event. Discriminate by the `type` field: - `response.created`: Initial response object - `response.in_progress`: Response processing started - `response.completed`: Final response with output - `response.failed`: Error occurred - `response.output_item.added`: New output item started - `response.output_item.done`: Output item completed - `response.output_text.delta`: Streaming text delta - `response.output_text.done`: Final text content - `response.reasoning.started`: Reasoning phase started - `response.reasoning.search_queries`: Search queries issued - `response.reasoning.search_results`: Search results received - `response.reasoning.fetch_url_queries`: URL fetch queries issued - `response.reasoning.fetch_url_results`: URL fetch results received - `response.reasoning.stopped`: Reasoning phase complete
oneOf · 14 options
ResponseCreatedEvent
Response created event (type: "response.created"). Contains the initial response object.
responseobjectNon-streaming response returned when stream is false
Show child attributes
created_atinteger · int64requiredUnix timestamp when the response was created
Error information returned when a request fails
idstringrequiredUnique identifier for the response
modelstringrequiredModel used for generation
objectstringrequiredObject type in API responses
outputarray of valuerequiredArray of output items (messages, search results, tool calls)
Show child attributes
statusstringrequiredStatus of a response or output item
Token usage and cost information for a Responses API request
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
ResponseInProgressEvent
Response in progress event (type: "response.in_progress"). Emitted when response processing has started.
Non-streaming response returned when stream is false
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
ResponseCompletedEvent
Response event Contains the full or partial response object.
Non-streaming response returned when stream is false
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
ResponseFailedEvent
Response failed event (type: "response.failed"). Contains error details when streaming fails.
Error information returned when a request fails
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
OutputItemAddedEvent
Output item added event (type: "response.output_item.added"). Emitted when a new output item (message or tool call) starts.
output_indexinteger · int64requiredsequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
OutputItemDoneEvent
Output item done event (type: "response.output_item.done"). Emitted when an output item (message or tool call) completes.
output_indexinteger · int64requiredsequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
TextDeltaEvent
Text delta event (type: "response.output_text.delta"). Contains incremental text content.
content_indexinteger · int64requireddeltastringrequireditem_idstringrequiredoutput_indexinteger · int64requiredsequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
typestringrequiredSSE event type discriminator
TextDoneEvent
Text done event (type: "response.output_text.done"). Contains the final text content.
content_indexinteger · int64requireditem_idstringrequiredoutput_indexinteger · int64requiredsequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
textstringrequiredtypestringrequiredSSE event type discriminator
ReasoningStartedEvent
Reasoning started event (type: "response.reasoning.started"). Signals the model has started reasoning/searching.
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
SearchQueriesEvent
Search queries event (type: "response.reasoning.search_queries"). Contains search queries being executed.
queriesarray of stringrequiredShow child attributes
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
SearchResultsEvent
Search results event (type: "response.reasoning.search_results"). Contains search results returned.
resultsarray of objectrequiredShow child attributes
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
Token usage and cost information for a Responses API request
FetchUrlQueriesEvent
URL fetch queries event (type: "response.reasoning.fetch_url_queries"). Contains URLs being fetched.
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
urlsarray of stringrequiredShow child attributes
FetchUrlResultsEvent
URL fetch results event (type: "response.reasoning.fetch_url_results"). Contains fetched URL contents.
contentsarray of objectrequiredShow child attributes
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
ReasoningStoppedEvent
Reasoning stopped event (type: "response.reasoning.stopped"). Signals the model has finished reasoning/searching.
sequence_numberinteger · int64requiredMonotonically increasing sequence number for event ordering
thoughtstringtypestringrequiredSSE event type discriminator
{
"created_at": 0,
"error": {
"code": "string",
"message": "string",
"type": "string"
},
"id": "string",
"model": "string",
"object": "response",
"output": [
{
"contents": [
{
"snippet": "string",
"title": "string",
"url": "string"
}
],
"type": "fetch_url_results"
}
],
"status": "cancelled",
"usage": {
"cost": {
"cache_creation_cost": 0,
"cache_read_cost": 0,
"currency": "USD",
"input_cost": 0,
"output_cost": 0,
"tool_calls_cost": 0,
"total_cost": 0
},
"input_tokens": 0,
"input_tokens_details": {
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
},
"output_tokens": 0,
"tool_calls_details": {
"additionalProp1": {
"invocation": 0
}
},
"total_tokens": 0
}
}Error information returned when a request fails
{
"error": {
"code": "string",
"message": "string",
"type": "string"
}
}