{"uid":"cap_e4V7ipnGQx2zXKMpUl6Q6","slug":"urine-anion-gap-calculator-batlle-1988-d78ad133","name":"Urine Anion Gap Calculator (Batlle 1988)","description":"Urine anion gap from urine sodium, potassium, and chloride (Na + K − Cl). Batlle 1988 interpretive band: negative suggests increased NH4+ (GI bicarbonate loss); positive suggests impaired NH4+ (RTA). Deterministic published arithmetic with citation; not a diagnosis.","url":"https://api.magentlab.com/api/calc/urine_anion_gap","method":"GET","headers":{},"bodySchema":{"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":["urine_sodium_mmol_l","urine_potassium_mmol_l","urine_chloride_mmol_l"],"properties":{"urine_sodium_mmol_l":{"type":"number","description":"Urine sodium in mmol/L (same as mEq/L). Range 1-300."},"urine_chloride_mmol_l":{"type":"number","description":"Urine chloride in mmol/L (same as mEq/L). Range 1-300."},"urine_potassium_mmol_l":{"type":"number","description":"Urine potassium in mmol/L (same as mEq/L). Range 1-200."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"path":"/api/calc/urine_anion_gap","count":2,"items":[{"formula":"urine_anion_gap","citation":{"id":"batlle-1988","doi":"10.1056/NEJM198803033180902","title":"The use of the urinary anion gap in the diagnosis of hyperchloremic metabolic acidosis","source":"N Engl J Med. 1988;318(10):594-599","authors":"Batlle DC, Hizon M, Cohen E, Gutterman C, Gupta R"},"uag_band":"negative","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.","formula_expression":"urine_anion_gap_mmol_l = urine_sodium_mmol_l + urine_potassium_mmol_l - urine_chloride_mmol_l","urine_sodium_mmol_l":20,"urine_chloride_mmol_l":90,"urine_anion_gap_mmol_l":-40,"urine_potassium_mmol_l":30},{"formula":"urine_anion_gap","citation":{"id":"batlle-1988","doi":"10.1056/NEJM198803033180902","title":"The use of the urinary anion gap in the diagnosis of hyperchloremic metabolic acidosis","source":"N Engl J Med. 1988;318(10):594-599","authors":"Batlle DC, Hizon M, Cohen E, Gutterman C, Gupta R"},"uag_band":"negative","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.","formula_expression":"urine_anion_gap_mmol_l = urine_sodium_mmol_l + urine_potassium_mmol_l - urine_chloride_mmol_l","urine_sodium_mmol_l":20,"urine_chloride_mmol_l":90,"urine_anion_gap_mmol_l":-40,"urine_potassium_mmol_l":30}]}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Bx7mi1PdxVUXY4DmA3mTg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates urine anion gap (Na + K − Cl) from urine electrolytes and returns an interpretive band distinguishing GI bicarbonate loss from renal tubular acidosis (RTA).","exampleAgentPrompt":"Calculate the urine anion gap for a patient with urine sodium 40 mmol/L, urine potassium 20 mmol/L, and urine chloride 80 mmol/L, and tell me whether the result suggests GI bicarbonate loss or renal tubular acidosis.","exampleUseCases":[{"title":"Non-anion gap acidosis workup in ER","prompt":"My patient has non-anion gap metabolic acidosis. Their urine sodium is 35 mmol/L, urine potassium is 25 mmol/L, and urine chloride is 90 mmol/L. Calculate the urine anion gap and tell me if it points toward diarrhea or RTA."},{"title":"RTA confirmation in nephrology clinic","prompt":"I have a nephrology patient suspected of distal RTA. Urine labs show sodium 50 mmol/L, potassium 30 mmol/L, chloride 20 mmol/L. What's the urine anion gap and does the Batlle 1988 interpretation support impaired NH4 excretion?"},{"title":"Acid-base teaching case","prompt":"For a teaching case: urine sodium is 60 mmol/L, potassium is 15 mmol/L, chloride is 85 mmol/L. Compute the urine anion gap using the Na + K minus Cl formula and explain what a negative result means for NH4 excretion."}],"resultDescription":"Returns the numeric urine anion gap value (Na + K − Cl in mmol/L) along with a Batlle 1988 interpretive classification: a negative UAG suggests increased ammonium excretion consistent with GI bicarbonate loss (e.g. diarrhea), while a positive UAG suggests impaired NH4+ excretion consistent with renal tubular acidosis (RTA). Result is a deterministic arithmetic calculation with citation, not a clinical diagnosis.","failureModes":["Missing required query parameter (urine_sodium_mmol_l, urine_potassium_mmol_l, or urine_chloride_mmol_l) returns a validation error","Values outside specified ranges (Na/Cl >300 or K >200 mmol/L) may return a range error or unexpected result","Non-numeric input for electrolyte values returns a parsing error","Payment failure (x402) blocks the request before computation occurs"],"whenToPreferThis":"Choose this endpoint when you need a fast, citable, deterministic urine anion gap calculation with a built-in Batlle 1988 interpretive band for differentiating GI bicarbonate loss from renal tubular acidosis in the workup of non-anion gap metabolic acidosis. Prefer it over manual calculation when you need a machine-readable result with clinical interpretation text, or when logging acid-base assessments in an automated clinical workflow.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T13:16:32.108Z","isFirstParty":false}