> ## 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.

# Visit check-ins

> Record a teammate's visit to one of your locations.

A visit check-in records that a teammate came to one of your locations, and when. Send one
from your own app or door system as a `visit_check_in` event. A teammate who uses the
TechnicallyFit app can also check in by scanning the location's code.

```bash curl theme={null}
curl -X POST "$TF_API_BASE/v1/teammates/member-1042/events" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "type": "visit_check_in",
        "idempotency_key": "door-7f3a9c",
        "at": "2026-11-18T07:02:11Z",
        "data": { "location": "club-014" }
      }
    ]
  }'
```

```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 answer = await tf.POST('/v1/teammates/{external_id}/events', {
  params: { path: { external_id: 'member-1042' } },
  body: {
    events: [
      {
        type: 'visit_check_in',
        idempotency_key: 'door-7f3a9c',
        at: '2026-11-18T07:02:11Z',
        data: { location: 'club-014' },
      },
    ],
  },
});
console.log(answer.results[0]?.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"))

answer = tf.send_teammate_events("member-1042", {
    "events": [
        {
            "type": "visit_check_in",
            "idempotency_key": "door-7f3a9c",
            "at": "2026-11-18T07:02:11Z",
            "data": {"location": "club-014"}
        }
    ]
})
print(answer["results"][0]["status"])
```

```json 200 theme={null}
{
  "results": [
    {
      "index": 0,
      "status": "accepted",
      "event_id": "5d0b7e4a-2c19-4f6e-9a83-1e7c4b2d9f60",
      "type": "visit_check_in"
    }
  ],
  "summary": {
    "accepted": 1,
    "duplicate": 0,
    "rejected": 0
  }
}
```

## Send a check-in

Send the event to `POST /v1/teammates/{external_id}/events`, or for many teammates at once to
`POST /v1/events:bulk`. Your key needs `events:write`. The body for one teammate:

```json Request theme={null}
{
  "events": [
    {
      "type": "visit_check_in",
      "idempotency_key": "door-7f3a9c",
      "at": "2026-11-18T07:02:11Z",
      "data": { "location": "club-014" }
    }
  ]
}
```

