# Fetch

Fetch a web page and return its title and content as Markdown. See the [Search & Fetch guide](https://api-docs.deepseek.com/guides/search.md) for error handling and billing.

The response example shows an excerpt of the page content.

## Endpoint

```http
POST /v1/tools/fetch
```

operationId: `fetch`

### Servers

- `https://api.deepseek.com`

## Authentication

### Alternative 1

**bearerAuth**

`Authorization: Bearer <API_KEY>`

```yaml
type: http
scheme: bearer
```

## Request body

**required**

### application/json

- Reference: [FetchRequest](#schema-fetch-request) (`#/components/schemas/FetchRequest`)

## Responses

### 200

OK, returns the fetched page content.

#### application/json

- Reference: [FetchResponse](#schema-fetch-response) (`#/components/schemas/FetchResponse`)

**Example**

```json
{
  "title": "Your First API Call | DeepSeek API Docs",
  "content": "# Your First API Call\n\nThe DeepSeek API uses an API format compatible with OpenAI/Anthropic. By modifying the configuration, you can use the OpenAI/Anthropic SDK or softwares compatible with the OpenAI/Anthropic API to access the DeepSeek API."
}
```

## Code samples

### curl

```bash
# Set DEEPSEEK_API_KEY to your API key before running this example.
curl --silent --show-error --max-time 60 "https://api.deepseek.com/v1/tools/fetch" \
  --header "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
  "url": "https://api-docs.deepseek.com/"
}'
```

### Python — requests

```python
# Set DEEPSEEK_API_KEY to your API key before running this example.
import os
import requests

response = requests.post(
    "https://api.deepseek.com/v1/tools/fetch",
    headers={"Authorization": f"Bearer {os.environ['DEEPSEEK_API_KEY']}"},
    json={"url": "https://api-docs.deepseek.com/"},
    timeout=60,
)
response.raise_for_status()
page = response.json()
print(page["title"])
print(page["content"])
```

## Referenced schemas

### schema-fetch-request

**FetchRequest** — `#/components/schemas/FetchRequest`

- `type`: `object`

- `required`: `["url"]`

- **Properties**

  - **`url`** (required)

    The URL to fetch. Must be at most 8192 characters and an HTTP or HTTPS URL with a host. The URL must not contain a username or password.

    - `type`: `string`

    - `minLength`: `1`

    - `maxLength`: `8192`

### schema-fetch-response

**FetchResponse** — `#/components/schemas/FetchResponse`

- `type`: `object`

- `required`: `["title","content"]`

- **Properties**

  - **`title`** (required)

    The title of the page. Empty when the title is unavailable.

    - `type`: `string`

  - **`content`** (required)

    The fetched page content as Markdown text.

    - `type`: `string`
