# FetchWeb Extract and Optimize

> FetchWeb Extract and Optimize is a paid API for AI agents from fetchweb.net, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-10).

Fetches a URL, extracts its content, and trims it to fit a specified token budget while reporting what was omitted and how many tokens were saved.

## Facts

- Endpoint: GET https://fetchweb.net/api/public/extract-and-optimize?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fetchweb-extract-and-optimize-d13fcb17
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_vKSTqaEE4J0ELjsCXiY7Z

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability fetchweb-extract-and-optimize-d13fcb17
```

Example prompt: Fetch https://en.wikipedia.org/wiki/Transformer_(machine_learning_model) and return the content optimized to fit within 3000 tokens, keeping code and tables, and focus on the architecture section.

## When to prefer this

Choose this endpoint when you need to fetch a web page and immediately fit it into a tight LLM context window, especially when you care about knowing exactly what was dropped. It is ideal for agentic pipelines that need token-budget-aware web retrieval with an omission manifest, as opposed to raw scraping or simple text extraction endpoints that ignore token limits.

## Known failure modes

- URL is unreachable or returns non-200 status — content field may be empty or error returned
- max_tokens set too low to return meaningful content — heavy omissions with minimal output
- Page is paywalled or requires JavaScript rendering — extracted content may be incomplete
- Token count estimation may be flagged as estimated=true rather than exact
- Payment not processed — charged:false and no content returned

## How this service works

Fetch a URL and return context already fitted to your token budget, with token counts and an omission manifest.

## Output

Returns a JSON object containing: the optimized page content as a string, a token report (tokens in, tokens out, tokens saved, reduction percent, budget), a page outline, and an omissions array listing what was dropped to meet the token budget. Also includes a charged boolean.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "url"
     ],
     "properties": {
      "url": {
       "type": "string"
      },
      "query": {
       "type": "string"
      },
      "max_tokens": {
       "type": "number",
       "default": 2000
      },
      "preserve_code": {
       "type": "boolean",
       "default": true
      },
      "preserve_links": {
       "type": "boolean",
       "default": true
      },
      "preserve_tables": {
       "type": "boolean",
       "default": true
      }
     }
    }
   }
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "report": {
       "type": "object",
       "properties": {
        "tokensIn": {
         "type": "number"
        },
        "estimated": {
         "type": "boolean"
        },
        "tokensOut": {
         "type": "number"
        },
        "tokensSaved": {
         "type": "number"
        },
        "budgetTokens": {
         "type": "number"
        },
        "reductionPercent": {
         "type": "number"
        }
       }
      },
      "charged": {
       "type": "boolean"
      },
      "content": {
       "type": "string"
      },
      "outline": {
       "type": "array"
      },
      "omissions": {
       "type": "array"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "report": {
   "type": "object",
   "properties": {
    "tokensIn": {
     "type": "number"
    },
    "estimated": {
     "type": "boolean"
    },
    "tokensOut": {
     "type": "number"
    },
    "tokensSaved": {
     "type": "number"
    },
    "budgetTokens": {
     "type": "number"
    },
    "reductionPercent": {
     "type": "number"
    }
   }
  },
  "charged": {
   "type": "boolean"
  },
  "content": {
   "type": "string"
  },
  "outline": {
   "type": "array"
  },
  "omissions": {
   "type": "array"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fetchweb-extract-and-optimize-d13fcb17/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from fetchweb.net](https://www.zero.xyz/host/fetchweb.net/llms.txt)
