# Authentication

> How to send your Solvecha API key: the Authorization header, the key field of a body, or the key query parameter.

Every request needs your API key. You find it in the [dashboard](https://solvecha.com/dashboard). A key starts with `slv_` and has 36 characters.

## Ways to send the key

| Method | Where | Use it for |
|---|---|---|
| `Authorization: Bearer <key>` | Header | Every request. This is the best choice. |
| `Authorization: Basic <key>` | Header | Every request. The raw key is accepted. Standard Basic credentials work too: the key is the user name. |
| `key` field | JSON or form body | `POST` requests. |
| `?key=<key>` | Query string | `GET` requests, and clients that cannot set headers. |

The key is the same everywhere. If you send it in more than one place, the `key` field of the body is used first, then the query string, then the header.


**cURL**

```bash
curl "https://api.solvecha.com/v1/status" -H "Authorization: Bearer YOUR_API_KEY"
```

**Python**

```python
import requests

r = requests.get("https://api.solvecha.com/v1/status", headers={"Authorization": "Bearer YOUR_API_KEY"})
print(r.json())
```

**Node.js**

```js
const res = await fetch("https://api.solvecha.com/v1/status", {
  headers: { Authorization: "Bearer YOUR_API_KEY" },
});
console.log(await res.json());
```

**Go**

```go
req, _ := http.NewRequest("GET", "https://api.solvecha.com/v1/status", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, _ := http.DefaultClient.Do(req)
```


## Check your key

`GET /v1/status` shows the plan, the quota and the balance of your key and costs nothing. See [Get the status of your key](https://solvecha.com/docs/api/get-status.md).

## What happens with a wrong key

- A missing, malformed or unknown key gets error `15`, *Invalid key*, with HTTP status `401`.
- A key with nothing left (no plan quota, no free quota, no balance) can be used, but it cannot solve: it gets error `16`, *Out of credit*, with HTTP status `403`.
- Many requests with a wrong key from one address get error `11`, *Rate limit reached*. A valid key is never limited by its address.

## Keep the key safe


> **Warning:**
> Anyone with your key can use your quota. Send requests from your server. Do not publish the key in a repository or in a page that other people can open. The [browser extension](https://solvecha.com/docs/browser-extension.md) keeps the key in the extension storage only.


If a key leaks, click **Generate new key** in the [dashboard](https://solvecha.com/dashboard). The old key stops working at once.
