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

# Locations and equipment

> Tell TechnicallyFit what equipment your organization has: one baseline for every location, and what each location adds, lacks or has out of service.

Most of an organization's locations share the same equipment, but each site differs a
little and machines go out of service. You describe that in three parts:

* A **baseline**: the equipment every location has unless it says otherwise.
* **Overrides** at a location: what it adds to the baseline, what it lacks, and what is out
  of service for now.
* The **effective inventory** of a location: the baseline with that location's overrides
  applied. It is worked out each time you read it, so it is always current.

Set these two values once in your terminal. Every example in these docs reads them, so
no example has a host or a key typed into it.

```bash theme={null}
export TF_API_BASE="https://api.technicallyfit.com"
export TF_API_KEY="tf_test_your_key_here"
```

Use a test key (it starts with `tf_test_`) while you build. Never paste a live key into a
page, a ticket or a chat.

A key needs the `locations:read` scope to read and `locations:write` to change anything
on this page. A test key and a live key never see each other's locations or baseline.

```bash curl theme={null}
curl "$TF_API_BASE/v1/locations/downtown-01/inventory" \
  -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 inventory = await tf.GET('/v1/locations/{location_external_id}/inventory', {
  params: { path: { location_external_id: 'downtown-01' } },
});
console.log(inventory.items.map((item) => item.token));
```

```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"))

inventory = tf.get_location_inventory("downtown-01")
print([item["token"] for item in inventory["items"]])
```

```json 200 theme={null}
{
  "location": "downtown-01",
  "as_of": "2026-11-24",
  "set_up": true,
  "inventory_revision": 3,
  "baseline_revision": 5,
  "items": [
    {"token": "barbell", "name": "Barbell", "family": "free_weights", "count": 4, "attributes": {}, "source": "baseline"},
    {"token": "dumbbell", "name": "Dumbbells", "family": "free_weights", "count": null, "attributes": {"max_load_kg": 40}, "source": "baseline"},
    {"token": "sled", "name": "Sled", "family": "conditioning", "count": 2, "attributes": {}, "source": "added"}
  ],
  "unavailable": [
    {"token": "hack_squat", "name": "Hack squat", "reason": "missing", "back_in_service_on": null, "note": null},
    {"token": "leg_press", "name": "Leg press", "reason": "out_of_service", "back_in_service_on": "2026-12-01", "note": "awaiting part"}
  ]
}
```

## Equipment names

Equipment is named with tokens such as `leg_press` or `dumbbell`. The full list, with each
token's name, family and other known spellings, is on the [Equipment](https://docs.technicallyfit.com/reference/equipment.md)
page and at `GET /v1/equipment` (scope `reference:read`).

You may send a token, a name or any other known spelling (`Leg press`, `hex bar`). The
answer always holds the token.

* A name we do not know is rejected with `validation_failed`. The failing field carries
  `suggestions`: the closest known equipment, best first, each with its `token` and `name`.
* A general name that stands for a whole family (`machine`) is rejected for a baseline and
  for a location, with the specific pieces of that family as `suggestions`. An inventory
  says exactly what is on the floor.
* A request with one bad name changes nothing. Every failing field is listed at once.

## Locations

A location is keyed by your own id, in the path. Create it, or replace its details, with
one call:

```bash curl theme={null}
curl -X PUT "$TF_API_BASE/v1/locations/downtown-01" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Downtown", "region": "north-east", "time_zone": "America/New_York", "address": {"line1": "1 Example St", "city": "Example City", "postal_code": "00000", "country": "US"}}'
```

```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 location = await tf.PUT('/v1/locations/{location_external_id}', {
  params: { path: { location_external_id: 'downtown-01' } },
  body: {
    name: 'Downtown',
    region: 'north-east',
    time_zone: 'America/New_York',
    address: { line1: '1 Example St', city: 'Example City', postal_code: '00000', country: 'US' },
  },
});
console.log(location.status, location.inventory_revision);
```

```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"))

location = tf.upsert_location("downtown-01", {
    "name": "Downtown",
    "region": "north-east",
    "time_zone": "America/New_York",
    "address": {"line1": "1 Example St", "city": "Example City", "postal_code": "00000", "country": "US"}
})
print(location["status"], location["inventory_revision"])
```

```json 201 theme={null}
{
  "external_id": "downtown-01",
  "name": "Downtown",
  "region": "north-east",
  "time_zone": "America/New_York",
  "address": {"line1": "1 Example St", "city": "Example City", "postal_code": "00000", "country": "US"},
  "status": "active",
  "inventory_revision": 0,
  "overrides_count": 0,
  "created_at": "2026-11-24T14:05:31Z",
  "updated_at": "2026-11-24T14:05:31Z"
}
```

