> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://teslemetry.crisp.help/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# API Authentication and Webhooks

This FAQ covers how to authenticate with the Teslemetry API and configure webhooks for receiving real-time data.

## Frequently Asked Questions

### How do I authenticate API requests to Teslemetry?

Teslemetry supports two methods for authenticating API requests:

**Method 1: Bearer Token (Recommended)**
```bash
curl --header "Authorization: Bearer {token}" 'https://api.teslemetry.com/api/1/vehicles/{vin}'
```

**Method 2: URL Parameter**
```
https://api.teslemetry.com/api/1/vehicles/{vin}?token={token}
```

Both methods are equally valid, but the Bearer token method is preferred for production applications as it keeps your token out of server logs.

### Where do I get an access token?

Access tokens are created in the Teslemetry console:

1. Go to the [Applications and API page](https://teslemetry.com/console/api)
2. Find the **Access Tokens** section
3. Click **Add Token** to create a new token

You can create up to 10 access tokens and remove them at any time.

### What is the API endpoint?

The base API endpoint is:
```
https://api.teslemetry.com/api/1/
```

Full API documentation is available at [api.teslemetry.com/docs](https://api.teslemetry.com/docs).

### Why does my webhook keep getting disabled?

A daily health check disables a webhook only after a **continuous 7-day streak of failed deliveries** (non-2xx responses). Any successful delivery clears the streak and keeps the webhook enabled. This prevents Teslemetry from indefinitely sending data to an unresponsive endpoint.

**To prevent webhook disabling:**
* Ensure your server returns HTTP 200-299 for successful deliveries
* Implement proper error handling to avoid 5xx responses
* Monitor your webhook endpoint's health

### What events can I receive via webhooks/streaming?

**Webhook events:**

| Event Type | Description |
| ---- |
| `data` | Telemetry data updates (battery, speed, location, etc.) |
| `state` | Vehicle state changes (online, asleep, driving) |
| `vehicle_data` | Full vehicle data responses |
| `alerts` | Alert notifications (sentry mode, etc.) |
| `errors` | Error events from the vehicle |
| `connectivity` | Vehicle connectivity changes |

**SSE (streaming) only:** in addition to the events above, SSE streams also deliver account-level `credits` events (API credit usage updates). Credits events are not deliverable via webhooks.

---

## SDKs Available

**Python SDK**
* [PyPI Package](https://pypi.org/project/tesla-fleet-api/)
* [GitHub Repository](https://github.com/Teslemetry/python-tesla-fleet-api)

**TypeScript/JavaScript SDK**
* [NPM Package](https://www.npmjs.com/package/tesla-fleet-api)
* [GitHub Repository](https://github.com/Teslemetry/node-tesla-fleet-api)

---

## Related Documentation

* [API Documentation](https://api.teslemetry.com/docs)
* [Console Guide](https://teslemetry.com/docs/getting-started/console)
* [Access Tokens](https://teslemetry.com/docs/getting-started/console#access-tokens)