Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.perplexity.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The fetch_url tool fetches and extracts content from specific URLs during an Agent API request. Use it when your application already knows which page, article, document, or report the model should inspect. Use fetch_url when you need full page content from known URLs. Use web_search when the model first needs to discover relevant pages.
from perplexity import Perplexity

client = Perplexity()

response = client.responses.create(
    model="openai/gpt-5.5",
    input="Summarize the key claims in https://example.com/report.",
    tools=[
        {
            "type": "fetch_url"
        }
    ],
    instructions="Fetch the URL before summarizing it.",
)

print(response.output_text)

When to Use

Use fetch_url when…Use web_search when…
You already have a URLYou need to discover relevant pages
You need fuller page contentYou need snippets from multiple sources
You are summarizing a specific article or documentYou are researching a broad topic
You want the model to inspect a known sourceYou want the model to find current sources
Combine web_search and fetch_url for multi-step research: search to find relevant pages, then fetch the most important URLs for fuller context.

Parameters

ParameterTypeRequiredDescription
typestringYesMust be "fetch_url".
max_urlsintegerNoMaximum number of URLs to fetch per tool call. The API schema allows values from 1 to 10.

Response Shape

When fetch_url runs, the response can include a fetch_url_results output item before the final assistant message. Each fetched content item includes the URL, page title, and extracted snippet.
{
  "output": [
    {
      "type": "fetch_url_results",
      "contents": [
        {
          "url": "https://example.com/report",
          "title": "Example Report",
          "snippet": "Extracted content from the fetched page."
        }
      ]
    },
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "The answer generated from the fetched URL content."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 900,
    "output_tokens": 250,
    "total_tokens": 1150,
    "tool_calls_details": {
      "fetch_url": {
        "invocation": 1
      }
    }
  }
}

Pricing

fetch_url is billed at $0.50 per 1,000 invocations. Model token usage is billed separately according to Agent API token pricing.
Pricing follows the same pattern as other tool calls: pay for tool invocations plus model tokens. See Pricing.

Next Steps

Web Search

Search the web before fetching source content.

Finance Search

Retrieve structured financial and market data.

People Search

Search for professionals and employees.

API Reference

View complete endpoint documentation.