> ## Documentation Index
> Fetch the complete documentation index at: https://docs.technicallyfit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Get told when something changes: register an endpoint, verify the signature, and handle retries.

A webhook is an HTTPS `POST` TechnicallyFit sends to your server when something changes,
so you do not have to poll. You register an endpoint, choose the events it receives, and
verify each delivery with a signature.

```bash curl theme={null}
curl -X POST "$TF_API_BASE/v1/webhook-endpoints" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/technicallyfit",
    "events": ["program.revised", "teammate.disconnected"],
    "description": "Scheduling service"
  }'
```

```typescript TypeScript theme={null}
import { createClient } from '@technicallyfit/sdk';

const tf = createClient({ credential: process.env.TF_API_KEY ?? '', baseUrl: process.env.TF_API_BASE });

const endpoint = await tf.POST('/v1/webhook-endpoints', {
  body: {
    url: 'https://example.com/hooks/technicallyfit',
    events: ['program.revised', 'teammate.disconnected'],
    description: 'Scheduling service',
  },
});
// Shown once: store it in your secret store now.
console.log(endpoint.id, endpoint.secret);
```

```python Python theme={null}
import os

from technicallyfit import Client

tf = Client(os.environ["TF_API_KEY"], base_url=os.environ.get("TF_API_BASE"))

endpoint = tf.create_webhook_endpoint({
    "url": "https://example.com/hooks/technicallyfit",
    "events": ["program.revised", "teammate.disconnected"],
    "description": "Scheduling service",
})
# Shown once: store it in your secret store now.
print(endpoint["id"], endpoint["secret"])
```

```json 201 theme={null}
{
  "id": "0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11",
  "url": "https://example.com/hooks/technicallyfit",
  "description": "Scheduling service",
  "events": ["program.revised", "teammate.disconnected"],
  "status": "active",
  "mode": "test",
  "disabled_reason": null,
  "previous_secret_expires_at": null,
  "created_at": "2026-11-20T00:00:00.000Z",
  "updated_at": "2026-11-20T00:00:00.000Z",
  "secret": "whsec_..."
}
```

## Register an endpoint

Create an endpoint with a key that holds `webhooks:write`. The URL must start with
`https://` and its host must resolve to a public address. A host that resolves to a private
or internal address is refused, at registration and again before every delivery.

```bash curl theme={null}
curl -X POST "$TF_API_BASE/v1/webhook-endpoints" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/hooks/technicallyfit",
    "events": ["program.revised", "teammate.disconnected"],
    "description": "Scheduling service"
  }'
```

```typescript TypeScript theme={null}
import { createClient } from '@technicallyfit/sdk';

const tf = createClient({ credential: process.env.TF_API_KEY ?? '', baseUrl: process.env.TF_API_BASE });

const endpoint = await tf.POST('/v1/webhook-endpoints', {
  body: {
    url: 'https://example.com/hooks/technicallyfit',
    events: ['program.revised', 'teammate.disconnected'],
    description: 'Scheduling service',
  },
});
// Shown once: store it in your secret store now.
console.log(endpoint.id, endpoint.secret);
```

```python Python theme={null}
import os

from technicallyfit import Client

tf = Client(os.environ["TF_API_KEY"], base_url=os.environ.get("TF_API_BASE"))

endpoint = tf.create_webhook_endpoint({
    "url": "https://example.com/hooks/technicallyfit",
    "events": ["program.revised", "teammate.disconnected"],
    "description": "Scheduling service",
})
# Shown once: store it in your secret store now.
print(endpoint["id"], endpoint["secret"])
```

The answer carries the endpoint and its signing secret:

```json 201 theme={null}
{
  "id": "0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11",
  "url": "https://example.com/hooks/technicallyfit",
  "description": "Scheduling service",
  "events": ["program.revised", "teammate.disconnected"],
  "status": "active",
  "mode": "test",
  "disabled_reason": null,
  "previous_secret_expires_at": null,
  "created_at": "2026-11-20T00:00:00.000Z",
  "updated_at": "2026-11-20T00:00:00.000Z",
  "secret": "whsec_..."
}
```

**The secret is shown once.** Store it right away. No later read returns it; if you lose
it, rotate it.

An endpoint belongs to the mode of the key that created it. A test endpoint receives only
test events and a live endpoint only live events. You can hold up to 20 endpoints per mode.

