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

# Errors

> Every error from the TechnicallyFit API has one shape: a stable code, a sentence, a request ID and details. This page lists every code, its status and whether to retry.

> [!NOTE]
>
> Any verified TechnicallyFit account can create API keys in a free personal developer
> workspace at [app.technicallyfit.com/developer](https://app.technicallyfit.com/developer),
> with no organization required. Organization plans unlock multi-teammate live operations
> and organization features.

Every error from the TechnicallyFit API has the same body, so you can write one error
handler. Branch on `code`, show or log `message`, and keep `request_id` for support.

```bash curl theme={null}
curl -i "$TF_API_BASE/v1/teammates/member-9999" \
  -H "X-API-Key: $TF_API_KEY"
```

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

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

try {
  const teammate = await tf.GET('/v1/teammates/{external_id}', { params: { path: { external_id: 'member-9999' } } });
  console.log(teammate.status);
} catch (error) {
  if (error instanceof NotFoundError) console.log('No such teammate:', error.requestId);
  else if (error instanceof ConsentRequiredError) console.log('Not allowed:', error.details['item']);
  else if (error instanceof TechnicallyFitError) console.log(error.code, error.message, error.requestId);
  else throw error;
}
```

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

from technicallyfit import Client, ConsentRequiredError, NotFoundError, TechnicallyFitError

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

try:
    teammate = tf.get_teammate("member-9999")
    print(teammate["status"])
except NotFoundError as error:
    print("No such teammate:", error.request_id)
except ConsentRequiredError as error:
    print("Not allowed:", error.details.get("item"))
except TechnicallyFitError as error:
    print(error.code, error.message, error.request_id)
```

```json 404 theme={null}
{
  "error": {
    "code": "not_found",
    "message": "We could not find that teammate.",
    "request_id": "8e1f3a5c7b9d4f2ea6c8e0b2d4f6a8c0",
    "details": {}
  }
}
```

## The error body

```json 422 theme={null}
{
  "error": {
    "code": "validation_failed",
    "message": "The request body is not valid.",
    "request_id": "9f2c1e7ab4d04c0f8a51b2c3d4e5f607",
    "details": {
      "fields": [
        {
          "path": "events[0].at",
          "code": "invalid_datetime",
          "message": "Use an ISO 8601 time with an offset."
        }
      ]
    }
  }
}
```

| Field | What it holds |
| - | - |
| `code` | A stable string from the table below. Branch on this, never on `message`. |
| `message` | A sentence a person can read. The wording can change, so do not match on it. |
| `request_id` | The ID of this request. It equals the `X-Request-ID` response header. |
| `details` | Always an object. It holds only the fields listed for the code, and is empty otherwise. |

An error never repeats what you sent. A field error names where the problem is and what is
wrong, not the value, so error bodies are safe to log.

## Codes

| Code | Status | Meaning | Retry | Details |
| - | - | - | - | - |
| `invalid_request` | 400 | A query, header or path value is malformed. | No | `parameter` |
| `unauthorized` | 401 | The API key is missing, unknown, revoked or made for the other mode. | No | None |
| `forbidden` | 403 | The key is the wrong kind for this endpoint, or it does not hold the scope. | No | `required_scope` |
| `consent_required` | 403 | The teammate has not given the consent this call needs. | No | `item`, `account_url` (teammate tokens only) |
| `plan_required` | 403 | The workspace plan does not include this feature. | No | `required_plan`, `feature` |
| `attestor_not_approved` | 403 | The organization has not been approved to certify results. | No | None |
| `not_found` | 404 | The resource does not exist, or your organization cannot see it. | No | None |
| `conflict` | 409 | The current state of the resource does not allow the action. | No | `reason` |
| `payload_too_large` | 413 | The request body is over the size limit. | No | `limit_bytes` |
| `validation_failed` | 422 | The body failed validation or is not JSON. Every failing field is listed. | No | `fields` |
| `rate_limit_exceeded` | 429 | The key is over a rate limit. | Yes | `retry_after_seconds`, `window`, `limit` |
| `internal_error` | 500 | An unexpected failure on our side. | Yes | None |
| `engine_unavailable` | 503, 504 | The engine did not answer in time (504) or could not take the request (503). | Yes | `retry_after_seconds` |

New codes can be added over time. Treat a code you do not know like any other error with
the same status: a `4xx` needs a change to the request, a `5xx` can be retried.

`not_found` and `forbidden` do not say whether a teammate or a workspace exists. A
resource that belongs to another workspace looks the same as one that was never there.

## Plan-gated errors

When a live key (`tf_live_*`) from a personal developer workspace (`plan: "free"`) calls an
organization-only feature, the API responds with `403` and `code: "plan_required"`:

```json 403 theme={null}
{
  "error": {
    "code": "plan_required",
    "message": "This feature requires an organization plan.",
    "request_id": "9f2c1e7ab4d04c0f8a51b2c3d4e5f607",
    "details": {
      "required_plan": "organization",
      "feature": "webhooks"
    }
  }
}
```

| Field | What it holds |
| - | - |
| `details.required_plan` | The workspace plan needed to call this endpoint in live mode (`"organization"`). |
| `details.feature` | The gated feature key (for example `webhooks`, `bulk_events`, `locations`, `insights`, `organization_settings`, `member_app_oauth`, or live non-`@me` teammates). |

Personal live keys can call `reference:read` endpoints and `/v1/teammates/@me*` for the
workspace owner's own data. Test keys (`tf_test_*`) have full sandbox access without
requiring an Organization plan. To unlock organization features in live mode, use
**Upgrade to an organization** in the developer portal (`/onboarding/business`) to open the
application form (an Organization plan is set up under a contract with TechnicallyFit), or
use a key belonging to an organization workspace.

## Validation errors

A `validation_failed` error lists every failing field at once in `details.fields`, so you
can fix them in one pass.

| Field | What it holds |
| - | - |
| `path` | Where the value sits in the body, such as `events[0].at`. An empty path means the body as a whole. A `*` stands for a key you chose yourself. |
| `code` | What is wrong, such as `required`, `invalid_type`, `invalid_option`, `too_small` or `invalid_datetime`. |
| `message` | A sentence that says how to fix it. |
| `suggestions` | Only when the value names something we keep a list of, such as equipment: the closest known values, best first, each with its `token` and `name`. |

A body that is not JSON gets one field with the code `invalid_json` and an empty path.

## Which errors to retry

Retry `rate_limit_exceeded`, `internal_error` and `engine_unavailable`. Do not retry the
others without changing the request: the answer will be the same.

* `rate_limit_exceeded` and `engine_unavailable` send a `Retry-After` header, in seconds.
  The same number is in `details.retry_after_seconds`. Wait at least that long.
* For `internal_error`, wait one second, then double the wait on each attempt, up to about
  thirty seconds. Add a little random time to each wait so your retries do not arrive
  together.
* Stop after a few attempts and report the failure, with the `request_id`.

```javascript theme={null}
async function call(url, options, attempt = 0) {
  const response = await fetch(url, options);
  if (response.ok) return response.json();
  const { error } = await response.json();
  const retryable = ["rate_limit_exceeded", "internal_error", "engine_unavailable"];
  if (!retryable.includes(error.code) || attempt >= 4) {
    throw Object.assign(new Error(error.message), error);
  }
  const wait = error.details.retry_after_seconds ?? 2 ** attempt;
  await new Promise((done) => setTimeout(done, (wait + Math.random()) * 1000));
  return call(url, options, attempt + 1);
}
```

The SDKs raise one error class per code, with `code`, `message`, the request ID and
`details`, and retry the three retryable codes for you (see [SDKs](https://docs.technicallyfit.com/sdks.md)). Catch the
classes you handle and let the rest through:

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

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

try {
  const teammate = await tf.GET('/v1/teammates/{external_id}', { params: { path: { external_id: 'member-9999' } } });
  console.log(teammate.status);
} catch (error) {
  if (error instanceof NotFoundError) console.log('No such teammate:', error.requestId);
  else if (error instanceof ConsentRequiredError) console.log('Not allowed:', error.details['item']);
  else if (error instanceof TechnicallyFitError) console.log(error.code, error.message, error.requestId);
  else throw error;
}
```

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

from technicallyfit import Client, ConsentRequiredError, NotFoundError, TechnicallyFitError

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

try:
    teammate = tf.get_teammate("member-9999")
    print(teammate["status"])
except NotFoundError as error:
    print("No such teammate:", error.request_id)
except ConsentRequiredError as error:
    print("Not allowed:", error.details.get("item"))
except TechnicallyFitError as error:
    print(error.code, error.message, error.request_id)
```

## Getting help with an error

Every response carries an `X-Request-ID` header, and every error repeats it as
`request_id`. Send that ID to [support@technicallyfit.com](mailto:support@technicallyfit.com)
and we can find the exact request. You can also set the header yourself: send
`X-Request-ID` with up to 64 letters, digits, dots, colons, hyphens or underscores, and
the response uses your value.

```bash curl theme={null}
# example: errors-request-id
curl -i "$TF_API_BASE/v1/organization" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "X-Request-ID: checkout-2026-11-19-0042"
```

```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 organization = await tf.GET('/v1/organization', {
  headers: { 'X-Request-ID': 'checkout-2026-11-19-0042' },
});
console.log(organization.id);
```


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