Skip to main content
Use Web Fetch when you need the assistant to retrieve content from a URL.

Prerequisites

Requirements

  • Tool spec: { "name": "web_extract", "type": "web_extract_v1" }
  • No tool_context required

Basic request and response

This example validates a request that enables the web fetch tool:
curl -X POST "https://{BASE_URL}/api/gpt/v1/messages/validate" \
  -H "Authorization: Bearer {API_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "default",
    "max_tokens": 64,
    "messages": [
      { "role": "user", "content": "Summarize https://example.com/" }
    ],
    "tools": [
      { "name": "web_extract", "type": "web_extract_v1" }
    ],
    "tool_choice": { "type": "auto" }
  }'
Example response:
{ "valid": true, "errors": null }
To run the request, send the same body to POST /messages.

Tips

  • The URL must appear in the user message.
  • Keep the prompt concise to reduce extraction time.

Next steps

  • Learn how messages return tool blocks: Messages