| Call | Scope | What it does |
| - | - | - |
| `POST /v1/webhook-endpoints` | `webhooks:write` | Create an endpoint. Returns the secret once. |
| `GET /v1/webhook-endpoints` | `webhooks:read` | List your endpoints. |
| `GET /v1/webhook-endpoints/{id}` | `webhooks:read` | Read one endpoint. |
| `PATCH /v1/webhook-endpoints/{id}` | `webhooks:write` | Change the URL, the events, the description or the status. |
| `DELETE /v1/webhook-endpoints/{id}` | `webhooks:write` | Delete the endpoint and its delivery log. |
| `POST /v1/webhook-endpoints/{id}/rotate-secret` | `webhooks:write` | Issue a new secret. Returns it once. |
| `GET /v1/webhook-endpoints/{id}/deliveries` | `webhooks:read` | Read the delivery log. |

To pause an endpoint, set `"status": "paused"`. To resume, set `"status": "active"`. Events
that happen while an endpoint is paused are not sent later.

```bash curl theme={null}
curl -X PATCH "$TF_API_BASE/v1/webhook-endpoints/0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "paused"}'
```

```typescript TypeScript theme={null}
import { createClient } from '@technicallyfit/sdk';

const tf = createClient({ credential: process.env.TF_API_KEY ?? '', baseUrl: process.env.TF_API_BASE });

const endpoint = await tf.PATCH('/v1/webhook-endpoints/{id}', {
  params: { path: { id: '0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11' } },
  body: { status: 'paused' },
});
console.log(endpoint.status);
```

```python Python theme={null}
import os

from technicallyfit import Client

tf = Client(os.environ["TF_API_KEY"], base_url=os.environ.get("TF_API_BASE"))

endpoint = tf.update_webhook_endpoint("0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11", {"status": "paused"})
print(endpoint["status"])
```

## What a delivery looks like

Every delivery is a `POST` with a JSON body and three headers:

```
TF-Webhook-Id:        6f1c0a52-3c1e-4c7a-9d53-0a8a5f0f4b11
TF-Webhook-Timestamp: 1795132800
TF-Webhook-Signature: v1=9676b153d96d4c624f1927a4ccc6019c4ec44647284d0fb3a91f2855692c1731
```

The body is the same envelope for every event:

```json teammate.disconnected theme={null}
{
  "id": "6f1c0a52-3c1e-4c7a-9d53-0a8a5f0f4b11",
  "type": "teammate.disconnected",
  "created_at": "2026-11-20T00:00:00.000Z",
  "mode": "test",
  "data": {
    "teammate": "member-1",
    "disconnected_at": "2026-11-20T00:00:00.000Z"
  }
}
```

* `id` is the event id. It equals `TF-Webhook-Id` and stays the same on every retry.
* `type` is the event type, and `data` is that event's payload (see [Events](#events)).
* `mode` is `test` or `live`.
* In every payload, `teammate` is your own id for the teammate, the `external_id` you chose.

Answer with any `2xx` status within ten seconds. Do your own work after you answer, not
before. Redirects are not followed: a `3xx` answer counts as a failure.

## Verify the signature

Verify every delivery before you trust it. This is one delivery from start to end; the
steps below say exactly how to check it.

```mermaid theme={null}
sequenceDiagram
  participant TF as TechnicallyFit
  participant You as Your endpoint
  Note over TF: Checks consent and that<br/>your host is public
  TF->>TF: HMAC-SHA256 of timestamp.body<br/>keyed with your secret
  TF->>You: POST with TF-Webhook-Id,<br/>TF-Webhook-Timestamp, TF-Webhook-Signature
  You->>You: Same HMAC over the<br/>raw body as it arrived
  You->>You: Compare with each v1<br/>value in constant time
  You->>You: Timestamp within five<br/>minutes of your clock?
  alt A signature matches, timestamp fresh
    You-->>TF: 2xx within ten seconds
    Note over You: Skip an id you already<br/>handled, then do the work
  else Check fails, or no 2xx in ten seconds
    You-->>TF: Any other answer, or none
    TF->>You: Retried later with the same<br/>TF-Webhook-Id, up to seven more times
  end
```

1. Take the raw request body exactly as it arrived, before any JSON parsing.
2. Build the signed text: the `TF-Webhook-Timestamp` value, a dot, then the raw body.
3. Compute HMAC-SHA256 of that text, keyed with your endpoint secret (the whole `whsec_...`
   text), and write it as lower-case hex.
