API

Search the source code of 129 million sites from your own code. You pay $0.05 a search against your account balance, with no subscription. Regex, boolean, and TLD filters all work, and nothing is locked behind a higher tier.

Start in a minute. Create a key on your account page (the API unlocks after your first top-up), then run a search:

curl -G "https://www.searchwebcode.com/api/v1/search" \
  -H "Authorization: Bearer $SWC_KEY" \
  --data-urlencode 'q="wp-content/plugins/woocommerce"'

Authentication

Send your key as a Bearer token on every request. Create and revoke keys on your account page. A key spends your balance, so keep it like a password. We store only a hash of it, so a lost key can't be recovered: revoke it and make a new one.

Authorization: Bearer swc_live_xxxxxxxxxxxxxxxxxxxxxxxx

Search

GETPOST /api/v1/search

Send parameters in the query string (GET) or a JSON body (POST, handy for long regex). One endpoint handles every kind of query.

Parameters

NameTypeDefaultNotes
qstringrequiredThe search. Boolean (OR, parentheses, "quoted phrases") is detected automatically. See the syntax guide.
regexboolfalseTreat q as a regular expression. Can't be combined with ignore_case.
ignore_caseboolfalseCase-insensitive substring match.
tldstringanyRestrict to a top-level domain, like com or io.
limitint100Results per page, 1 to 1000.
offsetint0Where to resume. Pass the next_offset from the last response.
counts_onlyboolfalseFree. Return the match count with no results, to size a query before you spend.

Response

{
  "query": "\"wp-content/plugins/woocommerce\"",
  "count_kind": "estimated",
  "total": 4185023,
  "estimated_matches": 4185023,
  "candidate_total": 4185023,
  "verified_hits": 96,
  "scan_capped": true,
  "next_offset": 512,
  "elapsed_ms": 231,
  "results": [
    {
      "domain": "example.com",
      "url": "https://example.com/",
      "tld": "com",
      "rank": 48210,
      "occurrences": 3,
      "snippet": { "text": "...href='/wp-content/plugins/woocommerce/...", "match_start": 8, "match_end": 38 }
    }
  ],
  "charged_cents": 5,
  "balance_cents": 1495
}

Reading the count

The engine verifies matches against real page source, so it tells you exactly how sure it is:

count_kindWhat total means
exactThe true number of matching sites.
estimatedA candidate count. Use estimated_matches, an ~N figure from a verified sample.
partialThe query is broad, so only verified_hits of the scanned window are confirmed. total is a candidate ceiling, not a match count. Page deeper to reach more.

Boolean queries also return a terms array with each arm's candidate count, which is the quickest way to spot the one term that made a query broad.

Pagination and export

Results arrive one page at a time. When a response includes next_offset, pass it back as offset for the next page. When next_offset is missing, you have reached the end. Set limit=1000 to move through a large export faster.

offset=0     ->  { ..., "next_offset": 1000 }
offset=1000  ->  { ..., "next_offset": 2000 }
offset=...   ->  { ... }              # no next_offset means done

Billing

Examples

Boolean: sites using ServiceTitan or Housecall Pro booking

curl -G "https://www.searchwebcode.com/api/v1/search" \
  -H "Authorization: Bearer $SWC_KEY" \
  --data-urlencode 'q="scheduler.servicetitan.com/book/" OR "book.housecallpro.com/book/"'

Regex: reverse Google Analytics lookup

curl -G "https://www.searchwebcode.com/api/v1/search" \
  -H "Authorization: Bearer $SWC_KEY" \
  --data-urlencode 'q=UA-\d{4,10}-\d' --data-urlencode 'regex=true'

Size a query free, then export it

# free: how big is it?
curl -G ".../api/v1/search" -H "Authorization: Bearer $SWC_KEY" \
  --data-urlencode 'q=.myshopify.com' --data-urlencode 'counts_only=true'

# then export it (one charge, page with next_offset)
curl -G ".../api/v1/search" -H "Authorization: Bearer $SWC_KEY" \
  --data-urlencode 'q=.myshopify.com' --data-urlencode 'limit=1000'

Errors

StatusMeaning
400Bad query: missing q, invalid regex, or regex with ignore_case. The message says which.
401Missing, invalid, or revoked key.
402Not enough balance. Top up.
429Too fast. Slow down and respect Retry-After.
502, 503Backend briefly unavailable. Retry.

A broad query that runs past the scan window is not an error. It returns 200 with count_kind:"partial" and a next_offset so you can keep going.

Create an API key