# Tavily — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> AI-optimized web search, content extraction, site mapping, and crawling API.

**Category:** Web Search & Scraping | **Website:** [tavily.com](https://tavily.com) | **Docs:** [docs.tavily.com](https://docs.tavily.com)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/tavily/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Also available via public x402 on Base (no account needed): [x402/tavily.md](https://paywithlocus.com/x402/tavily.md)

> Also available via MPP (no account needed): [mpp/tavily.md](https://paywithlocus.com/mpp/tavily.md)

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Search

Execute a web search query optimized for AI agents. Returns relevant results with optional AI-generated answer.

**Estimated cost:** $0.09 (basic) / $0.16 (advanced)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Search query |
| `search_depth` | string | No | Search depth: 'basic' (default) or 'advanced' |
| `topic` | string | No | Topic category: 'general' (default) or 'news' |
| `max_results` | number | No | Maximum number of results (default 5) |
| `include_answer` | boolean \| string | No | Include AI-generated answer: true, false, or 'advanced' |
| `include_raw_content` | boolean | No | Include raw HTML content in results |
| `include_images` | boolean | No | Include related images in results |
| `include_domains` | string[] | No | Only include results from these domains |
| `exclude_domains` | string[] | No | Exclude results from these domains |
| `days` | number | No | Only return results from the last N days |
| `country` | string | No | Country code for search results (e.g. "us", "gb") |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/tavily/search \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"query":"x402 discovery"}'
```

### Extract

Extract clean content from one or more URLs. Returns parsed text optimized for LLM consumption.

**Estimated cost:** $0.11+ (scales with URL count)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `urls` | string[] | Yes | URLs to extract content from (max 20) |
| `extract_depth` | string | No | Extraction depth: 'basic' (default) or 'advanced' |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/tavily/extract \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com"]}'
```

### Map

Discover and enumerate all URLs on a website. Returns a comprehensive sitemap without scraping content.

**Estimated cost:** $0.09

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `url` | string | Yes | Website URL to map |
| `max_depth` | number | No | Maximum crawl depth for discovery |
| `max_breadth` | number | No | Maximum breadth per level |
| `limit` | number | No | Maximum number of URLs to return |
| `instructions` | string | No | Natural language instructions to guide URL discovery |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/tavily/map \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://docs.tavily.com","limit":3}'
```

### Crawl

Crawl a website and extract content from discovered pages. Combines mapping and extraction in a single call.

**Estimated cost:** $0.21+ (scales with page limit)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `url` | string | Yes | Starting URL to crawl |
| `max_depth` | number | No | Maximum crawl depth |
| `max_breadth` | number | No | Maximum breadth per level |
| `limit` | number | No | Maximum number of pages to crawl (default 10) |
| `instructions` | string | No | Natural language instructions to guide crawling |
| `extract_depth` | string | No | Extraction depth: 'basic' (default) or 'advanced' |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/tavily/crawl \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://docs.tavily.com","limit":1,"max_depth":1}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.