Webhook
Your business has one webhook. Every shared vehicle's telemetry is posted to it. You can set it on the Webhook page, or with these endpoints.
Setting the webhook
PUT /api/business/webhook sets the webhook, and replaces any webhook you had.
curl --request PUT --header "Authorization: Bearer {token}" --header 'Content-Type: application/json' \
--data '{"url":"https://fleetco.example/tesla/webhook","format":"teslemetry"}' \
'https://api.teslemetry.pro/api/business/webhook'
| Field | Required | Description |
|---|---|---|
url | Yes | Where each message is posted. Must be reachable from the internet. |
format | Yes | teslemetry, tesla or splunk. See Payloads. |
auth | No | Sent as the Authorization header with every message. Never returned. |
verify | No | Check the TLS certificate of url. Defaults to true. |
enabled | No | Deliver messages. Defaults to true. Send false to pause delivery without deleting the webhook. |
rotate_secret | No | Issue a new signing secret. Defaults to false. |
{
"response": {
"url": "https://fleetco.example/tesla/webhook",
"format": "teslemetry",
"auth": false,
"secret": "whsec_{base64 secret}",
"verify": true,
"enabled": true,
"updated_at": "2026-10-05T00:00:00.000Z"
}
}
auth in the response only says whether a header is set. secret is the signing secret. Only the PUT and PATCH responses include it.
A URL that is not reachable from the internet, such as localhost, a .local name or a private IP address, is refused with 400 invalid_webhook_url.
Updating the webhook
PATCH /api/business/webhook changes only the fields you send, and keeps every other field as it is, including the Authorization header. It takes the same fields as PUT, with none required and no defaults, but at least one must be sent. A changed url is checked as for PUT.
curl --request PATCH --header "Authorization: Bearer {token}" --header 'Content-Type: application/json' \
--data '{"rotate_secret":true}' \
'https://api.teslemetry.pro/api/business/webhook'
The response has the same shape as the PUT response, with secret. PATCH never creates a webhook: it returns 404 webhook_not_found when no webhook is set.
Reading and deleting
GET /api/business/webhookreturns the webhook in the same shape as above, but withoutsecret.DELETE /api/business/webhookdeletes it and returns{"response": true}.
Both return 404 webhook_not_found when no webhook is set.
Signing secret
Teslemetry signs webhook messages with a secret that belongs to your business. The secret starts with whsec_, followed by 32 random bytes in base64.
- The first
PUT /api/business/webhookcreates the secret and returns it assecret. - Later
PUTandPATCHrequests withoutrotate_secretkeep the same secret, so changing theurlorformatdoes not break your verification. GET /api/business/webhooknever returns the secret. Store it when you first receive it.- To issue a new secret, send
{"rotate_secret": true}withPATCH. The URL,authheader and other settings stay as they are, in the same atomic update.rotate_secretalso works withPUT, but aPUTreplaces the whole webhook, so it removesauthunless you send it again. The new secret is returned in the response. The old secret stops working at once, with no overlap, so update your receiver as soon as you rotate. - The MCP
set_webhooktool works likePUT: it takesrotate_secret, replaces the whole webhook, and returns the secret.
On the Webhook page in the portal, the secret is shown only right after you save the webhook or rotate the secret. It is never shown again, because the API does not return it on read. Admins can rotate it there. Rotating keeps the URL, the Authorization header and the other settings.
Verifying messages
Every signed message carries three headers, as defined by Standard Webhooks:
| Header | Description |
|---|---|
webhook-id | A unique ID for the message, like msg_{uuid}. A new ID is used for each delivery. |
webhook-timestamp | When the message was signed, in Unix seconds. |
webhook-signature | v1, followed by the base64 signature. |
The signature is the base64 HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}. The key is the secret after whsec_, decoded from base64.
To verify a message:
- Read the raw request body. Do not parse and re-serialise it, because that changes the bytes that were signed.
- Reject the message if
webhook-timestampis more than five minutes from the current time. This limits how long an attacker can replay a captured message. It does not stop a replay inside that window. - Calculate the signature, and compare it with
webhook-signaturein constant time. - Store each
webhook-idyou accept for at least ten minutes (the five-minute tolerance applies on both sides of the current time, so a message stays acceptable for up to ten minutes), and drop a repeat. Without this step, or idempotent handling of each message, a replay inside the window is accepted.
import { createHmac, timingSafeEqual } from "node:crypto";
const secret = process.env.TESLEMETRY_WEBHOOK_SECRET; // "whsec_..."
export function verify(headers, rawBody) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
const signature = headers["webhook-signature"];
if (!id || !timestamp || !signature) return false;
// Reject a timestamp more than five minutes from now.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`)
.digest("base64");
// `webhook-signature` may hold several space-separated `v1,` signatures.
return signature.split(" ").some((part) => {
const [version, value] = part.split(",");
if (version !== "v1" || !value) return false;
const a = Buffer.from(value);
const b = Buffer.from(expected);
return a.length === b.length && timingSafeEqual(a, b);
});
}
Teslemetry sends one v1 signature per message. Any Standard Webhooks library can verify the message too: give it the whole whsec_ secret.
The auth field is separate. If you set it, Teslemetry also sends it as the Authorization header. Use https:// so the header and data are encrypted.
Delivery
Each message is an HTTP POST with Content-Type: application/json, sent once. A message your server does not accept is not retried, so answer quickly with a 2xx and process the message afterwards.
Messages carry the vin of the vehicle they are about. Use it with your consented products to find the customer.
Topics
| Topic | Description |
|---|---|
| data | Telemetry data updates, for the fields in the vehicle's streaming config |
| state | Vehicle state changes (online, asleep, driving) |
| vehicle_data | Full vehicle data responses |
| alerts | Alert notifications |
| errors | Error events from the vehicle |
| connectivity | Connection status changes |
Payloads
A data message in each format:
{
"data": {
"Location": {
"latitude": 30.2226645,
"longitude": -97.6213806
},
"VehicleSpeed": "34.797"
},
"createdAt": "2026-10-05T04:58:44.983607402Z",
"vin": "5YJ3E1EA7KF000001"
}
{
"data": [
{
"key": "Location",
"value": {
"locationValue": {
"latitude": 30.2226645,
"longitude": -97.6213806
}
}
},
{
"key": "VehicleSpeed",
"value": {
"stringValue": "34.797"
}
}
],
"createdAt": "2026-10-05T04:58:44.983607402Z",
"vin": "5YJ3E1EA7KF000001"
}
{
"time": 1791176324.9836073,
"host": "na1.teslemetry.com",
"source": "5YJ3E1EA7KF000001",
"sourcetype": "tesla:telemetry:data",
"event": {
"Location": {
"latitude": 30.2226645,
"longitude": -97.6213806
},
"VehicleSpeed": "34.797"
}
}
In the Teslemetry format, alerts and errors messages are keyed by name. The Tesla format is Tesla's own message, unchanged. The Splunk format is a Splunk HTTP Event Collector event; an auth value without a scheme is sent as Splunk <auth>.