# EuroSCORE II in-hospital mortality

EuroSCORE II

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/euroscore_ii`
HTML: https://magentlab.com/docs/euroscore-ii
Markdown: https://magentlab.com/docs/euroscore-ii.md

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Compute the Nashef 2012 Table 6 logistic estimated in-hospital mortality after adult cardiac surgery from the published multivariable coefficients.

## When to use

When an agent needs the published EuroSCORE II probability and must not substitute additive EuroSCORE I, invent low/intermediate/high percent bands, or issue an operative clearance.

## When not to use

- Not a medical device. Not a diagnosis and not an operative clearance.
- Nashef 2012 Table 6 multivariable logistic EuroSCORE II only. This is not additive EuroSCORE I and not Table 5 univariable coefficients.
- Nashef 2012 does not publish low, intermediate, or high percent cuts; magent does not invent them.
- renal is a caller-assigned creatinine-clearance band or dialysis. magent does not run Cockcroft-Gault and does not parse a creatinine number.
- NYHA, LV function, urgency, procedure weight, and flags are caller-assigned published categories. magent does not examine the patient or classify an operative note.
- The paper's developmental cohort oldest patient was 95; predicted percent is for a population, not an individual outcome.

## Formula

```
y = -5.324537 + 0.0285181*age_step + female + renal + extracardiac_arteriopathy + poor_mobility + previous_cardiac_surgery + chronic_lung_disease + active_endocarditis + critical_preoperative_state + insulin_dependent_diabetes + nyha + ccs_class_4 + lv_function + recent_mi + pulmonary_hypertension + urgency + weight_of_procedure + thoracic_aorta (Nashef 2012 Table 6 multivariable); age_step = 1 if age <= 60 else (age - 59); female 0.2196434; renal cc_gt_85 0, cc_51_85 0.303553, cc_le_50 0.8592256, dialysis 0.6421508; extracardiac_arteriopathy 0.5360268; poor_mobility 0.2407181; previous_cardiac_surgery 1.118599; chronic_lung_disease 0.1886564; active_endocarditis 0.6194522; critical_preoperative_state 1.086517; insulin_dependent_diabetes 0.3542749; nyha 1 0, 2 0.1070545, 3 0.2958358, 4 0.5597929; ccs_class_4 0.2226147; lv_function good 0, moderate 0.3150652, poor 0.8084096, very_poor 0.9346919; recent_mi 0.1528943; pulmonary_hypertension none 0, moderate 0.1788899, severe 0.3491475; urgency elective 0, urgent 0.3174673, emergency 0.7039121, salvage 1.362947; weight_of_procedure isolated_cabg 0, single_non_cabg 0.0062118, two 0.5521478, three_plus 0.9724533; thoracic_aorta 0.6527205; estimated_probability_percent = 100 * exp(y) / (1 + exp(y))
```

## Citation

[EuroSCORE II](https://doi.org/10.1093/ejcts/ezs043)
Nashef SAM, Roques F, Sharples LD, Nilsson J, Smith C, Goldstone AR, Lockowandt U
Eur J Cardiothorac Surg. 2012;41(4):734-745
DOI: [10.1093/ejcts/ezs043](https://doi.org/10.1093/ejcts/ezs043)

## Worked example

### Age 60, male, cc >85, NYHA I, good LV, elective isolated CABG

Given: `active_endocarditis=false, age=60, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=good, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_gt_85, sex=male, thoracic_aorta=false, urgency=elective, weight_of_procedure=isolated_cabg`

1. age 60 → age_step Xi = 1 (age <= 60)
2. all other Table 6 factors are reference (0)
3. y = -5.324537 + 0.0285181×1 = -5.2960189
4. estimated_probability_percent = 100 × e^y / (1 + e^y) = 0.50


### Age 70, female, otherwise baseline CABG

Given: `active_endocarditis=false, age=70, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=good, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_gt_85, sex=female, thoracic_aorta=false, urgency=elective, weight_of_procedure=isolated_cabg`

1. age 70 → age_step Xi = 11
2. female +0.2196434
3. y = -5.324537 + 0.0285181×11 + 0.2196434
4. estimated_probability_percent from the unrounded logit


### Baseline with renal cc_le_50

Given: `active_endocarditis=false, age=60, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=good, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_le_50, sex=male, thoracic_aorta=false, urgency=elective, weight_of_procedure=isolated_cabg`

1. age_step 1 plus renal cc_le_50 +0.8592256
2. estimated_probability_percent from the unrounded logit


### Baseline with salvage urgency

Given: `active_endocarditis=false, age=60, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=good, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_gt_85, sex=male, thoracic_aorta=false, urgency=salvage, weight_of_procedure=isolated_cabg`

1. age_step 1 plus salvage +1.362947
2. estimated_probability_percent from the unrounded logit


### Baseline with thoracic aorta

Given: `active_endocarditis=false, age=60, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=good, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_gt_85, sex=male, thoracic_aorta=true, urgency=elective, weight_of_procedure=isolated_cabg`

1. age_step 1 plus thoracic aorta +0.6527205
2. estimated_probability_percent from the unrounded logit


### Baseline with poor LV function

Given: `active_endocarditis=false, age=60, ccs_class_4=false, chronic_lung_disease=false, critical_preoperative_state=false, extracardiac_arteriopathy=false, insulin_dependent_diabetes=false, lv_function=poor, nyha=1, poor_mobility=false, previous_cardiac_surgery=false, pulmonary_hypertension=none, recent_mi=false, renal=cc_gt_85, sex=male, thoracic_aorta=false, urgency=elective, weight_of_procedure=isolated_cabg`

1. age_step 1 plus poor LV +0.8084096
2. estimated_probability_percent from the unrounded logit


## Also searched as

- EuroSCORE II
- EuroSCORE 2
- Nashef 2012 cardiac surgery mortality
- in-hospital mortality after cardiac surgery
- logistic EuroSCORE II
- cardiac operative risk evaluation II
- EuroSCORE II Table 6
- predicted hospital death after heart surgery

## Parameters

- `age` (integer, required): Age in years (18-120). Nashef 2012 Table 6: Xi = 1 if age <= 60; Xi = age - 59 if older (age 61 → 2). Coefficient 0.0285181 on the encoded step, not on raw years.
- `sex` (string, required): Sex as assigned by the caller. male is the reference (0). female adds 0.2196434 (Nashef 2012 Table 6).
- `renal` (string, required): Nashef 2012 renal-function band as assigned by the caller: cc_gt_85 (reference, 0), cc_51_85 (+0.303553), cc_le_50 (+0.8592256), or dialysis (+0.6421508). magent does not run Cockcroft-Gault and does not parse a creatinine number.
- `nyha` (integer, required): NYHA class 1-4 as assigned by the caller (Nashef 2012 Table 6). class 1 is the reference (0); class 2 +0.1070545; class 3 +0.2958358; class 4 +0.5597929.
- `lv_function` (string, required): Left-ventricular function band as assigned by the caller: good (LVEF 51% or more, reference 0), moderate (31-50%, +0.3150652), poor (21-30%, +0.8084096), or very_poor (20% or less, +0.9346919). magent does not parse an ejection-fraction number.
- `urgency` (string, required): Nashef 2012 urgency as assigned by the caller: elective (reference, 0), urgent (+0.3174673), emergency (+0.7039121), or salvage (+1.362947).
- `weight_of_procedure` (string, required): Nashef 2012 weight of the intervention as assigned by the caller: isolated_cabg (reference, 0), single_non_cabg (+0.0062118), two (+0.5521478), or three_plus (+0.9724533). magent does not classify an operative note.
- `pulmonary_hypertension` (string, required): Nashef 2012 Table 6 PA systolic-pressure band as assigned by the caller: none (reference, 0), moderate (31-55 mmHg, +0.1788899), or severe (>=55 mmHg, +0.3491475). magent does not parse a PA pressure number.
- `extracardiac_arteriopathy` (boolean, required): true if extracardiac arteriopathy is present (Nashef 2012 Table 6 ECA +0.5360268). true or false.
- `poor_mobility` (boolean, required): true if severe impairment of mobility secondary to musculoskeletal or neurological dysfunction (Nashef 2012 Table 6 N/M mob +0.2407181). true or false.
- `previous_cardiac_surgery` (boolean, required): true if one or more previous major cardiac operations involving opening the pericardium (Nashef 2012 Table 6 redo +1.118599). true or false.
- `chronic_lung_disease` (boolean, required): true if chronic pulmonary dysfunction is present (Nashef 2012 Table 6 CPD +0.1886564). true or false.
- `active_endocarditis` (boolean, required): true if still on antibiotic treatment for endocarditis at the time of surgery (Nashef 2012 Table 6 AE +0.6194522). true or false.
- `critical_preoperative_state` (boolean, required): true if a Nashef 2012 critical preoperative state is present (Table 6 +1.086517). true or false. magent does not assign this from a chart.
- `insulin_dependent_diabetes` (boolean, required): true if insulin-dependent diabetes mellitus (Nashef 2012 Table 6 IDDM +0.3542749). true or false.
- `ccs_class_4` (boolean, required): true if CCS class 4 angina (Nashef 2012 Table 6 CCS4 +0.2226147). true or false.
- `recent_mi` (boolean, required): true if myocardial infarction within 90 days before operation (Nashef 2012 Table 6 +0.1528943). true or false.
- `thoracic_aorta` (boolean, required): true if surgery on the thoracic aorta (Nashef 2012 Table 6 +0.6527205). true or false.

## Bulk (POST)

POST the same path with a JSON items array. The first item is the GET unit; each additional item is $0.002. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/euroscore_ii`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- POST of 1 item costs the same as GET. Lists longer than 25: chunk into multiple POSTs. Extra items still execute; do not pad dummy rows.
- The first invalid item fails the whole request (index in the 400 JSON). You are not charged.
- HTTP 200 is {count, path, items}. Each items[i] is the GET 200 body for that row.
- Catalog misses (empty matches, found=false) stay paid 200s inside that slot.
- x402 resource URL is this path plus n and body_sha256. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "active_endocarditis": "false",
      "age": "60",
      "ccs_class_4": "false",
      "chronic_lung_disease": "false",
      "critical_preoperative_state": "false",
      "extracardiac_arteriopathy": "false",
      "insulin_dependent_diabetes": "false",
      "lv_function": "good",
      "nyha": "1",
      "poor_mobility": "false",
      "previous_cardiac_surgery": "false",
      "pulmonary_hypertension": "none",
      "recent_mi": "false",
      "renal": "cc_gt_85",
      "sex": "male",
      "thoracic_aorta": "false",
      "urgency": "elective",
      "weight_of_procedure": "isolated_cabg"
    },
    {
      "active_endocarditis": "false",
      "age": "60",
      "ccs_class_4": "false",
      "chronic_lung_disease": "false",
      "critical_preoperative_state": "false",
      "extracardiac_arteriopathy": "false",
      "insulin_dependent_diabetes": "false",
      "lv_function": "good",
      "nyha": "1",
      "poor_mobility": "false",
      "previous_cardiac_surgery": "false",
      "pulmonary_hypertension": "none",
      "recent_mi": "false",
      "renal": "cc_gt_85",
      "sex": "male",
      "thoracic_aorta": "false",
      "urgency": "elective",
      "weight_of_procedure": "isolated_cabg"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/euroscore-ii

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/euroscore_ii",
  "items": [
    {
      "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.",
      "citation": {
        "authors": "Nashef SAM, Roques F, Sharples LD, Nilsson J, Smith C, Goldstone AR, Lockowandt U",
        "doi": "10.1093/ejcts/ezs043",
        "id": "nashef-2012",
        "pmid": "22378855",
        "source": "Eur J Cardiothorac Surg. 2012;41(4):734-745",
        "title": "EuroSCORE II"
      },
      "formula": "euroscore_ii",
      "formula_expression": "y = -5.324537 + 0.0285181*age_step + female + renal + extracardiac_arteriopathy + poor_mobility + previous_cardiac_surgery + chronic_lung_disease + active_endocarditis + critical_preoperative_state + insulin_dependent_diabetes + nyha + ccs_class_4 + lv_function + recent_mi + pulmonary_hypertension + urgency + weight_of_procedure + thoracic_aorta (Nashef 2012 Table 6 multivariable); age_step = 1 if age <= 60 else (age - 59); female 0.2196434; renal cc_gt_85 0, cc_51_85 0.303553, cc_le_50 0.8592256, dialysis 0.6421508; extracardiac_arteriopathy 0.5360268; poor_mobility 0.2407181; previous_cardiac_surgery 1.118599; chronic_lung_disease 0.1886564; active_endocarditis 0.6194522; critical_preoperative_state 1.086517; insulin_dependent_diabetes 0.3542749; nyha 1 0, 2 0.1070545, 3 0.2958358, 4 0.5597929; ccs_class_4 0.2226147; lv_function good 0, moderate 0.3150652, poor 0.8084096, very_poor 0.9346919; recent_mi 0.1528943; pulmonary_hypertension none 0, moderate 0.1788899, severe 0.3491475; urgency elective 0, urgent 0.3174673, emergency 0.7039121, salvage 1.362947; weight_of_procedure isolated_cabg 0, single_non_cabg 0.0062118, two 0.5521478, three_plus 0.9724533; thoracic_aorta 0.6527205; estimated_probability_percent = 100 * exp(y) / (1 + exp(y))",
      "age_years": 60,
      "sex": "male",
      "chronic_lung_disease": false,
      "estimated_probability_percent": 0.5,
      "logit": -5.296,
      "age_step": 1,
      "active_endocarditis": false,
      "ccs_class_4": false,
      "critical_preoperative_state": false,
      "extracardiac_arteriopathy": false,
      "insulin_dependent_diabetes": false,
      "lv_function": "good",
      "nyha": 1,
      "poor_mobility": false,
      "previous_cardiac_surgery": false,
      "pulmonary_hypertension": "none",
      "recent_mi": false,
      "renal": "cc_gt_85",
      "thoracic_aorta": false,
      "urgency": "elective",
      "weight_of_procedure": "isolated_cabg"
    },
    {
      "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.",
      "citation": {
        "authors": "Nashef SAM, Roques F, Sharples LD, Nilsson J, Smith C, Goldstone AR, Lockowandt U",
        "doi": "10.1093/ejcts/ezs043",
        "id": "nashef-2012",
        "pmid": "22378855",
        "source": "Eur J Cardiothorac Surg. 2012;41(4):734-745",
        "title": "EuroSCORE II"
      },
      "formula": "euroscore_ii",
      "formula_expression": "y = -5.324537 + 0.0285181*age_step + female + renal + extracardiac_arteriopathy + poor_mobility + previous_cardiac_surgery + chronic_lung_disease + active_endocarditis + critical_preoperative_state + insulin_dependent_diabetes + nyha + ccs_class_4 + lv_function + recent_mi + pulmonary_hypertension + urgency + weight_of_procedure + thoracic_aorta (Nashef 2012 Table 6 multivariable); age_step = 1 if age <= 60 else (age - 59); female 0.2196434; renal cc_gt_85 0, cc_51_85 0.303553, cc_le_50 0.8592256, dialysis 0.6421508; extracardiac_arteriopathy 0.5360268; poor_mobility 0.2407181; previous_cardiac_surgery 1.118599; chronic_lung_disease 0.1886564; active_endocarditis 0.6194522; critical_preoperative_state 1.086517; insulin_dependent_diabetes 0.3542749; nyha 1 0, 2 0.1070545, 3 0.2958358, 4 0.5597929; ccs_class_4 0.2226147; lv_function good 0, moderate 0.3150652, poor 0.8084096, very_poor 0.9346919; recent_mi 0.1528943; pulmonary_hypertension none 0, moderate 0.1788899, severe 0.3491475; urgency elective 0, urgent 0.3174673, emergency 0.7039121, salvage 1.362947; weight_of_procedure isolated_cabg 0, single_non_cabg 0.0062118, two 0.5521478, three_plus 0.9724533; thoracic_aorta 0.6527205; estimated_probability_percent = 100 * exp(y) / (1 + exp(y))",
      "age_years": 60,
      "sex": "male",
      "chronic_lung_disease": false,
      "estimated_probability_percent": 0.5,
      "logit": -5.296,
      "age_step": 1,
      "active_endocarditis": false,
      "ccs_class_4": false,
      "critical_preoperative_state": false,
      "extracardiac_arteriopathy": false,
      "insulin_dependent_diabetes": false,
      "lv_function": "good",
      "nyha": 1,
      "poor_mobility": false,
      "previous_cardiac_surgery": false,
      "pulmonary_hypertension": "none",
      "recent_mi": false,
      "renal": "cc_gt_85",
      "thoracic_aorta": false,
      "urgency": "elective",
      "weight_of_procedure": "isolated_cabg"
    }
  ]
}
```

## Response fields

- `formula` (string): euroscore_ii
- `formula_expression` (string): Nashef 2012 Table 6 logistic expression
- `age_years` (integer): Input age in years
- `age_step` (integer): Nashef 2012 age encoding: 1 if age <= 60, else age - 59
- `sex` (string): male or female
- `renal` (string): cc_gt_85, cc_51_85, cc_le_50, or dialysis
- `nyha` (integer): NYHA class 1-4
- `lv_function` (string): good, moderate, poor, or very_poor
- `urgency` (string): elective, urgent, emergency, or salvage
- `weight_of_procedure` (string): isolated_cabg, single_non_cabg, two, or three_plus
- `pulmonary_hypertension` (string): none, moderate, or severe
- `extracardiac_arteriopathy` (boolean): true if extracardiac arteriopathy
- `poor_mobility` (boolean): true if poor mobility
- `previous_cardiac_surgery` (boolean): true if previous cardiac surgery
- `chronic_lung_disease` (boolean): true if chronic pulmonary dysfunction
- `active_endocarditis` (boolean): true if active endocarditis
- `critical_preoperative_state` (boolean): true if critical preoperative state
- `insulin_dependent_diabetes` (boolean): true if insulin-dependent diabetes
- `ccs_class_4` (boolean): true if CCS class 4 angina
- `recent_mi` (boolean): true if MI within 90 days
- `thoracic_aorta` (boolean): true if surgery on the thoracic aorta
- `logit` (number): Nashef 2012 Table 6 linear predictor y, 4 decimal places
- `estimated_probability_percent` (number): 100 * exp(y) / (1 + exp(y)) from the unrounded logit, 2 decimal places. Estimated in-hospital mortality percent, not a clearance.
- `citation` (object): Nashef et al. EuroSCORE II 2012 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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.",
  "citation": {
    "authors": "Nashef SAM, Roques F, Sharples LD, Nilsson J, Smith C, Goldstone AR, Lockowandt U",
    "doi": "10.1093/ejcts/ezs043",
    "id": "nashef-2012",
    "pmid": "22378855",
    "source": "Eur J Cardiothorac Surg. 2012;41(4):734-745",
    "title": "EuroSCORE II"
  },
  "formula": "euroscore_ii",
  "formula_expression": "y = -5.324537 + 0.0285181*age_step + female + renal + extracardiac_arteriopathy + poor_mobility + previous_cardiac_surgery + chronic_lung_disease + active_endocarditis + critical_preoperative_state + insulin_dependent_diabetes + nyha + ccs_class_4 + lv_function + recent_mi + pulmonary_hypertension + urgency + weight_of_procedure + thoracic_aorta (Nashef 2012 Table 6 multivariable); age_step = 1 if age <= 60 else (age - 59); female 0.2196434; renal cc_gt_85 0, cc_51_85 0.303553, cc_le_50 0.8592256, dialysis 0.6421508; extracardiac_arteriopathy 0.5360268; poor_mobility 0.2407181; previous_cardiac_surgery 1.118599; chronic_lung_disease 0.1886564; active_endocarditis 0.6194522; critical_preoperative_state 1.086517; insulin_dependent_diabetes 0.3542749; nyha 1 0, 2 0.1070545, 3 0.2958358, 4 0.5597929; ccs_class_4 0.2226147; lv_function good 0, moderate 0.3150652, poor 0.8084096, very_poor 0.9346919; recent_mi 0.1528943; pulmonary_hypertension none 0, moderate 0.1788899, severe 0.3491475; urgency elective 0, urgent 0.3174673, emergency 0.7039121, salvage 1.362947; weight_of_procedure isolated_cabg 0, single_non_cabg 0.0062118, two 0.5521478, three_plus 0.9724533; thoracic_aorta 0.6527205; estimated_probability_percent = 100 * exp(y) / (1 + exp(y))",
  "age_years": 60,
  "sex": "male",
  "chronic_lung_disease": false,
  "estimated_probability_percent": 0.5,
  "logit": -5.296,
  "age_step": 1,
  "active_endocarditis": false,
  "ccs_class_4": false,
  "critical_preoperative_state": false,
  "extracardiac_arteriopathy": false,
  "insulin_dependent_diabetes": false,
  "lv_function": "good",
  "nyha": 1,
  "poor_mobility": false,
  "previous_cardiac_surgery": false,
  "pulmonary_hypertension": "none",
  "recent_mi": false,
  "renal": "cc_gt_85",
  "thoracic_aorta": false,
  "urgency": "elective",
  "weight_of_procedure": "isolated_cabg"
}
```