* `location` is the `external_id` of one of your locations. See
  [Locations and equipment](https://docs.technicallyfit.com/guides/locations-and-equipment.md).
* `at` is when the teammate arrived, as an RFC 3339 time with an offset.
* Each event gets its own result: `accepted`, `duplicate` or `rejected` with a reason. See
  [Sending events](https://docs.technicallyfit.com/guides/sending-events.md#results).

The call for one teammate is in the panel at the top of this page. A door system that reports
many arrivals uses the bulk endpoint with its organization key; a member app sends the
signed-in teammate's own check-in with their token and `@me`.

> [tab] Organization key
>
> Name each teammate in `teammate`. One request holds up to 1,000 events.
>
> ```bash curl theme={null}
> curl -X POST "$TF_API_BASE/v1/events:bulk" \
>   -H "X-API-Key: $TF_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "events": [
>       {"teammate": "member-1042", "type": "visit_check_in", "idempotency_key": "door-7f3a9c",
>        "at": "2026-11-18T07:02:11Z", "data": {"location": "club-014"}},
>       {"teammate": "member-2210", "type": "visit_check_in", "idempotency_key": "door-7f3aa1",
>        "at": "2026-11-18T07:04:52Z", "data": {"location": "club-014"}}
>     ]
>   }'
> ```
>
> ```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 answer = await tf.POST('/v1/events:bulk', {
>   body: {
>     events: [
>       { teammate: 'member-1042', type: 'visit_check_in', idempotency_key: 'door-7f3a9c', at: '2026-11-18T07:02:11Z', data: { location: 'club-014' } },
>       { teammate: 'member-2210', type: 'visit_check_in', idempotency_key: 'door-7f3aa1', at: '2026-11-18T07:04:52Z', data: { location: 'club-014' } },
>     ],
>   },
> });
> console.log(answer.summary);
> ```
>
> ```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"))
>
> answer = tf.send_events({
>     "events": [
>         {"teammate": "member-1042", "type": "visit_check_in", "idempotency_key": "door-7f3a9c",
>          "at": "2026-11-18T07:02:11Z", "data": {"location": "club-014"}},
>         {"teammate": "member-2210", "type": "visit_check_in", "idempotency_key": "door-7f3aa1",
>          "at": "2026-11-18T07:04:52Z", "data": {"location": "club-014"}}
>     ]
> })
> print(answer["summary"])
> ```

> [tab] Teammate token
>
> A [member app](https://docs.technicallyfit.com/guides/member-apps.md) sends the check-in of the signed-in teammate with their
> token, and `@me` in place of the id.
>
> ```bash curl theme={null}
> curl -X POST "$TF_API_BASE/v1/teammates/@me/events" \
>   -H "Authorization: Bearer $TF_TEAMMATE_TOKEN" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "events": [
>       {"type": "visit_check_in", "idempotency_key": "app-checkin-91c2", "at": "2026-11-18T07:02:11Z",
>        "data": {"location": "club-014"}}
>     ]
>   }'
> ```
>
> ```typescript TypeScript theme={null}
> import { createClient } from '@technicallyfit/sdk';
>
> const tf = createClient({ credential: process.env.TF_TEAMMATE_TOKEN ?? '', baseUrl: process.env.TF_API_BASE });
>
> const answer = await tf.POST('/v1/teammates/{external_id}/events', {
>   params: { path: { external_id: '@me' } },
>   body: {
>     events: [
>       { type: 'visit_check_in', idempotency_key: 'app-checkin-91c2', at: '2026-11-18T07:02:11Z', data: { location: 'club-014' } },
>     ],
>   },
> });
> console.log(answer.results[0]?.status);
> ```
>
> ```python Python theme={null}
> import os
>
> from technicallyfit import Client
>
> tf = Client(os.environ["TF_TEAMMATE_TOKEN"], base_url=os.environ.get("TF_API_BASE"))
>
> answer = tf.send_teammate_events("@me", {
>     "events": [
>         {"type": "visit_check_in", "idempotency_key": "app-checkin-91c2", "at": "2026-11-18T07:02:11Z",
>          "data": {"location": "club-014"}}
>     ]
> })
> print(answer["results"][0]["status"])
> ```

## Duplicates

Sending the same event again with the same `idempotency_key` answers `duplicate` and stores
nothing new.

A teammate who checks in twice at the same location within two hours makes one visit, even
when the two check-ins have different keys (a door reader and your app both reporting the
same arrival). The second event is `accepted` and adds no second visit. A check-in at another
location inside those two hours is a new visit.

## Rejections

| Code | Meaning |
| - | - |
| `unknown_location` | You have no active location with that `external_id` in this mode. A test key sees only test locations. |
| `at_in_future` | `at` is more than five minutes ahead of our clock. |
| `consent_required` | The teammate claimed their account and has not allowed events. |

A check-in dated in the past is accepted and recorded as a visit at that time.

A rejected check-in still answers `200`; its result carries the reason:

```json 200 theme={null}
{
  "results": [
    {
      "index": 0,
      "status": "rejected",
      "event_id": null,
      "type": "visit_check_in",
      "reason": {
        "code": "unknown_location",
        "field": "data.location",
        "message": "We could not find that location. Use the external_id of one of your active locations."
      }
    }
  ],
  "summary": {
    "accepted": 0,
    "duplicate": 0,
    "rejected": 1
  }
}
```

## Time zones

A visit is stored with the location's own date and hour (from the location's `time_zone`),
so a visit at 7 in the morning counts at 7 in the morning wherever the location is.

## Who owns a visit

A visit belongs to the teammate. It is in the teammate's data export, labeled with your
organization, and it stays with the teammate if they leave. Deleting their account deletes it.
Test-mode check-ins stay in test mode and never reach live data.

## The location switch

A check-in at a location other than the teammate's home location re-plans that day's session
from the visited location's equipment, and leaves later sessions on the home plan. The teammate's
program keeps a record of the change that names the check-in and your location's `external_id`
as its cause, and `GET /v1/teammates/{external_id}/sessions/today` returns the re-planned
session. This one-day change is not listed in the program's revisions and sends no webhook yet.

The session switches only when all of these hold:

* The check-in is on the teammate's today: its date at the location is the teammate's own date.
  A check-in sent late, for an earlier day, is stored and changes no plan.
* The teammate has a session that day and has not started it.
* The teammate shares their program with your organization.
* The location's equipment is set up.
* No coach manages the teammate's program. A coach's program is never changed by a check-in.
* The teammate has not already rebuilt that day's session for equipment they picked
  themselves. Their own pick outranks a check-in.

The same rules as a path, from the accepted event to the session the teammate trains today.

```mermaid theme={null}
flowchart TD
  E["visit_check_in accepted"] --> V["The visit is recorded"]
  V --> H{"At the teammate's<br/>home location?"}
  H -- Yes --> N["No plan change"]
  H -- No --> T{"On the teammate's today, with a<br/>session not started yet?"}
  T -- No --> N
  T -- Yes --> S{"Program shared with you, the location's<br/>equipment set up, and no coach<br/>manages the program?"}
  S -- No --> N
  S -- Yes --> R["Today's session is re-planned<br/>from this location's equipment<br/>Later sessions stay on the home plan"]
  R --> G["GET /v1/teammates/{external_id}/sessions/today<br/>returns it. No revision and no webhook yet"]
```

A check-in at the home location, or on a day without a session, records the visit and changes no
plan. A second check-in at the same location the same day changes nothing more. A check-in at
another location later the same day re-plans the session again for that location, if it has
still not started. Going home later the same day leaves the day as it is; the next session uses
the home location's equipment again.

The switch happens shortly after the event is accepted. The event's result is `accepted` either
way. Test-mode check-ins re-plan only programs your test key created for that test teammate.


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