## Health API

*whether quotes and swaps can be served*

One cached object: router status, what the builder can build, and the price table's age. `getHealth` is the validator's health, on [RPC](https://carbium.sh/docs/rpc.md).

```
# Health  the quote plane's own readiness, not the validator's.
curl https://services.carbium.sh -H 'content-type: application/json' -H 'x-api-key: <YOUR_KEY>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"health"}'
# -> HTTP 200, x-request-id ec90d3837b9d339ee18c97bd19e769d2
# {"jsonrpc":"2.0","id":1,"result":{"ok":true,"quoteUpstream":true,"canBuild":true,
#   "families":["r-amm","r-cpmm","r-clmm","r-lpad","o-whirlpool","o-orca-v1","o-orca-v2","m-dlmm","m-damm","m-damm-v2","m-dbc","m-dbc-hook","pump-curve","pump-amm","manifest","pancakeswap-v3","byreal"],
#   "poolStore":true,"chainRpc":true,"priced":4202,"total":4202,"stale":0,"tableAgeSecs":14,"quote_refusal_ratio":0.0000}}
#
# getHealth on this same door is the VALIDATOR's liveness. A different question:
# -> {"jsonrpc":"2.0","result":"ok","id":1}
```

### result

| field | type | meaning |
|---|---|---|
| **params · none** |  |  |
| **result · always all eleven fields** |  |  |
| ok | boolean | router healthy and builder can build |
| quoteUpstream | boolean | router answered healthy; false with counts filled in: it answered degraded |
| canBuild | boolean | builder answered and can build |
| families[] | array | venue family labels the builder can build; labels, never addresses |
| poolStore | boolean | builder reached its pool store |
| chainRpc | boolean | builder reached its validator RPC |
| priced | number | priced rows in the table |
| total | number | rows in the table |
| stale | number | rows marked stale |
| tableAgeSecs | number | seconds since the last table rebuild |
| quote_refusal_ratio | number | refused over quotes sent to the router from this endpoint, last 15 minutes; 0 if none were sent |

> A dependency that is down still answers HTTP `200`. Router down: `ok` and `quoteUpstream` false, counts 0. Builder down: `canBuild` false, `families` empty. Every value is a boolean, a count or a label checked for length and alphabet.

> `health` draws nothing from your quote plan. Cached `2 s`.

### refusals

| http | code | message | what to do |
|---|---|---|---|
| 400 | -32602 | quote is not batchable | one call per request |
| 503 | -32011 | quote plane upstream not configured | no router connected |

> Needs the QUOTE scope and quote module. Key, scope, module and rate limit are checked first.

### methods

#### health

0 credits

```
{"jsonrpc":"2.0","id":1,"method":"health"}
```

**answer**: {ok, quoteUpstream, canBuild, families: [], poolStore, chainRpc, priced, total, stale, tableAgeSecs, quote_refusal_ratio}

**refuses**: 403 -32050 the account lacks the quote module; 401 -32001 the key lacks the quote scope; 400 -32602 sent in a batch