## Errors

- HTTP 400 `invalid_euroscore_ii`: EuroSCORE II needs Nashef 2012 cardiac-surgery predictors in published ranges. Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [ACEF II](https://magentlab.com/docs/acef-ii) — Compute the Ranucci 2018 ACEF II score from age, left-ventricular ejection fraction, serum creatinine, emergency surgery, and hematocrit.

## Payment

Unpaid requests return HTTP 402 even if query parameters or POST items are missing or invalid, so CDP and agents can index the path. After a PAYMENT-SIGNATURE, invalid params return HTTP 400 JSON before settlement. magent does not charge. Fix the params, then request a new 402 quote for that complete URL. Catalog misses (empty matches, found=false) are valid paid 200s.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/docs/mcp

## Guarantees

- HTTP 402 is unpaid, including a missing query. After PAYMENT-SIGNATURE, invalid parameters return HTTP 400 before settlement. You are not charged. HTTP 402 never includes the tool JSON.
- exact: settlement finishes before the tool (paymentFlow upfront). batch-settlement: verify/deposit before the tool; chargedCumulativeAmount commits after HTTP 2xx. Uncertain or failed settlement fails closed (HTTP 503). Retry the same PAYMENT-SIGNATURE.
- HTTP 402 is unpaid only. Do not sign a second authorization because of a 503.
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are stored encrypted for allowlisted operators (Magent Console). They are not in public logs, SSH lookups, catalog, or rollups. Request logs store path without query.
