---
title: "REST and API keys - Clients | SnowAI"
description: "Call every SnowAI tool over HTTP with an API key: create a key, send it as a bearer token and read the cost of each call."
url: "https://trysnow.ai/docs/clients/rest"
---

# REST and API keys

> Scripts and servers call every tool over HTTP. Each key spends from your organization's wallet and can have its own monthly cap.

## Create a key

1. Open [API keys on the Connect page](https://trysnow.ai/dashboard/connect#keys) and create a key. Give it a name, and a monthly cap if you want one.
2. Copy it at once. It is shown only once.
3. Keep it in an environment variable, such as `SNOWAI_API_KEY`.

A key starts with `snow_live_`. It can call every tool and spend from the wallet, so treat it like a password. Revoke it on the same page and it stops working at once.

## Call a tool

Every tool is `POST https://api.trysnow.ai/tools/<name>`, with its arguments as the JSON body and the key as a bearer token.

**search_google: cURL**

```sh
curl -X POST https://api.trysnow.ai/tools/search_google \
  -H "Authorization: Bearer $SNOWAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "best crm for startups",
  "country": "us"
}'
```

**search_google: TypeScript**

```ts
const response = await fetch("https://api.trysnow.ai/tools/search_google", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SNOWAI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "query": "best crm for startups",
    "country": "us"
  }),
});
const result = await response.json();
```

**search_google: Python**

```python
import os
import requests

response = requests.post(
    "https://api.trysnow.ai/tools/search_google",
    headers={"Authorization": f"Bearer {os.environ['SNOWAI_API_KEY']}"},
    json={
        "query": "best crm for startups",
        "country": "us",
    },
)
print(response.json())
```

The answer has the tool's own fields, then `call_id`, `status`, `cost_credits`, `cost_usd` and the balance. [Tools](https://trysnow.ai/docs/tools) lists them.

## Good to know

- `GET https://api.trysnow.ai/tools` is public: every tool with its toolset, price, cache time, deadline and input schema.
- An OAuth access token works in place of a key.
- Retry safely: send an `Idempotency-Key` header and a retry answers with the first result instead of charging twice.
- A billed response carries `Snow-Cost-Credits` and `Snow-Balance-Credits` headers; every response carries `Snow-Call-Id` once a call exists.
- Browsers on other sites are refused by CORS. Call the API from a server.

[REST API](https://trysnow.ai/docs/reference/rest) lists the endpoints.

Every docs page as Markdown: https://trysnow.ai/llms.txt