4. Compare it, in constant time, with each `v1=` value in `TF-Webhook-Signature`. One match
   is enough.
5. Reject the delivery if the timestamp is more than five minutes from your own clock. That
   stops someone from replaying an old delivery.

### A worked example

With this secret:

```
whsec_c3ludGhldGljLXdlYmhvb2stc2lnbmluZy1zZWNyZXQtMDE
```

this timestamp:

```
1795132800
```

and this raw body (one line, no spaces between fields):

```
{"id":"6f1c0a52-3c1e-4c7a-9d53-0a8a5f0f4b11","type":"teammate.disconnected","created_at":"2026-11-20T00:00:00.000Z","mode":"test","data":{"teammate":"member-1","disconnected_at":"2026-11-20T00:00:00.000Z"}}
```

the signed text is `1795132800.` followed by the body, and the signature header is:

```
TF-Webhook-Signature: v1=9676b153d96d4c624f1927a4ccc6019c4ec44647284d0fb3a91f2855692c1731
```

The [SDKs](https://docs.technicallyfit.com/sdks/webhook-verification.md) do this check for you:

```typescript TypeScript theme={null}
import { WebhookVerificationError, verifyWebhook } from '@technicallyfit/sdk/webhooks';

export async function handleWebhook(request: Request): Promise<Response> {
  try {
    const delivery = await verifyWebhook({
      rawBody: await request.text(),
      headers: request.headers,
      secrets: process.env.TF_WEBHOOK_SECRET ?? '',
    });
    console.log(delivery.id, delivery.type);
    return new Response(null, { status: 204 });
  } catch (error) {
    if (error instanceof WebhookVerificationError) return new Response(null, { status: 400 });
    throw error;
  }
}
```

```python Python theme={null}
import os

from technicallyfit import WebhookVerificationError, verify_webhook


def handle_webhook(raw_body: bytes, headers: dict[str, str]) -> int:
    try:
        delivery = verify_webhook(raw_body, headers, os.environ["TF_WEBHOOK_SECRET"])
    except WebhookVerificationError as error:
        print("refused:", error.reason)
        return 400
    print(delivery["id"], delivery["type"])
    return 204
```

Without an SDK:

```javascript Node.js theme={null}
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody, headers, secret, toleranceSeconds = 300) {
  const timestamp = headers["tf-webhook-timestamp"];
  const signatures = headers["tf-webhook-signature"] ?? "";
  if (!/^\d+$/.test(timestamp ?? "")) return false;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > toleranceSeconds) return false;
  const expected = createHmac("sha256", secret)
    .update(`${timestamp}.${rawBody}`)
    .digest();
  return signatures.split(",").some((part) => {
    const [version, value] = part.trim().split("=");
    if (version !== "v1" || !/^[0-9a-f]{64}$/.test(value ?? "")) return false;
    return timingSafeEqual(Buffer.from(value, "hex"), expected);
  });
}
```

```python Python theme={null}
import hashlib
import hmac
import time


def verify(raw_body: bytes, headers: dict, secret: str, tolerance_seconds: int = 300) -> bool:
    timestamp = headers.get("tf-webhook-timestamp", "")
    signatures = headers.get("tf-webhook-signature", "")
    if not timestamp.isdigit():
        return False
    if abs(time.time() - int(timestamp)) > tolerance_seconds:
        return False
    signed = timestamp.encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    for part in signatures.split(","):
        version, _, value = part.strip().partition("=")
        if version == "v1" and hmac.compare_digest(value, expected):
            return True
    return False
```

A changed body, a wrong secret and a stale timestamp each fail this check. The SDK includes
the same check, tested against the same sample deliveries.

## Rotate the secret

`POST /v1/webhook-endpoints/{id}/rotate-secret` issues a new secret and returns it once:

```bash curl theme={null}
curl -X POST "$TF_API_BASE/v1/webhook-endpoints/0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11/rotate-secret" \
  -H "X-API-Key: $TF_API_KEY"
```

```typescript TypeScript theme={null}
import { createClient } from '@technicallyfit/sdk';

const tf = createClient({ credential: process.env.TF_API_KEY ?? '', baseUrl: process.env.TF_API_BASE });

const rotated = await tf.POST('/v1/webhook-endpoints/{id}/rotate-secret', {
  params: { path: { id: '0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11' } },
});
console.log(rotated.secret, rotated.previous_secret_expires_at);
```

```python Python theme={null}
import os

from technicallyfit import Client

tf = Client(os.environ["TF_API_KEY"], base_url=os.environ.get("TF_API_BASE"))

rotated = tf.rotate_webhook_endpoint_secret("0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11")
print(rotated["secret"], rotated["previous_secret_expires_at"])
```

```json 200 theme={null}
{
  "secret": "whsec_...",
  "previous_secret_expires_at": "2026-11-21T00:00:00.000Z"
}
```

For the next 24 hours every delivery carries two signatures, the new secret first:

```
TF-Webhook-Signature: v1=<signed with the new secret>,v1=<signed with the previous secret>
```

A receiver that still holds the previous secret keeps verifying, so you can deploy the new
secret without missing a delivery. After `previous_secret_expires_at` only the new secret
signs.

## Retries

A delivery fails when your server answers with anything but a `2xx`, does not answer within
ten seconds, or cannot be reached. A failed delivery is retried up to seven more times,
with a longer wait each time:

| After failed attempt | Next attempt in about |
| - | - |
| 1 | 1 minute |
| 2 | 5 minutes |
| 3 | 15 minutes |
| 4 | 1 hour |
| 5 | 2 hours |
| 6 | 6 hours |
| 7 | 12 hours |

Each wait is shortened by a small random amount. After the eighth attempt, about 21 hours
after the first, the delivery is marked `failed` and is not sent again.

* **Concurrency caps.** At most two deliveries are in flight to one endpoint at a time,
  and at most four across all endpoints of your organization in one mode. Extra deliveries
  wait briefly in the queue without using an attempt, so one slow endpoint does not delay
  other endpoints.
* **Pausing a failing endpoint.** After three failed attempts in a row, deliveries to that
  endpoint pause for 30 seconds without using attempts. When the pause ends, one delivery
  probes your server: a `2xx` ends the pause immediately, and another failure doubles the
  pause up to 15 minutes.
* **At least once.** The same event can arrive more than once. Keep the `TF-Webhook-Id`
  values you have handled and skip one you have seen.
* **No order.** Events can arrive out of order. Use the times and revision numbers in the
  payload, not the arrival order.
* **Read for detail.** A payload carries ids and conclusions. When you need more, call the
  matching read endpoint, which checks consent again.

If an endpoint gets no `2xx` answer for five days, it is switched to `disabled` when a
delivery next runs out of attempts, with `disabled_reason` set to `delivery_failures`.
Deliveries still waiting for it are dropped. Fix your server, then set `"status": "active"`
to turn the endpoint back on.

## The delivery log

`GET /v1/webhook-endpoints/{id}/deliveries` lists the deliveries of the last 30 days,
newest first, with every attempt. Filter with `status`, page with `limit` and `cursor`.

```bash curl theme={null}
curl "$TF_API_BASE/v1/webhook-endpoints/0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11/deliveries?status=delivered&limit=20" \
  -H "X-API-Key: $TF_API_KEY"
```

```typescript TypeScript theme={null}
import { createClient } from '@technicallyfit/sdk';

const tf = createClient({ credential: process.env.TF_API_KEY ?? '', baseUrl: process.env.TF_API_BASE });

for await (const delivery of tf.paginate('/v1/webhook-endpoints/{id}/deliveries', {
  params: { path: { id: '0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11' }, query: { status: 'delivered', limit: 20 } },
})) {
  console.log(delivery.type, delivery.status, delivery.attempts);
}
```

```python Python theme={null}
import os

from technicallyfit import Client

tf = Client(os.environ["TF_API_KEY"], base_url=os.environ.get("TF_API_BASE"))

for delivery in tf.paginate(tf.list_webhook_deliveries, id="0b77d1e9-5a0e-4f0b-9c1d-2f6f6f0a7c11", status="delivered", limit=20):
    print(delivery["type"], delivery["status"], delivery["attempts"])
```

```json 200 theme={null}
{
  "data": [
    {
      "id": "c2a4b1de-0d0a-4a52-8f3b-6f2b9a1c7e21",
      "event_id": "6f1c0a52-3c1e-4c7a-9d53-0a8a5f0f4b11",
      "type": "teammate.disconnected",
      "status": "delivered",
      "attempts": 2,
      "last_status_code": 200,
      "last_response_ms": 84,
      "last_error": null,
      "drop_reason": null,
      "next_attempt_at": null,
      "delivered_at": "2026-11-20T00:01:01.000Z",
      "created_at": "2026-11-20T00:00:00.000Z",
      "attempt_log": [
        {
          "attempt": 1,
          "status_code": 500,
          "response_ms": 120,
          "error": "unexpected_status",
          "attempted_at": "2026-11-20T00:00:01.000Z"
        },
        {
          "attempt": 2,
          "status_code": 200,
          "response_ms": 84,
          "error": null,
          "attempted_at": "2026-11-20T00:01:01.000Z"
        }
      ]
    }
  ],
  "next_cursor": null
}
```

| `status` | Meaning |
| - | - |
| `pending` | Waiting for its first attempt or its next retry (`next_attempt_at`). |
| `delivered` | Your server answered `2xx`. |
| `failed` | Every attempt failed. |
| `dropped` | Not sent, for the reason in `drop_reason`. |

| `error` | Meaning |
| - | - |
| `unexpected_status` | Your server answered, but not with a `2xx`. |
| `timeout` | No answer within ten seconds. |
| `connection_failed` | The connection could not be made or broke. |
| `host_not_found` | The host name did not resolve. |
| `address_not_public` | The host resolved to a private or internal address. |

| `drop_reason` | Meaning |
| - | - |
| `consent_revoked` | The teammate withdrew the consent item the event needs before it was sent. |
| `endpoint_inactive` | The endpoint was paused or disabled before it was sent. |

The log never holds the payload or your server's answer body.

## Consent

An event about a teammate needs a consent item, the same one as the matching read (for
example `programs`, `body_state`, `events` or `record`). Consent is checked when the
event happens and again immediately before every attempt, retries included. If the
teammate withdraws the item in between, the delivery is dropped. See
[Teammates and ownership](https://docs.technicallyfit.com/guides/teammates-and-ownership.md#webhooks-and-consent).

Events for a placeholder nobody claimed are delivered, because they describe only what you
sent.

## Events

Each section shows the `data` of one event type and the consent item it needs. A payload
never has a field that is not listed here. For measurement and attestation lifecycle
rules, see [Verified records](https://docs.technicallyfit.com/guides/verified-records.md).

### program.revised

A teammate's program has a new revision, whether it applied automatically or a coach
approved it. Consent item: `programs`.

```json program.revised theme={null}
{
  "teammate": "member-1",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "revision": 3,
  "parent_revision": 2,
  "cause": { "kind": "schedule_change", "summary": "The teammate changed training days." },
  "approval": { "mode": "automatic" },
  "engine_version": "ab5787734209",
  "applied_at": "2026-11-20T00:00:00.000Z"
}
```

`approval.mode` is `automatic` or `coach`. `parent_revision` is `null` for a first revision.

A program your organization created arrives as `program.revised` with `revision` 1, a `null`
`parent_revision` and the cause kind `created`, when it starts: at once for a teammate with no
coach, or with `approval.mode` `coach` once their coach accepts it. A program that is saved and
not started sends no event; read its job instead.

### session.changed

An applied revision changed today's session or the next planned one. Consent item:
`programs`.

```json session.changed theme={null}
{
  "teammate": "member-1",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "revision": 3,
  "date": "2026-11-21",
  "week_number": 2,
  "day_index": 4,
  "change": "updated",
  "summary": "Friday is now a lighter session."
}
```

`change` is `updated`, `added` or `removed`. `day_index` counts from 0 for Monday.

### proposal.created

A change is waiting for a coach to approve it. Consent item: `programs`.

```json proposal.created theme={null}
{
  "teammate": "member-1",
  "proposal_id": "9c1d2f6f-6f0a-4c11-8f0b-5a0e0b77d1e9",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "cause": { "kind": "schedule_change", "summary": "The teammate changed training days." },
  "summary": "Move two sessions to fit the new training days.",
  "created_at": "2026-11-20T00:00:00.000Z"
}
```

### feasibility.warning

A target is unlikely to be reached as the program stands. Consent item: `programs`.

```json feasibility.warning theme={null}
{
  "teammate": "member-1",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "revision": 3,
  "target": { "quantity": "set_load", "unit": "kg" },
  "warning": "The target date is too close for this goal."
}
```

### event.rejected

An event you sent was rejected. Consent item: `events`. The payload names the rejected
event and the reason, and never repeats the values you sent.

```json event.rejected theme={null}
{
  "event_id": "c2a4b1de-0d0a-4a52-8f3b-6f2b9a1c7e21",
  "teammate": "member-1",
  "type": "observation",
  "reason": { "code": "unit_not_convertible", "message": "The unit cannot be converted." }
}
```

The response to the request that sent the event carries the same rejection, whatever the
teammate's consent.

### teammate.claimed

A person claimed the placeholder you created. Consent item: none; always delivered.

```json teammate.claimed theme={null}
{ "teammate": "member-1", "claimed_at": "2026-11-20T00:00:00.000Z" }
```

### teammate.disconnected

A teammate is no longer connected to your organization: they left it, or they deleted their
TechnicallyFit account. Both send the same payload, so you cannot tell which. Consent item:
none; always delivered. It carries your id for the teammate and a time, and nothing else.

```json teammate.disconnected theme={null}
{ "teammate": "member-1", "disconnected_at": "2026-11-20T00:00:00.000Z" }
```

When it arrives, stop sending data for that `external_id` (your key gets `404` for it from
now on) and apply your own retention rules to your copy of the teammate's data. Deleting a
placeholder yourself with `DELETE /v1/teammates/{external_id}` sends no webhook.

### location.inventory\_changed

The equipment of one of your locations changed: what it has today gained or lost at least
one item. Consent item: none; it is about your own location and carries no teammate data.
One event is sent per location, so a baseline change sends one for each location it reaches.

```json location.inventory_changed theme={null}
{
  "location": { "external_id": "downtown" },
  "inventory_revision": 8,
  "cause": "out_of_service",
  "added": [],
  "removed": ["leg_press"],
  "teammates_affected": 42,
  "changed_at": "2026-11-20T00:00:00.000Z"
}
```

| Field | What it holds |
| - | - |
| `inventory_revision` | The location's revision after the change. |
| `cause` | `baseline_changed`, `override_changed`, `out_of_service`, `back_in_service`, `location_changed`, `location_archived` or `sync`. |
| `added`, `removed` | The equipment tokens the location gained and lost. |
| `teammates_affected` | How many current teammates are homed at the location. A count, never a list of people. Their plans are asked to change (see [Locations and equipment](https://docs.technicallyfit.com/guides/locations-and-equipment.md#when-a-locations-equipment-changes)); the event is sent whether or not re-planning is switched on. |

A change to a count, an attribute or a note sends nothing.

### teammate.at\_risk

A teammate may be about to stop training. Consent item: `at_risk`. It carries the teammate
id, reason codes and a time, and nothing else.

```json teammate.at_risk theme={null}
{
  "teammate": "member-1",
  "reasons": ["sessions_missed"],
  "opened_at": "2026-11-20T00:00:00.000Z"
}
```

Reason codes are `visits_dropped` and `sessions_missed` (`progress_stalled` is reserved). More
may be added, so handle one you do not know. It is sent once, when the daily check opens a flag;
see [At-risk teammates](https://docs.technicallyfit.com/guides/at-risk-teammates.md).

### workout.logged

A teammate finished a workout in the TechnicallyFit app. Consent item: `programs`. Published once
per completed workout; retrying a finish sends no second event, and sets your organization sends
through the events API do not trigger it. The payload carries ids and the finish time only, never
sets, loads or effort.

```json workout.logged theme={null}
{
  "teammate": "member-1",
  "workout_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e:w2:d1",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "finished_at": "2026-11-20T00:00:00.000Z"
}
```

`program_id` is `null` when the workout does not belong to a program.

### body\_state.changed

A body-state update stored a new snapshot whose joint state changed from the previous one. Consent
item: `body_state`. The payload carries the teammate id and when it was computed, never a number;
read `GET /v1/teammates/{external_id}/body-state` for the joint values.

```json body_state.changed theme={null}
{
  "teammate": "member-1",
  "computed_at": "2026-11-20T00:00:00.000Z"
}
```

### session.adapted

Live adaptation adjusted the remaining sets of an in-progress session after a trigger fired.
Consent item: `programs`. Published inside the adaptation write's transaction. The payload carries
ids, the trigger code, a plain summary and the timestamp only, never set values or engine internals.

```json session.adapted theme={null}
{
  "teammate": "member-1",
  "adaptation_id": "8e4a2b31-5a0e-4f0b-9c1d-2f6f6f0a7c11",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "trigger": "high_effort_streak",
  "summary": "Lowered remaining squat load after two high-effort sets.",
  "adapted_at": "2026-11-27T18:12:00.000Z"
}
```

### adaptation.vetoed

A teammate (or their coach on their behalf) vetoed a live adaptation change, restoring the earlier
prescription on sets not yet done and silencing that trigger for the rest of the session. Consent
item: `programs`. Published once when the veto is recorded; retrying a veto sends no second event.

```json adaptation.vetoed theme={null}
{
  "teammate": "member-1",
  "adaptation_id": "8e4a2b31-5a0e-4f0b-9c1d-2f6f6f0a7c11",
  "program_id": "4d2f6f0a-7c11-4f0b-9c1d-0b77d1e95a0e",
  "trigger": "high_effort_streak",
  "vetoed_by_role": "teammate",
  "vetoed_at": "2026-11-27T18:13:00.000Z"
}
```

### measurement.recorded

A new measurement was stored in a teammate's performance record. Consent item: `record`. The
payload carries ids, quantity, protocol, vouching level and time only, never a numeric value or
name. Sensitive health measures never publish an event.

```json measurement.recorded theme={null}
{
  "teammate": "member-1",
  "measurement_id": "00000000-0000-4000-8000-0000000000b1",
  "quantity": "jump_height",
  "protocol_kind": "registered",
  "protocol_key": "vertical_jump",
  "vouching_level": 2,
  "recorded_at": "2026-11-27T12:00:00.000Z"
}
```

### measurement.corrected

An active measurement was replaced with a corrected row. Consent item: `record`. `supersedes_id`
names the replaced measurement.

```json measurement.corrected theme={null}
{
  "teammate": "member-1",
  "measurement_id": "00000000-0000-4000-8000-0000000000b2",
  "supersedes_id": "00000000-0000-4000-8000-0000000000b1",
  "quantity": "jump_height",
  "protocol_kind": "registered",
  "protocol_key": "vertical_jump",
  "vouching_level": 2,
  "corrected_at": "2026-11-27T12:05:00.000Z"
}
```

### measurement.withdrawn

A measurement was withdrawn from the teammate's active record. Consent item: `record`. Account
erasure sends `teammate.disconnected` instead of one event per result.

```json measurement.withdrawn theme={null}
{
  "teammate": "member-1",
  "measurement_id": "00000000-0000-4000-8000-0000000000b2",
  "quantity": "jump_height",
  "protocol_kind": "registered",
  "protocol_key": "vertical_jump",
  "vouching_level": 2,
  "withdrawn_at": "2026-11-27T12:10:00.000Z"
}
```

### attestation.created

A coach witnessed (level 3) or an approved organization certified (level 4) a measurement. Consent
item: `record`. The payload carries the attestation id and vouching level, never the signed
statement or numeric value.

```json attestation.created theme={null}
{
  "teammate": "member-1",
  "attestation_id": "00000000-0000-4000-8000-0000000000c1",
  "measurement_id": "00000000-0000-4000-8000-0000000000b1",
  "quantity": "jump_height",
  "protocol_kind": "registered",
  "protocol_key": "vertical_jump",
  "vouching_level": 4,
  "issued_at": "2026-11-27T12:01:00.000Z"
}
```

### attestation.revoked

A coach or organization revoked a previously issued attestation. Consent item: `record`.
`vouching_level` shows the measurement's level after revocation.

```json attestation.revoked theme={null}
{
  "teammate": "member-1",
  "attestation_id": "00000000-0000-4000-8000-0000000000c1",
  "measurement_id": "00000000-0000-4000-8000-0000000000b1",
  "quantity": "jump_height",
  "protocol_kind": "registered",
  "protocol_key": "vertical_jump",
  "vouching_level": 1,
  "revoked_at": "2026-11-27T12:15:00.000Z"
}
```

### webhook.test

A test delivery you sent from the developer portal
([app.technicallyfit.com/developer](https://app.technicallyfit.com/developer), **Webhooks**,
**Send test**). It goes only to the endpoint you chose, whatever events it subscribed to,
and is signed and logged like any other delivery. You cannot subscribe to it. Consent item:
none; it carries no teammate data.

```json webhook.test theme={null}
{ "endpoint_id": "7b7f1c1e-5d0a-4d1c-9a52-3f6d8f1c2e10", "sent_at": "2026-11-20T00:00:00.000Z" }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.