For the complete documentation index, see llms.txt. This page is also available as Markdown.

Web API

Learn how to use and integrate Oxylabs Web API – an all-in-one REST API for web search and page data collection.

The Oxylabs Web API gives applications and AI agents live access to the open web through a unified REST interface. It handles JavaScript rendering, bot traffic challenges, proxy rotation, and geo-targeting through separate endpoint for different web data acquisition stages:

Endpoint
Used for
Input

Discovering and ranking organic web results.

Keyword / Query

Rendering and extracting page data as Markdown, HTML, JSON, or Screenshot.

Page URL

How to use it

Get an API key

In the Oxylabs dashboard, create a Web API instance, get the API key from the product instance, and export it to your project environment (e.g. your OS terminal or the CLI terminal in the project workspace):

export OXYLABS_WEB_API_KEY=your_api_key_here

See Authentication for key handling and rotation.

Choose integration method

  • Plugging this into an AI agent (Claude Code, Cursor, or your own agent)? Check the AI agent integrations to start using it with one command.

  • Building your own integration? Follow the steps below to integrate directly using REST endpoints.

Manual integration

1
curl https://webapi.oxylabs.io/v1/search \
  -H "Authorization: Bearer $OXYLABS_WEB_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"query": "eu ai act compliance deadlines", "max_results": 3}'
import os, requests

resp = requests.post(
    "https://webapi.oxylabs.io/v1/search",
    headers={"Authorization": f"Bearer {os.environ['OXYLABS_WEB_API_KEY']}"},
    json={"query": "eu ai act compliance deadlines", "max_results": 3},
    timeout=120,
)
resp.raise_for_status()

for r in resp.json()["results"]:
    print(r["metadata"]["position"], r["title"], r["url"], sep=" | ")
const res = await fetch("https://webapi.oxylabs.io/v1/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OXYLABS_WEB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ query: "eu ai act compliance deadlines", max_results: 3 }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);

const { results } = await res.json();
results.forEach((r) => console.log(r.metadata.position, r.title, r.url));

Output sample

{
  "state": "done",
  "results": [
    {
      "title": "Implementation Timeline | EU Artificial Intelligence Act",
      "outline": [
        "Date 2 August 2025 Providers: need to be compliant with the AI Act by 2 August 2027..."
      ],
      "url": "https://artificialintelligenceact.eu/implementation-timeline/",
      "metadata": { "position": 1 }
    }
  ],
  "params": { "query": "eu ai act compliance deadlines", "location": null, "max_results": 3 },
  "metadata": { "timestamp": 1787431568, "request_id": "1788875675880097469" }
}

See /search for request parameters and output dictionary.

2

Scrape

Read the pages collected by /search or your URL list:

curl https://webapi.oxylabs.io/v1/scrape \
  -H "Authorization: Bearer $OXYLABS_WEB_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
      "url": "https://artificialintelligenceact.eu/implementation-timeline/",
      "output": ["markdown"]
  }'
page = requests.post(
    "https://webapi.oxylabs.io/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['OXYLABS_WEB_API_KEY']}"},
    json={
        "url": "https://artificialintelligenceact.eu/implementation-timeline/",
        "output": ["markdown"],
    },
    timeout=120,
)
page.raise_for_status()
print(page.json()["results"][0]["markdown"][:2000])
const page = await fetch("https://webapi.oxylabs.io/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OXYLABS_WEB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://artificialintelligenceact.eu/implementation-timeline/",
    output: ["markdown"],
  }),
});
if (!page.ok) throw new Error(`${page.status} ${await page.text()}`);

const { results } = await page.json();
console.log(results[0].markdown.slice(0, 2000));

See /scrape for request parameters, output dictionary, delivery modes .

3

Combine: search-to-scrape

Search snippets (outline) are truncated and insufficient for deep analysis or LLM pipelines. The standard integration pattern queries /v1/search to discover authoritative links, then routes those URLs to /v1/scrape requesting Markdown output to strip unnecessary HTML artifacts.

Python example below shows both endpoints in a single workflow:

AI agent integration

Connect the Web API directly to AI frameworks, coding assistants (Cursor, Claude Code), or custom agents.

Option 1: Integration Prompt

Paste the following complete prompt into an AI coding agent (Claude Code, Cursor, Copilot) to instruct it to build a custom integration following our technical specification:

The prompt points the agent at a single page with a full product source-of-truth: base URL, authorization, both endpoint schemas, reference code, error and retry rules, and an agent checklist.

You can find the complete agent specification reference in the For Agents page.

If the agent can't fetch URLs, give it the full page instead. for-agents.md is plain Markdown and self-contained, so save it or paste it in above the prompt and drop the paragraph that names the URL. Keep the spec itself out of the prompt: the two retry rules are repeated there because an agent applies them mid-task, everything else belongs on the page so it can't drift.

Option 2: Agent skills

Install official agent skills to teach your AI agent research methodologies, source citation rules, and search-to-scrape execution:

For more installation options, see Oxylabs Agent Skills.

Option 3: MCP server

Connect to or self-host our official MCP server to expose Web API search, scrape, and dedicated scraper tools directly to Claude Code, Cursor, or your custom AI agent by pointing your agent to the Oxylabs-hosted server – https://mcp.oxylabs.io/web-api-mcp:

Claude Code
ChatGPT/Codex
Cursor (or other clients supporting custom headers)

For any client that supports remote MCP servers with custom headers, add the server URL and an Authorization header to the client's MCP configuration. For example, in Cursor's mcp.json:

Field names can differ between clients – check your client's documentation for how to add a remote MCP server with headers.

To learn more about Web API MCP or how to self-host the official Oxylabs server server, see MCP servers.

Skills or MCP?

Gives the agent

Judgment: when to search, which sources to trust, how to cite

Typed tools it can call directly

Needs a running process

No

Yes

Works in

Agents that load skill directories

Any MCP client

Installing both is an option. The server bundles oxylabs-web-api and serves it as the oxylabs://skill/web-api resource, so connecting it alone gives an agent both halves. Install the skills separately when you want them without a running server, or when you want migrate your codebase to Oxylabs.

Learn more

Key handling, header requirements, and authentication troubleshooting.

Full request parameters and response schemas for /v1/search.

Request parameters and output dictionary for /v1/scrape.

Target-specific parsed endpoints (Google, Amazon, YouTube, Walmart, etc.).

Realtime calls, async single-job polling/webhooks, and bulk batch queues.

Extracting structured JSON using natural-language prompts or JSON Schemas.

HTTP status codes, retry logic, and troubleshooting tips.

Last updated

Was this helpful?