---
title: 'SerpApi: Markdown Output for AI Agents'
description: Get search results as clean, token-efficient markdown instead of JSON.
  Built for LLMs, AI agents, and agentic workflows.
url: https://serpapi.com/markdown-output
site: SerpApi – Real-time search engine results API
signup: https://serpapi.com/users/sign_up
docs:
  pricing: https://serpapi.com/pricing.md
  integrations: https://serpapi.com/integrations.md
  markdown_output: https://serpapi.com/markdown-output.md
---

# Web search results, optimized for LLMs

Search results optimized for AI agents.

Serve any SerpApi search result as clean markdown. Same data as JSON, zero configuration, roughly half the tokens. Works with every API.

## How to use

1. Add `output=md` to any search request
2. Or use the `/search.md` endpoint directly
3. Or request `Accept: text/markdown` in your HTTP headers

## Three ways to access

```bash
# Query parameter
curl "https://serpapi.com/search?engine=google&q=coffee&api_key=YOUR_KEY&output=md"

# .md route
curl "https://serpapi.com/search.md?engine=google&q=coffee&api_key=YOUR_KEY"

# Accept header
curl -H "Accept: text/markdown" "https://serpapi.com/search?engine=google&q=coffee&api_key=YOUR_KEY"
```

## Why markdown?

- Half the tokens of equivalent JSON, same information.
- Natural reading flow with tables, links, and headers instead of nested braces.
- URLs rendered as proper markdown links, `[title](url)` instead of separate fields.
- Tracking fields, opaque tokens, and duplicated values stripped automatically.
- Works across all 100+ SerpApi APIs with zero configuration.

## What you get

- YAML frontmatter with search metadata and parameters
- Result arrays render as clean markdown tables (organic results, shopping, etc.).
- Clean lists for related searches, pagination, and simple data
- Image URLs rendered as `![alt](url)` markdown images
- Linked images where both image and destination URL exist
- Shallow nested data (ratings, user info) flattened into table columns

## Example

A search for &quot;Coffee&quot; returns clean, scannable markdown:

```markdown
---
search_metadata:
  engine: google
  q: coffee
search_parameters:
  device: desktop
  location: Austin, Texas
---

## Organic Results

| Position | Title | Snippet | Source |
| --- | --- | --- | --- |
| 1 | [Coffee - Wikipedia](https://en.wikipedia.org/wiki/Coffee) | Coffee is a beverage brewed from roasted, ground coffee beans... | Wikipedia |
| 2 | [Starbucks Coffee Company](https://www.starbucks.com/) | Explore the menu, sign up for Starbucks Rewards... | Starbucks |

## Related Searches

1. [Coffee near me](https://www.google.com/search?q=Coffee+near+me)
2. [Coffee beans](https://www.google.com/search?q=Coffee+beans)
3. [Coffee types](https://www.google.com/search?q=Coffee+types)
```

Combine with our [JSON Restrictor](https://serpapi.com/json-restrictor) parameter to keep only the sections your agent needs, cutting token usage even further.

```markdown
## Organic Results

| Position | Title | Snippet | Source |
| --- | --- | --- | --- |
| 1 | [Coffee - Wikipedia](https://en.wikipedia.org/wiki/Coffee) | Coffee is a beverage brewed from roasted, ground coffee beans... | Wikipedia |
| 2 | [Starbucks Coffee Company](https://www.starbucks.com/) | Explore the menu, sign up for Starbucks Rewards... | Starbucks |
```

## Token savings by API

Cut token usage by 50% on average. Maximize your efficiency with massive savings of more than 90% on APIs with complex nested JSON.

| API | JSON | Markdown | Savings |
|--------|------|----------|---------|
| Google Search | 150K | 39K | 74% |
| Google Shopping | 361K | 38K | 90% |
| Google Hotels | 202K | 22K | 89% |
| Apple Maps | 494K | 43K | 91% |
| Amazon | 191K | 97K | 49% |
| DuckDuckGo | 32K | 12K | 64% |
| Bing Shopping | 214K | 103K | 52% |
| Walmart | 106K | 68K | 36% |
| YouTube | varies | varies | ~50% avg |

