# 40% Myth API

**Base URL:** `https://40percentmyth.com/api`

A free, read-only REST API for accessing the 40% Myth business platform research database.
No API key required. No rate limits (please be reasonable).

## Endpoints

### GET /api/businesses

Returns a list of businesses. Supports the following query parameters:

| Parameter  | Type   | Description                                      | Example             |
|------------|--------|--------------------------------------------------|---------------------|
| city       | string | Filter by city name                              | `city=Austin`       |
| state      | string | Filter by state abbreviation                     | `state=TX`          |
| category   | string | Filter by business category                      | `category=Restaurant` |
| platform   | string | Filter by platform (partial match)               | `platform=Shopify`  |
| wordpress  | string | Filter by WordPress usage: `Yes`, `No`, `Unknown`| `wordpress=Yes`     |
| search     | string | Search business name or notes                    | `search=pizza`      |

**Response:**
```json
{
  "count": 142,
  "data": [
    {
      "id": 1,
      "name": "Uchiko",
      "city": "Austin",
      "state": "TX",
      "category": "Restaurant",
      "website": "https://uchikoaustin.com",
      "uses_wordpress": "No",
      "platform": "Squarespace",
      "notes": "Upscale Japanese farmhouse restaurant...",
      "created_at": "2026-03-08 00:00:00",
      "updated_at": "2026-03-08 00:00:00"
    }
  ]
}
```

### GET /api/stats

Returns aggregate statistics across the full database.

**Response:**
```json
{
  "total": 2812,
  "wpCount": 623,
  "wpPercent": "22.2",
  "withWebsite": 2801,
  "byCategory": [
    { "category": "Restaurant", "count": 480 }
  ],
  "byPlatform": [
    { "platform": "WordPress", "count": 623 }
  ]
}
```

## Categories

Valid category values: `Retail`, `Restaurant`, `E-Commerce`, `Service`, `Real Estate`, `Church`

## Example Queries

```bash
# All restaurants in Austin, TX
curl "https://40percentmyth.com/api/businesses?city=Austin&category=Restaurant"

# All WordPress sites in Chicago
curl "https://40percentmyth.com/api/businesses?city=Chicago&wordpress=Yes"

# All Shopify stores, any city
curl "https://40percentmyth.com/api/businesses?platform=Shopify"

# Overall stats
curl "https://40percentmyth.com/api/stats"
```

## Notes

- Data is collected by human-verified web research — not scraped automatically
- Platform detection uses direct site inspection (HTTP headers, source code, meta tags)
- The database is updated nightly with new cities and categories
- This API is read-only. Write operations are not supported.
- All data is free to use. Attribution appreciated but not required.

## About the Project

The 40% Myth investigates whether WordPress really powers 40% of the web.
Our on-the-ground research surveys real local businesses across dozens of US cities.
Spoiler: the real number is closer to 22%.

Learn more: https://40percentmyth.com
