# Quickstart

You'll make a live Google search from your terminal in under a minute.

## 1. Get an API key

[Create a free account](https://serpwiz.com/signup), verify your email, then create a key under **Dashboard → API keys**. Keys look like `sw_live_…` and are shown once — store it somewhere safe, such as an environment variable:

```bash
export SERPWIZ_API_KEY="sw_live_your_key_here"
```

The free tier gives you 1,000 queries a month at 1 request per second. No card needed.

## 2. Make a request

### curl

```bash
curl "https://api.serpwiz.com/v1/google/search?q=coffee+near+seattle&gl=us&hl=en" \
  -H "X-API-Key: $SERPWIZ_API_KEY"
```

### Python

```python
import os, requests

r = requests.get(
    "https://api.serpwiz.com/v1/google/search",
    params={"q": "coffee near seattle", "gl": "us", "hl": "en"},
    headers={"X-API-Key": os.environ["SERPWIZ_API_KEY"]},
    timeout=60,
)
r.raise_for_status()
for item in r.json().get("results", []):
    print(item["position"], item["title"], item["url"])
```

### JavaScript (Node 18+)

```js
const url = new URL("https://api.serpwiz.com/v1/google/search");
url.search = new URLSearchParams({ q: "coffee near seattle", gl: "us", hl: "en" });

const res = await fetch(url, { headers: { "X-API-Key": process.env.SERPWIZ_API_KEY } });
if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
console.log(data.results?.map(r => r.title));
```

### PHP

```php
<?php
$query = http_build_query(['q' => 'coffee near seattle', 'gl' => 'us', 'hl' => 'en']);
$ch = curl_init("https://api.serpwiz.com/v1/google/search?$query");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 60,
    CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('SERPWIZ_API_KEY')],
]);
$data = json_decode(curl_exec($ch), true);
foreach ($data['results'] ?? [] as $r) echo $r['position'], ' ', $r['title'], "\n";
```

## 3. Read the response

A successful call returns `200` with the results as JSON, plus headers telling you what it cost:

```http
HTTP/1.1 200 OK
Content-Type: application/json
X-Credits-Charged: 1
X-Credits-Remaining: 999
X-RateLimit-Limit: 1
X-Request-Id: 9f2c1a7b3e4d5f60
```

```json
{
  "search_term": "coffee near seattle",
  "results": [
    { "position": 1, "title": "The 38 Essential Seattle Coffee Shops", "url": "https://…", "description": "…" }
  ],
  "ads": [],
  "top_stories": [],
  "knowledge_panel": { "name": "", "…": "…" },
  "related_keywords": { "spelling_suggestion": null, "keywords": [ { "position": 1, "keyword": "…" } ] },
  "next_page": 2,
  "next_start": 10
}
```

Searches take a few seconds — set your HTTP client timeout to at least 60 seconds.

## Next

- [Google Search parameters](/docs/google-search) — country, language, pagination, date filters.
- [Google Maps](/docs/google-maps) — places, ratings and reviews.
- [Errors](/docs/errors) and [Rate limits](/docs/rate-limits) — what to do with `4xx`/`5xx` and `429`.
