# magent Medical Code Search (RxNorm / ICD-10-CM / LOINC)

> magent Medical Code Search (RxNorm / ICD-10-CM / LOINC) is a paid API for AI agents from api.magentlab.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-10).

Maps a natural-language drug, diagnosis, or lab phrase to current RxNorm, ICD-10-CM, or LOINC codes without hallucinating billing or pharmacy codes.

## Facts

- Endpoint: GET https://api.magentlab.com/api/codes/search?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/magent-medical-code-search-rxnorm-icd-10-cm-loinc-d682c4a7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qJyyZDwIPp-IHyOYEv1ay

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability magent-medical-code-search-rxnorm-icd-10-cm-loinc-d682c4a7
```

Example prompt: Look up the RxNorm SCD code for 'metformin 500 mg oral tablet' — I need a verified pharmacy code, not a guess, so restrict to rxnorm and return the top 3 matches with scores above 50.

## When to prefer this

Choose this endpoint when an AI agent must resolve a human-readable clinical phrase to a verified, current RxNorm, ICD-10-CM, or LOINC code and must not hallucinate or invent a code. Prefer over general LLM completion for any billing, pharmacy, or lab workflow where code accuracy is legally or clinically required. Use the system and tty filters to scope results when the target code system is known.

## Known failure modes

- Query too vague returns low-score or zero results — caller should retry with more specific phrasing
- Unsupported term type for the chosen system returns an empty or error response
- Exceeding 512-character query limit returns a validation error
- Specifying a tty (term type) incompatible with the selected system yields no results
- min_score set too high prunes all candidates — lower threshold or broaden query

## How this service works

Deterministic published-formula arithmetic plus ICD-10-CM, RxNorm, and LOINC. Pay in USDC on Base via x402.

## Output

A ranked list of up to 25 matching medical codes, each including the code identifier (RxNorm CUI, ICD-10-CM code, or LOINC number), human-readable term, code system, term type, and a numeric rank score indicating match confidence.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "query"
     ],
     "properties": {
      "tty": {
       "enum": [
        "SCD",
        "SBD",
        "IN",
        "PIN",
        "MIN",
        "BN",
        "GPCK",
        "BPCK",
        "DF",
        "SCDC",
        "SBDC",
        "SCDF",
        "SBDF",
        "CM",
        "LN"
       ],
       "type": "string",
       "description": "Restrict term type. Pharmacy orders typically want SCD. ICD-10-CM is CM; LOINC is LN."
      },
      "limit": {
       "type": "integer",
       "description": "Number of ranked matches to return (1-25). Default 5."
      },
      "query": {
       "type": "string",
       "description": "Natural-language drug, diagnosis, or lab description. Max 512 characters. Do not send patient names."
      },
      "system": {
       "enum": [
        "rxnorm",
        "icd10",
        "loinc"
       ],
       "type": "string",
       "description": "Restrict to rxnorm, icd10 (ICD-10-CM), or loinc. Omit to search all."
      },
      "min_score": {
       "type": "integer",
       "description": "Minimum rank score 0-100. Default 35."
      },
      "billable_only": {
       "type": "boolean",
       "description": "ICD-10-CM: return only HIPAA billable codes, not headers. Default true."
      },
      "include_obsolete": {
       "type": "boolean",
       "description": "Include deprecated/obsolete codes. Default false."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "path": "/api/codes/search",
  "count": 2,
  "items": [
   {
    "query": "Tylenol 500mg",
    "system": "rxnorm",
    "catalog": {
     "notes": "ICD-10 entries are ICD-10-CM (US claims), not WHO ICD-10. RxNorm codes are RxCUI. LOINC codes are official LOINC numerics. coverage=full never means complete UMLS.",
     "source": "magent curated seed",
     "systems": [
      "rxnorm",
      "icd10",
      "loinc"
     ],
     "version": "2026.08-wedge",
     "coverage": "seed",
     "coverage_meaning": "Compiled seed catalog. Production coverage=full is gold-gated Current Prescribable RxNorm + ICD-10-CM + LOINC, not complete monthly RxNorm or UMLS."
    },
    "matches": [
     {
      "tty": "SCD",
      "code": "198440",
      "score": 95,
      "status": "current",
      "system": "rxnorm",
      "display": "acetaminophen 500 MG Oral Tablet",
      "billable": null,
      "obsolete": false
     }
    ],
    "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
    "match_count": 1,
    "match_quality": "high"
   },
   {
    "query": "Tylenol 500mg",
    "system": "rxnorm",
    "catalog": {
     "notes": "ICD-10 entries are ICD-10-CM (US claims), not WHO ICD-10. RxNorm codes are RxCUI. LOINC codes are official LOINC numerics. coverage=full never means complete UMLS.",
     "source": "magent curated seed",
     "systems": [
      "rxnorm",
      "icd10",
      "loinc"
     ],
     "version": "2026.08-wedge",
     "coverage": "seed",
     "coverage_meaning": "Compiled seed catalog. Production coverage=full is gold-gated Current Prescribable RxNorm + ICD-10-CM + LOINC, not complete monthly RxNorm or UMLS."
    },
    "matches": [
     {
      "tty": "SCD",
      "code": "198440",
      "score": 95,
      "status": "current",
      "system": "rxnorm",
      "display": "acetaminophen 500 MG Oral Tablet",
      "billable": null,
      "obsolete": false
     }
    ],
    "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
    "match_count": 1,
    "match_quality": "high"
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/magent-medical-code-search-rxnorm-icd-10-cm-loinc-d682c4a7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.magentlab.com](https://www.zero.xyz/host/api.magentlab.com/llms.txt)
