---
title: "Convert lab units"
method: POST
path: "/api/agent/convert_units"
tags: ["reference"]
---

# Convert lab units

`POST /api/agent/convert_units`

## Request

- Base URL: `https://www.test-well.com`
- URL: `https://www.test-well.com/api/agent/convert_units`
- Auth: none declared

Convert a lab value between US conventional and SI units for 30 common analytes (glucose, cholesterol, testosterone, vitamin D, …) using published factors; hemoglobin A1c uses the NGSP↔IFCC master equation and also returns estimated average glucose.

## Request body

- object
  - `analyte` string, required: Analyte slug or name, e.g. 'glucose', 'total-cholesterol', 'testosterone', 'vitamin-d', 'a1c'
  - `value` number, required: The numeric value to convert
  - `direction` 'toSI' | 'toConventional': Default toSI (US → SI)

## Response `200`

Tool result

- object
  - `tool` 'convert_units', required
  - `result` object, required
    - `analyte` string
    - `input` object
      - `value` number
      - `unit` string
    - `output` object
      - `value` number
      - `unit` string
    - `factor` number
    - `method` string
    - `estimatedAverageGlucose` object
      - `value` number
      - `unit` string
    - `note` string, nullable
    - `biomarkerUrl` string, nullable
    - `error` string

## Other responses

- `400`: Invalid input
- `429`: Rate limited

---

[API](https://skmtc.dev/test-well/apis/testwell-agent-api.md) · [All operations](https://skmtc.dev/test-well/apis/testwell-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/test-well/apis/testwell-agent-api/revisions/6e260731dfa4?raw)
