# GARFIELD-AF 1-year mortality

GARFIELD-AF

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/garfield_af`
HTML: https://magentlab.com/docs/garfield-af
Markdown: https://magentlab.com/docs/garfield-af.md

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

## What it computes

Compute the Fox 2017 GARFIELD-AF 1-year all-cause mortality, ischaemic stroke/systemic embolism, and major bleed percents from age, sex, weight, pulse, diastolic blood pressure, comorbidities, smoking, caller-assigned ethnicity, oral anticoagulant class, carotid occlusive disease, and antiplatelet therapy.

## When to use

When an agent already has those Fox 2017 / GARFIELD-AF registry inputs and needs the published 1-year equations, not CHA2DS2-VASc or HAS-BLED scores, and not an anticoagulation order.

## When not to use

- Not a medical device and not a diagnosis. Not an anticoagulation, antiplatelet, or treatment-allocation order.
- Ethnicity is caller-assigned using the Fox 2017 / GARFIELD-AF terms (White/Caucasian reference; Hispanic/Latino; Asian; Black/Mixed/Other). magent does not assign race or ethnicity.
- 1-year GARFIELD-AF registry equations only (same linear predictors as the published 2- and 3-year equations; magent emits the 1-year baseline survival). Not CHA2DS2-VASc and not HAS-BLED.
- Oral anticoagulant class is caller-assigned none, NOAC, or VKA (mutually exclusive). magent does not choose an anticoagulant.
- Derivation used the GARFIELD-AF registry. magent does not apply later recalibrations and does not examine the patient.

## Formula

```
mortality_1y_percent = 100*(1-0.962450119**exp(lp_mort)); lp_mort = 0.306202287*female + 0.693789082*heart_failure + 0.306120964*vascular_disease + 0.26585298*prior_stroke + 0.385407386*history_of_bleeding + 0.280133213*diabetes + 0.377903886*moderate_to_severe_ckd + 0.489453313*dementia + 0.345481149*current_smoking - 0.414591263*oac_noac - 0.18593561*oac_vka + 0.157023564*ethnicity_hispanic_latino - 0.609609055*ethnicity_asian + 0.375675102*ethnicity_black_mixed_other + 0.031050027*(age-65) if age<=65 + 0.064594824*(age-65) if age>65 - 0.021535182*(weight_kg-75) if weight_kg<=75 + 0.007678035*(pulse-120) if pulse<=120 - 0.019304333*(dbp-80) if dbp<=80; stroke_1y_percent = 100*(1-0.987574311**exp(lp_stroke)); lp_stroke = 0.233182644*heart_failure + 0.197919709*vascular_disease + 0.800863063*prior_stroke + 0.29883967*history_of_bleeding + 0.211995445*diabetes + 0.349516938*moderate_to_severe_ckd + 0.513221391*dementia + 0.478831506*current_smoking - 0.572199357*oac_noac - 0.352373263*oac_vka + 0.039138147*(age-65) + 0.01590016*(dbp-80) if dbp>80; bleed_1y_percent = 100*(1-0.991720115**exp(lp_bleed)); lp_bleed = 0.168950627*vascular_disease + 0.782237771*history_of_bleeding + 0.316245771*carotid_occlusive_disease + 0.498686574*moderate_to_severe_ckd + 0.24232543*oac_noac + 0.609713354*oac_vka + 0.236620846*antiplatelet + 0.176898047*diabetes + 0.043476276*(age-65) + 0.004167103*(pulse-120); Fox 2017 / GARFIELD-AF 1-year equations; White/Caucasian ethnicity reference 0; magent does not assign race or ethnicity
```

## Citation

[Improved risk stratification of patients with atrial fibrillation: an integrated GARFIELD-AF tool for the prediction of mortality, stroke and bleed in patients with and without anticoagulation](https://doi.org/10.1136/bmjopen-2017-017157)
Fox KAA, Lucas JE, Pieper KS, et al.
BMJ Open. 2017;7(12):e017157
DOI: [10.1136/bmjopen-2017-017157](https://doi.org/10.1136/bmjopen-2017-017157)

## Worked example

### Age 65, male, weight 75 kg, pulse 70, DBP 80, no flags, OAC none, White

Given: `age=65, antiplatelet=false, carotid_occlusive_disease=false, current_smoking=false, dementia=false, diabetes=false, diastolic_bp_mm_hg=80, ethnicity=white, heart_failure=false, history_of_bleeding=false, moderate_to_severe_ckd=false, oac=none, prior_stroke=false, pulse=70, sex=male, vascular_disease=false, weight_kg=75`

1. female 0; all comorbidity flags false; current_smoking false; oac none; ethnicity white; age 65; weight_kg 75; diastolic_bp_mm_hg 80
2. mortality LP = 0.007678035*(70-120) = -0.38390175 (other terms 0)
3. mortality_1y_percent = 100*(1-0.962450119**exp(lp)), 1 decimal
4. stroke LP = 0; bleed LP = 0.004167103*(70-120)


### Age 75, otherwise the age-65 example

Given: `age=75, antiplatelet=false, carotid_occlusive_disease=false, current_smoking=false, dementia=false, diabetes=false, diastolic_bp_mm_hg=80, ethnicity=white, heart_failure=false, history_of_bleeding=false, moderate_to_severe_ckd=false, oac=none, prior_stroke=false, pulse=70, sex=male, vascular_disease=false, weight_kg=75`

1. same flags, weight, pulse, and DBP as the age-65 example; age>65 mortality term 0.064594824*(75-65)
2. mortality_1y_percent from the unrounded mortality LP, 1 decimal


## Also searched as

- GARFIELD-AF
- GARFIELD AF risk tool
- Fox 2017 AF mortality
- atrial fibrillation mortality stroke bleed
- GARFIELD-AF 1-year risk
- integrated GARFIELD-AF tool

## Parameters

- `age` (integer, required): Age in years (integer 18-120). Fox 2017 / GARFIELD-AF: mortality uses 0.031050027*(age-65) when age<=65 and 0.064594824*(age-65) when age>65. Stroke and bleed use 0.039138147*(age-65) and 0.043476276*(age-65) with no knot.
- `sex` (string, required): Sex as recorded (female or male). Fox 2017 female sex adds 0.306202287 to the mortality linear predictor. Stroke and bleed equations have no sex term.
- `weight_kg` (number, required): Weight in kg (20-300). Mortality: -0.021535182*(weight_kg-75) when weight_kg<=75; 0 when weight_kg>75. magent does not convert lb.
- `pulse` (number, required): Pulse in beats per minute (30-250). Mortality: 0.007678035*(pulse-120) when pulse<=120; 0 when pulse>120. Bleed uses 0.004167103*(pulse-120) with no truncation.
- `diastolic_bp_mm_hg` (number, required): Diastolic blood pressure in mm Hg (30-150). Mortality: -0.019304333*(dbp-80) when dbp<=80; 0 when dbp>80. Stroke: 0.01590016*(dbp-80) when dbp>80; 0 when dbp<=80.
- `heart_failure` (boolean, required): Caller-assigned heart failure (true or false). Mortality +0.693789082; stroke +0.233182644. magent does not diagnose heart failure.
- `vascular_disease` (boolean, required): Caller-assigned vascular disease (true or false). Mortality +0.306120964; stroke +0.197919709; bleed +0.168950627.
- `prior_stroke` (boolean, required): Caller-assigned prior stroke (true or false). Mortality +0.26585298; stroke +0.800863063.
- `history_of_bleeding` (boolean, required): Caller-assigned history of bleeding (true or false). Mortality +0.385407386; stroke +0.29883967; bleed +0.782237771.
- `diabetes` (boolean, required): Caller-assigned diabetes (true or false). Mortality +0.280133213; stroke +0.211995445; bleed +0.176898047.
- `moderate_to_severe_ckd` (boolean, required): Caller-assigned moderate-to-severe chronic kidney disease (true or false). Mortality +0.377903886; stroke +0.349516938; bleed +0.498686574. magent does not compute eGFR.
- `dementia` (boolean, required): Caller-assigned dementia (true or false). Mortality +0.489453313; stroke +0.513221391.
- `current_smoking` (boolean, required): Caller-assigned current smoking (true or false). Mortality +0.345481149; stroke +0.478831506.
- `oac` (string, required): Caller-assigned oral anticoagulant class: none, noac, or vka (mutually exclusive). NOAC and VKA enter as separate Fox 2017 terms. magent does not choose an anticoagulant.
- `ethnicity` (string, required): Caller-assigned ethnicity using Fox 2017 / GARFIELD-AF terms. white (White/Caucasian) is the mortality reference (0); hispanic_latino +0.157023564; asian -0.609609055; black_mixed_other +0.375675102. Stroke and bleed have no ethnicity term. magent does not assign race or ethnicity.
- `carotid_occlusive_disease` (boolean, required): Caller-assigned carotid occlusive disease (true or false). Bleed +0.316245771. Mortality and stroke have no carotid term.
- `antiplatelet` (boolean, required): Caller-assigned antiplatelet therapy (true or false). Bleed +0.236620846. Mortality and stroke have no antiplatelet term. magent does not order antiplatelet therapy.

## 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/garfield_af`
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": [
    {
      "age": "65",
      "antiplatelet": "false",
      "carotid_occlusive_disease": "false",
      "current_smoking": "false",
      "dementia": "false",
      "diabetes": "false",
      "diastolic_bp_mm_hg": "80",
      "ethnicity": "white",
      "heart_failure": "false",
      "history_of_bleeding": "false",
      "moderate_to_severe_ckd": "false",
      "oac": "none",
      "prior_stroke": "false",
      "pulse": "70",
      "sex": "male",
      "vascular_disease": "false",
      "weight_kg": "75"
    },
    {
      "age": "65",
      "antiplatelet": "false",
      "carotid_occlusive_disease": "false",
      "current_smoking": "false",
      "dementia": "false",
      "diabetes": "false",
      "diastolic_bp_mm_hg": "80",
      "ethnicity": "white",
      "heart_failure": "false",
      "history_of_bleeding": "false",
      "moderate_to_severe_ckd": "false",
      "oac": "none",
      "prior_stroke": "false",
      "pulse": "70",
      "sex": "male",
      "vascular_disease": "false",
      "weight_kg": "75"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/garfield_af",
  "items": [
    {
      "age": 65,
      "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": "Fox KAA, Lucas JE, Pieper KS, et al.",
        "doi": "10.1136/bmjopen-2017-017157",
        "id": "fox-2017-garfield-af",
        "pmid": "29273652",
        "source": "BMJ Open. 2017;7(12):e017157",
        "title": "Improved risk stratification of patients with atrial fibrillation: an integrated GARFIELD-AF tool for the prediction of mortality, stroke and bleed in patients with and without anticoagulation"
      },
      "formula": "garfield_af",
      "formula_expression": "mortality_1y_percent = 100*(1-0.962450119**exp(lp_mort)); lp_mort = 0.306202287*female + 0.693789082*heart_failure + 0.306120964*vascular_disease + 0.26585298*prior_stroke + 0.385407386*history_of_bleeding + 0.280133213*diabetes + 0.377903886*moderate_to_severe_ckd + 0.489453313*dementia + 0.345481149*current_smoking - 0.414591263*oac_noac - 0.18593561*oac_vka + 0.157023564*ethnicity_hispanic_latino - 0.609609055*ethnicity_asian + 0.375675102*ethnicity_black_mixed_other + 0.031050027*(age-65) if age<=65 + 0.064594824*(age-65) if age>65 - 0.021535182*(weight_kg-75) if weight_kg<=75 + 0.007678035*(pulse-120) if pulse<=120 - 0.019304333*(dbp-80) if dbp<=80; stroke_1y_percent = 100*(1-0.987574311**exp(lp_stroke)); lp_stroke = 0.233182644*heart_failure + 0.197919709*vascular_disease + 0.800863063*prior_stroke + 0.29883967*history_of_bleeding + 0.211995445*diabetes + 0.349516938*moderate_to_severe_ckd + 0.513221391*dementia + 0.478831506*current_smoking - 0.572199357*oac_noac - 0.352373263*oac_vka + 0.039138147*(age-65) + 0.01590016*(dbp-80) if dbp>80; bleed_1y_percent = 100*(1-0.991720115**exp(lp_bleed)); lp_bleed = 0.168950627*vascular_disease + 0.782237771*history_of_bleeding + 0.316245771*carotid_occlusive_disease + 0.498686574*moderate_to_severe_ckd + 0.24232543*oac_noac + 0.609713354*oac_vka + 0.236620846*antiplatelet + 0.176898047*diabetes + 0.043476276*(age-65) + 0.004167103*(pulse-120); Fox 2017 / GARFIELD-AF 1-year equations; White/Caucasian ethnicity reference 0; magent does not assign race or ethnicity",
      "heart_failure": false,
      "weight_kg": 75.0,
      "sex": "male",
      "diabetes": false,
      "oac": "none",
      "ethnicity": "white",
      "pulse": 70.0,
      "antiplatelet": false,
      "bleed_1y_percent": 0.7,
      "bleed_lp": -0.20835515,
      "carotid_occlusive_disease": false,
      "current_smoking": false,
      "dementia": false,
      "diastolic_bp_mm_hg": 80.0,
      "history_of_bleeding": false,
      "moderate_to_severe_ckd": false,
      "mortality_1y_percent": 2.6,
      "mortality_lp": -0.38390175,
      "prior_stroke": false,
      "stroke_1y_percent": 1.2,
      "stroke_lp": 0.0,
      "vascular_disease": false
    },
    {
      "age": 65,
      "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": "Fox KAA, Lucas JE, Pieper KS, et al.",
        "doi": "10.1136/bmjopen-2017-017157",
        "id": "fox-2017-garfield-af",
        "pmid": "29273652",
        "source": "BMJ Open. 2017;7(12):e017157",
        "title": "Improved risk stratification of patients with atrial fibrillation: an integrated GARFIELD-AF tool for the prediction of mortality, stroke and bleed in patients with and without anticoagulation"
      },
      "formula": "garfield_af",
      "formula_expression": "mortality_1y_percent = 100*(1-0.962450119**exp(lp_mort)); lp_mort = 0.306202287*female + 0.693789082*heart_failure + 0.306120964*vascular_disease + 0.26585298*prior_stroke + 0.385407386*history_of_bleeding + 0.280133213*diabetes + 0.377903886*moderate_to_severe_ckd + 0.489453313*dementia + 0.345481149*current_smoking - 0.414591263*oac_noac - 0.18593561*oac_vka + 0.157023564*ethnicity_hispanic_latino - 0.609609055*ethnicity_asian + 0.375675102*ethnicity_black_mixed_other + 0.031050027*(age-65) if age<=65 + 0.064594824*(age-65) if age>65 - 0.021535182*(weight_kg-75) if weight_kg<=75 + 0.007678035*(pulse-120) if pulse<=120 - 0.019304333*(dbp-80) if dbp<=80; stroke_1y_percent = 100*(1-0.987574311**exp(lp_stroke)); lp_stroke = 0.233182644*heart_failure + 0.197919709*vascular_disease + 0.800863063*prior_stroke + 0.29883967*history_of_bleeding + 0.211995445*diabetes + 0.349516938*moderate_to_severe_ckd + 0.513221391*dementia + 0.478831506*current_smoking - 0.572199357*oac_noac - 0.352373263*oac_vka + 0.039138147*(age-65) + 0.01590016*(dbp-80) if dbp>80; bleed_1y_percent = 100*(1-0.991720115**exp(lp_bleed)); lp_bleed = 0.168950627*vascular_disease + 0.782237771*history_of_bleeding + 0.316245771*carotid_occlusive_disease + 0.498686574*moderate_to_severe_ckd + 0.24232543*oac_noac + 0.609713354*oac_vka + 0.236620846*antiplatelet + 0.176898047*diabetes + 0.043476276*(age-65) + 0.004167103*(pulse-120); Fox 2017 / GARFIELD-AF 1-year equations; White/Caucasian ethnicity reference 0; magent does not assign race or ethnicity",
      "heart_failure": false,
      "weight_kg": 75.0,
      "sex": "male",
      "diabetes": false,
      "oac": "none",
      "ethnicity": "white",
      "pulse": 70.0,
      "antiplatelet": false,
      "bleed_1y_percent": 0.7,
      "bleed_lp": -0.20835515,
      "carotid_occlusive_disease": false,
      "current_smoking": false,
      "dementia": false,
      "diastolic_bp_mm_hg": 80.0,
      "history_of_bleeding": false,
      "moderate_to_severe_ckd": false,
      "mortality_1y_percent": 2.6,
      "mortality_lp": -0.38390175,
      "prior_stroke": false,
      "stroke_1y_percent": 1.2,
      "stroke_lp": 0.0,
      "vascular_disease": false
    }
  ]
}
```

## Response fields

- `formula` (string): garfield_af
- `formula_expression` (string): Fox 2017 / GARFIELD-AF 1-year mortality, stroke, and bleed equations
- `age` (integer): Input age in years
- `sex` (string): female or male used
- `weight_kg` (number): Input weight in kg
- `pulse` (number): Input pulse in beats per minute
- `diastolic_bp_mm_hg` (number): Input diastolic blood pressure in mm Hg
- `heart_failure` (boolean): Caller-assigned heart failure
- `vascular_disease` (boolean): Caller-assigned vascular disease
- `prior_stroke` (boolean): Caller-assigned prior stroke
- `history_of_bleeding` (boolean): Caller-assigned history of bleeding
- `diabetes` (boolean): Caller-assigned diabetes
- `moderate_to_severe_ckd` (boolean): Caller-assigned moderate-to-severe CKD
- `dementia` (boolean): Caller-assigned dementia
- `current_smoking` (boolean): Caller-assigned current smoking
- `oac` (string): none, noac, or vka used
- `ethnicity` (string): Caller-assigned Fox 2017 ethnicity token used
- `carotid_occlusive_disease` (boolean): Caller-assigned carotid occlusive disease
- `antiplatelet` (boolean): Caller-assigned antiplatelet therapy
- `mortality_lp` (number): Unrounded all-cause mortality linear predictor, 8 decimals
- `mortality_1y_percent` (number): 1-year all-cause mortality percent from the unrounded LP and S0=0.962450119, 1 decimal. Not an anticoagulation order.
- `stroke_lp` (number): Unrounded ischaemic stroke/SE linear predictor, 8 decimals
- `stroke_1y_percent` (number): 1-year ischaemic stroke/systemic embolism percent from S0=0.987574311, 1 decimal. Not CHA2DS2-VASc.
- `bleed_lp` (number): Unrounded major-bleed linear predictor, 8 decimals
- `bleed_1y_percent` (number): 1-year major bleed (including haemorrhagic stroke) percent from S0=0.991720115, 1 decimal. Not HAS-BLED.
- `citation` (object): Fox 2017 GARFIELD-AF citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "age": 65,
  "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": "Fox KAA, Lucas JE, Pieper KS, et al.",
    "doi": "10.1136/bmjopen-2017-017157",
    "id": "fox-2017-garfield-af",
    "pmid": "29273652",
    "source": "BMJ Open. 2017;7(12):e017157",
    "title": "Improved risk stratification of patients with atrial fibrillation: an integrated GARFIELD-AF tool for the prediction of mortality, stroke and bleed in patients with and without anticoagulation"
  },
  "formula": "garfield_af",
  "formula_expression": "mortality_1y_percent = 100*(1-0.962450119**exp(lp_mort)); lp_mort = 0.306202287*female + 0.693789082*heart_failure + 0.306120964*vascular_disease + 0.26585298*prior_stroke + 0.385407386*history_of_bleeding + 0.280133213*diabetes + 0.377903886*moderate_to_severe_ckd + 0.489453313*dementia + 0.345481149*current_smoking - 0.414591263*oac_noac - 0.18593561*oac_vka + 0.157023564*ethnicity_hispanic_latino - 0.609609055*ethnicity_asian + 0.375675102*ethnicity_black_mixed_other + 0.031050027*(age-65) if age<=65 + 0.064594824*(age-65) if age>65 - 0.021535182*(weight_kg-75) if weight_kg<=75 + 0.007678035*(pulse-120) if pulse<=120 - 0.019304333*(dbp-80) if dbp<=80; stroke_1y_percent = 100*(1-0.987574311**exp(lp_stroke)); lp_stroke = 0.233182644*heart_failure + 0.197919709*vascular_disease + 0.800863063*prior_stroke + 0.29883967*history_of_bleeding + 0.211995445*diabetes + 0.349516938*moderate_to_severe_ckd + 0.513221391*dementia + 0.478831506*current_smoking - 0.572199357*oac_noac - 0.352373263*oac_vka + 0.039138147*(age-65) + 0.01590016*(dbp-80) if dbp>80; bleed_1y_percent = 100*(1-0.991720115**exp(lp_bleed)); lp_bleed = 0.168950627*vascular_disease + 0.782237771*history_of_bleeding + 0.316245771*carotid_occlusive_disease + 0.498686574*moderate_to_severe_ckd + 0.24232543*oac_noac + 0.609713354*oac_vka + 0.236620846*antiplatelet + 0.176898047*diabetes + 0.043476276*(age-65) + 0.004167103*(pulse-120); Fox 2017 / GARFIELD-AF 1-year equations; White/Caucasian ethnicity reference 0; magent does not assign race or ethnicity",
  "heart_failure": false,
  "weight_kg": 75.0,
  "sex": "male",
  "diabetes": false,
  "oac": "none",
  "ethnicity": "white",
  "pulse": 70.0,
  "antiplatelet": false,
  "bleed_1y_percent": 0.7,
  "bleed_lp": -0.20835515,
  "carotid_occlusive_disease": false,
  "current_smoking": false,
  "dementia": false,
  "diastolic_bp_mm_hg": 80.0,
  "history_of_bleeding": false,
  "moderate_to_severe_ckd": false,
  "mortality_1y_percent": 2.6,
  "mortality_lp": -0.38390175,
  "prior_stroke": false,
  "stroke_1y_percent": 1.2,
  "stroke_lp": 0.0,
  "vascular_disease": false
}
```

## Errors

- HTTP 400 `invalid_garfield_af`: GARFIELD-AF inputs must match Fox 2017 age, sex, weight, pulse, diastolic blood pressure, comorbidities, caller-assigned ethnicity, smoking, and oral anticoagulant class. 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

- [CHA2DS2-VASc](https://magentlab.com/docs/cha2ds2-vasc) — Compute the CHA2DS2-VASc stroke-risk score from discrete clinical flags.
- [HAS-BLED](https://magentlab.com/docs/has-bled) — Compute the HAS-BLED bleeding-risk score from discrete clinical flags.

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