# Playground

Run a call and see the same request as code. Signed-in calls use one of your keys and are charged like any other call.

Sign in with your relay.fast account to run live calls. When you are signed out, the panel shows a sample response.

curl:

```bash
curl https://api.websearch.fast/v1/web/search \
  -H "Authorization: Bearer $WEBSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "rust async runtime comparison", "num": 5}'
```

Python:

```python
import os
import httpx

response = httpx.post(
    "https://api.websearch.fast/v1/web/search",
    headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
    json={
        "q": "rust async runtime comparison",
        "num": 5,
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())
```

TypeScript:

```typescript
const response = await fetch("https://api.websearch.fast/v1/web/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    q: "rust async runtime comparison",
    num: 5,
  }),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
```

Sample response:

```json
{
  "object": "web.search",
  "request_id": "20261128120000123456789a1b2c3d4Kx7Qm2Pz",
  "created": 1795867200,
  "input": {
    "q": "rust async runtime comparison",
    "type": "web",
    "page": 1,
    "num": 3,
    "safe": "moderate",
    "operators": {},
    "content": {
      "pages": 1,
      "format": "markdown",
      "max_chars_per_page": 3000,
      "mode": "full"
    },
    "timeout_ms": 25000
  },
  "results": [
    {
      "position": 1,
      "title": "Choosing an async runtime in 2026",
      "url": "https://blog.example.com/posts/async-runtimes-2026",
      "domain": "blog.example.com",
      "snippet": "We benchmarked four runtimes on the same HTTP workload and compared scheduling, I/O and memory use.",
      "published_at": "2026-09-14T00:00:00Z",
      "origin": "index",
      "content": {
        "status": "ok",
        "format": "markdown",
        "chars": 3000,
        "truncated": true,
        "text": "# Choosing an async runtime in 2026\n\n...",
        "fetched_at": 1795860000
      }
    },
    {
      "position": 2,
      "title": "Async runtimes: a comparison of schedulers",
      "url": "https://docs.example.org/rust/async/runtimes",
      "domain": "docs.example.org",
      "snippet": "How work-stealing and thread-per-core runtimes differ, with notes on when each fits.",
      "published_at": "2026-06-02T00:00:00Z",
      "origin": "live"
    },
    {
      "position": 3,
      "title": "Moving a service between async runtimes",
      "url": "https://www.example.net/notes/runtime-migration",
      "domain": "www.example.net",
      "snippet": "What changed in our code when we moved a Rust service from one async runtime to another.",
      "published_at": "2026-03-21T00:00:00Z",
      "origin": "live"
    }
  ],
  "has_more": true,
  "usage": {
    "charged": true,
    "items": [
      {"unit": "search_web", "count": 1},
      {"unit": "content_page", "count": 1}
    ]
  },
  "cache": {"hit": false, "data_age_seconds": 0, "fetched_at": 1795867200}
}
```