* The id is 1 to 255 characters from letters, digits and `. _ : -`.
* `name` and `time_zone` (an IANA name such as `America/New_York`) are required. `region`
  is your own grouping, and `address` is optional.
* The first call answers `201`. Sending the same body again answers `200` with the same
  location and changes nothing, so the call is safe to retry.
* The body is the whole location: a field you leave out is cleared.

Read one with `GET /v1/locations/{location_external_id}`, or page through all of them with
`GET /v1/locations` (`status`, `region`, `limit` up to 100, and `cursor` from
`next_cursor`). The SDKs follow `next_cursor` for you:

```bash curl theme={null}
curl "$TF_API_BASE/v1/locations?status=active&region=north-east&limit=100" \
  -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 location of tf.paginate('/v1/locations', { params: { query: { status: 'active', region: 'north-east' } } })) {
  console.log(location.external_id, location.name);
}
```

```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 location in tf.paginate(tf.list_locations, status="active", region="north-east"):
    print(location["external_id"], location["name"])
```

`DELETE /v1/locations/{location_external_id}` archives a location. An archived location keeps its
overrides and has no inventory. Sending the `PUT` again makes it active.

To send many locations at once from your own systems, see [Syncing a chain](https://docs.technicallyfit.com/guides/syncing-a-chain.md).

## The baseline

The baseline is one list for the organization. `PUT` replaces the whole list, so an item
you leave out is removed from it:

```bash curl theme={null}
curl -X PUT "$TF_API_BASE/v1/inventory/baseline" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items": [{"token": "barbell", "count": 4}, {"token": "dumbbell", "attributes": {"max_load_kg": 40}}, {"token": "leg_press", "count": 2}]}'
```

```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 baseline = await tf.PUT('/v1/inventory/baseline', {
  body: {
    items: [
      { token: 'barbell', count: 4 },
      { token: 'dumbbell', attributes: { max_load_kg: 40 } },
      { token: 'leg_press', count: 2 },
    ],
  },
});
console.log(baseline.revision);
```

```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"))

baseline = tf.replace_inventory_baseline({
    "items": [
        {"token": "barbell", "count": 4},
        {"token": "dumbbell", "attributes": {"max_load_kg": 40}},
        {"token": "leg_press", "count": 2}
    ]
})
print(baseline["revision"])
```

```json 200 theme={null}
{
  "items": [
    {"token": "barbell", "name": "Barbell", "family": "free_weights", "count": 4, "attributes": {}},
    {"token": "dumbbell", "name": "Dumbbells", "family": "free_weights", "count": null, "attributes": {"max_load_kg": 40}},
    {"token": "leg_press", "name": "Leg press", "family": "machines", "count": 2, "attributes": {}}
  ],
  "revision": 5,
  "updated_at": "2026-11-24T14:10:02Z"
}
```

* `count` is how many you have. `attributes` are facts about the equipment, such as
  `max_load_kg`. Each piece of equipment lists the attributes it accepts. Both are optional,
  and neither changes which equipment a location has.
* The answer carries a `revision` that goes up by one each time the baseline changes.
  Sending the same list again, in any order, changes nothing.

A change to the baseline reaches every location at once:

* Adding an item adds it to every location, except those that marked it `missing`.
* Removing an item removes it from every location, except those that `added` it themselves.

Read the baseline with `GET /v1/inventory/baseline`.

## Overrides

A location has three kinds of override.

| Kind | What it means |
| - | - |
| `added` | The location has this item. Use it for equipment the baseline does not list, or to give a baseline item this location's own `count` and `attributes`. |
| `missing` | The location does not have this baseline item. |
| `out_of_service` | The item cannot be used for now. |

Set one item at a time:

```bash curl theme={null}
curl -X PUT "$TF_API_BASE/v1/locations/downtown-01/overrides/leg_press" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "out_of_service", "back_in_service_on": "2026-12-01", "note": "awaiting part"}'
```

```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.PUT('/v1/locations/{location_external_id}/overrides/{token}', {
  params: { path: { location_external_id: 'downtown-01', token: 'leg_press' } },
  body: { kind: 'out_of_service', back_in_service_on: '2026-12-01', note: 'awaiting part' },
});
console.log(answer.inventory_revision);
```

```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.set_location_override("downtown-01", "leg_press", {
    "kind": "out_of_service",
    "back_in_service_on": "2026-12-01",
    "note": "awaiting part"
})
print(answer["inventory_revision"])
```

Or replace every override of the location in one call. An override you leave out is
removed:

```bash curl theme={null}
curl -X PUT "$TF_API_BASE/v1/locations/downtown-01/overrides" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"overrides": [{"token": "hack_squat", "kind": "missing"}, {"token": "sled", "kind": "added", "count": 2}, {"token": "leg_press", "kind": "out_of_service", "back_in_service_on": "2026-12-01"}]}'
```

```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.PUT('/v1/locations/{location_external_id}/overrides', {
  params: { path: { location_external_id: 'downtown-01' } },
  body: {
    overrides: [
      { token: 'hack_squat', kind: 'missing' },
      { token: 'sled', kind: 'added', count: 2 },
      { token: 'leg_press', kind: 'out_of_service', back_in_service_on: '2026-12-01' },
    ],
  },
});
console.log(answer.overrides.length);
```

```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.replace_location_overrides("downtown-01", {
    "overrides": [
        {"token": "hack_squat", "kind": "missing"},
        {"token": "sled", "kind": "added", "count": 2},
        {"token": "leg_press", "kind": "out_of_service", "back_in_service_on": "2026-12-01"}
    ]
})
print(len(answer["overrides"]))
```

```json 200 theme={null}
{
  "location": "downtown-01",
  "inventory_revision": 3,
  "overrides": [
    {"token": "hack_squat", "name": "Hack squat", "kind": "missing", "count": null, "attributes": {}, "back_in_service_on": null, "note": null},
    {"token": "leg_press", "name": "Leg press", "kind": "out_of_service", "count": null, "attributes": {}, "back_in_service_on": "2026-12-01", "note": null},
    {"token": "sled", "name": "Sled", "kind": "added", "count": 2, "attributes": {}, "back_in_service_on": null, "note": null}
  ]
}
```

* An item can be `added` and `out_of_service` at once: send two entries. An item marked
  `missing` cannot be anything else.
* `count` and `attributes` go with `added` only. `back_in_service_on` and `note` go with
  `out_of_service` only.
* `DELETE /v1/locations/{location_external_id}/overrides/{token}` removes every override of the
  item, so it follows the baseline again. Add `?kind=out_of_service` to put an item back in
  service and keep the rest.
* Each location has an `inventory_revision`. It goes up by one each time the location's
  overrides change, or a baseline change adds or removes equipment there.

To put the leg press back in service before its date, and keep any other override of it:

```bash curl theme={null}
curl -X DELETE "$TF_API_BASE/v1/locations/downtown-01/overrides/leg_press?kind=out_of_service" \
  -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 });

await tf.DELETE('/v1/locations/{location_external_id}/overrides/{token}', {
  params: { path: { location_external_id: 'downtown-01', token: 'leg_press' }, query: { kind: 'out_of_service' } },
});
```

```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"))

tf.remove_location_override("downtown-01", "leg_press", kind="out_of_service")
```

The answer is `204` with no body.

### Out of service

An item that is out of service is left out of the effective inventory, whatever its count.

* With `back_in_service_on`, the item returns by itself on that date, in the location's own
  time zone. Nobody has to remove the override.
* Without a date, it stays out of service until you remove the override.
* A date that has already arrived is the same as no override.

To record fewer of something, change its `count` instead.

## Effective inventory

Read what a location has today (the answer is in the panel at the top of this page). The
examples below add `on` to read it on another date:

```bash curl theme={null}
curl "$TF_API_BASE/v1/locations/downtown-01/inventory?on=2026-12-01" \
  -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 inventory = await tf.GET('/v1/locations/{location_external_id}/inventory', {
  params: { path: { location_external_id: 'downtown-01' }, query: { on: '2026-12-01' } },
});
console.log(inventory.as_of, inventory.items.length);
```

```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"))

inventory = tf.get_location_inventory("downtown-01", on="2026-12-01")
print(inventory["as_of"], len(inventory["items"]))
```

The answer holds:

| Field | What it holds |
| - | - |
| `items` | The equipment the location has on that date. Each has its `token`, `name`, `family`, `count`, `attributes` and a `source`: `baseline`, or `added` when the location's own override supplies it. |
| `unavailable` | The equipment the location does not have on that date, each with a `reason` (`missing` or `out_of_service`) and, when out of service, its `back_in_service_on` and `note`. |
| `as_of` | The date the inventory was read on, in the location's time zone. |
| `set_up` | False while the organization has no baseline and the location has added nothing. |
| `inventory_revision`, `baseline_revision` | The two revisions the answer was built from. |

Add `?on=2026-12-01` to read the inventory on another date, for example to see what
returns to service that day.

### A worked example

The baseline is `barbell`, `dumbbell` and `leg_press`. Downtown marked `hack_squat` as
`missing`, `added` a `sled`, and has `leg_press` out of service until 1 December.

| When | Downtown has |
| - | - |
| Today | `barbell`, `dumbbell`, `sled` |
| You add `hack_squat` and `rower` to the baseline | `barbell`, `dumbbell`, `rower`, `sled` (not `hack_squat`: Downtown marked it missing) |
| You remove `rower` from the baseline again | `barbell`, `dumbbell`, `sled` |
| 1 December, Downtown's time | `barbell`, `dumbbell`, `leg_press`, `sled` |

## Home locations

A teammate can have a home location: one of your active locations, in the same mode as the
key. Set it with the teammate's `home_location_external_id` on
`PUT /v1/teammates/{external_id}`, and clear it with `null`. A field you leave out keeps its
current value.

```bash curl theme={null}
curl -X PUT "$TF_API_BASE/v1/teammates/member-1042" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"home_location_external_id": "downtown-01"}'
```

```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 teammate = await tf.PUT('/v1/teammates/{external_id}', {
  params: { path: { external_id: 'member-1042' } },
  body: { home_location_external_id: 'downtown-01' },
});
console.log(teammate.home_location_external_id);
```

```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"))

teammate = tf.upsert_teammate("member-1042", {"home_location_external_id": "downtown-01"})
print(teammate["home_location_external_id"])
```

An archived location, a location of another organization and a location of the other mode
are refused with `validation_failed`; the field's `code` is `location_archived` or
`unknown_location`. A teammate signed in to your member app can choose their own home
location with `PATCH /v1/teammates/@me` and the same field (see
[Member apps](https://docs.technicallyfit.com/guides/member-apps.md)).

After a teammate claims their account, their home location is personal data about where they
train. You change it only with their `program_setup` consent (otherwise `consent_required`),
and a home location they chose themselves reads as `null` to your key unless they allowed
`program_setup`. Leaving your organization clears it.

### Which equipment a session uses

For each session, the equipment comes from the first of these that applies:

1. The equipment the teammate chose for that session.
2. A trip the teammate set up, while it lasts.
3. Their home location's effective inventory on the session's date, when the location is
   active and set up.
4. The teammate's own equipment.
5. No limit.

A location that is not set up, or is archived, is skipped, so the teammate keeps their own
equipment as before. A set-up location with nothing available counts as bodyweight only,
never as "no limit".

A teammate with home locations at two organizations: a program an organization built uses
that organization's home location, and the teammate's own programs use their home location
only when they have exactly one.

> [!NOTE]
>
> Today's session and a session rebuilt for a day read the home location now. New programs are
> still planned from the teammate's own equipment: the planner reads the home location once a
> planned change on our side lands. Until then, a program built for a teammate homed at a
> location does not yet reflect that location's equipment when it is first made.

## When a location's equipment changes

A write that changes what a location has (a baseline change, an override, an item out of
service, an archived location, or a [chain sync](https://docs.technicallyfit.com/guides/syncing-a-chain.md)) does two things
once it is saved:

* It sends one [`location.inventory_changed`](https://docs.technicallyfit.com/guides/webhooks#location-inventory-changed)
  webhook per location whose equipment changed, with what it gained and lost and how many
  teammates are homed there. A count, never a list of people.
* It asks for a new plan for each teammate homed at that location, for the rest of each
  program the location applies to, using the location's new equipment (or the teammate's own
  equipment once the location is archived or no longer set up).

A change to a count, an attribute, a note, a name or an address changes nobody's plan and
sends nothing. Saving the same thing twice sends nothing the second time.

A change in test mode reaches only test teammates' own test programs and your test webhook
endpoints.

> [!NOTE]
>
> Re-planning is switched off while it is in early access, and it needs each program's plan
> stored in the form the engine re-plans from, which programs do not have yet. Until both are
> in place, the webhook is still sent with its count, and teammates' upcoming sessions pick
> up the new equipment when their day comes, but their programs are not re-planned.

An item marked out of service with a back date counts as available again on that date
(in the location's time zone) when it is read. That return does not yet send a webhook or
ask for a new plan by itself; the next change at the location does.


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