# Authentication

> Create an API key in the missed call portal and send it as a Bearer token.

Source: https://edesy.in/docs/missed-call/api-reference/authentication

## Create a key

1. Sign in at [missedcall.edesy.in](https://missedcall.edesy.in).
2. Open **API keys** and create a key.
3. Copy it and store it in a secret manager or environment variable. Keys start with `vp_`.

## Use it

Send the key in the `Authorization` header on every request:

```bash
curl https://voice-api.edesy.in/v1/missed-calls/summary \
  -H "Authorization: Bearer vp_your_api_key"
```

```js
const res = await fetch("https://voice-api.edesy.in/v1/missed-calls/summary", {
  headers: { Authorization: `Bearer ${process.env.EDESY_API_KEY}` },
});
const { data } = await res.json();
```

```python
import os, requests

r = requests.get(
    "https://voice-api.edesy.in/v1/missed-calls/summary",
    headers={"Authorization": f"Bearer {os.environ['EDESY_API_KEY']}"},
)
print(r.json()["data"])
```

A missing or wrong key returns `401`:

```json
{ "error": { "code": "unauthorized", "message": "Invalid or missing credentials" } }
```

Keep keys on your server. Never put them in a web page or mobile app. If a key leaks, delete it on the API keys page and create a new one.
