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

# SDKs

> Client libraries for the TechnicallyFit API in TypeScript and Python: typed calls, retries, typed errors, observation builders, offline batching, teammate sign-in and webhook verification.

An SDK is a library that calls the TechnicallyFit API for you, so your code works with
functions and typed values and does not build each request by hand.

There are two SDKs, with the same features:

| Language | Package | Runs on |
| - | - | - |
| TypeScript | `@technicallyfit/sdk` | Node 20 and newer, browsers, React Native and edge runtimes. |
| Python | `technicallyfit` | Python 3.11 and newer. No dependencies outside the standard library. |

## Install and make a first call

Install the package for your language:

```bash TypeScript theme={null}
npm install @technicallyfit/sdk
```

```bash Python theme={null}
pip install technicallyfit
```

Then ask the API which workspace your key belongs to. With `TF_API_KEY` set to a test key
(see [Quickstart](https://docs.technicallyfit.com/guides/quickstart.md)), this runs as it is:

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

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

const organization = await tf.GET('/v1/organization');
console.log(organization.name, organization.kind, organization.mode);
```

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

organization = tf.get_organization()
print(organization["name"], organization["kind"], organization["mode"])
```

Both print the workspace name, its kind (`personal` or `organization`) and the key's mode
(`test` or `live`). `baseUrl` and `base_url` default to the production API; set
`TF_API_BASE` only to call another host.

## What the SDKs do

* **Typed calls.** Every public operation, with its parameters, body and answer typed from
  the API reference. A path, field or value the API does not take fails when you build
  your code, not when you send it.
* **Retries.** A request that hit a rate limit, a network failure or a temporary server
  error is sent again, after the `Retry-After` wait the API asked for. Retries send the same
  idempotency keys, so nothing is stored twice.
* **Typed errors.** Each [error code](https://docs.technicallyfit.com/guides/errors.md) has its own error class, with the
  code, the message, the request ID and the details.
* **Observation builders.** Pain and soreness reports, logged sets and readings are checked
  against `observation/1` and the quantity list before anything is sent. See
  [Observation builders](https://docs.technicallyfit.com/sdks/observation-builders.md).
* **Offline batching.** A queue that keeps events while your code cannot reach the API
  and sends each one once when it can. See [Offline batching](https://docs.technicallyfit.com/sdks/offline-batching.md).
* **Teammate sign-in.** The sign-in flow for [member apps](https://docs.technicallyfit.com/guides/member-apps.md), and a
  credential that refreshes itself.
* **Webhook verification.** Checks the signature of every delivery. See
  [Webhook verification](https://docs.technicallyfit.com/sdks/webhook-verification.md).

## Authentication

The SDKs take a credential and send it the way the API expects:

| Where your code runs | Credential |
| - | - |
| Your servers | An organization key (`tf_test_...` or `tf_live_...`), sent in `X-API-Key`. |
| An app on a person's device | A teammate token for that one person, sent as `Authorization: Bearer`. |

> [!WARNING]
>
> An organization key reads and writes every teammate of your organization. Keep it on
> your servers. Never put one in a mobile app, a browser or any code that ships to a
> person's device: sign the person in and use a teammate token instead.

The SDKs never follow a redirect, and never send a credential to a host other than the
one you configured.

> [card] [TypeScript](https://docs.technicallyfit.com/sdks/typescript.md)
>
> Install, authenticate and make your first call.

> [card] [Python](https://docs.technicallyfit.com/sdks/python.md)
>
> Install, authenticate and make your first call.


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