Compute and return the Machine Credit Rating for a single machine DID.
Documentation Index
Fetch the complete documentation index at: https://docs.peaq.xyz/llms.txt
Use this file to discover all available pages before exploring further.
MCR_CACHE_TTL env var (defaults to 3600 seconds; set MCR_CACHE_TTL=0 to disable caching). Responses are not cached when mcr_degraded is true: the server retries upstream FX sources on the next request rather than pinning a conservative score.
did:peaq:0x...) or raw EVM address (0x...).| Field | Type | Description |
|---|---|---|
did | string | The DID as supplied in the request path |
machine_id | integer | On-chain machine ID resolved from the DID |
mcr_score | integer | MCR score 0-100. 0 when the rating is Provisioned (not enough history to score) or NR (unbonded). |
mcr | string | Letter rating: AAA, AA, A, BBB, BB, B, NR, or Provisioned |
mcr_degraded | boolean | true if any event in the score window came from a degraded FX path (stale snapshot or upstream FX outage). Distinguishes a conservative score caused by infra degradation from a machine with no revenue history. Degraded responses bypass the cache so the next request retries fresh FX. |
bond_status | string | "bonded" or "unbonded" |
negative_flag | boolean | true when the AdminFlags contract has a negative-flag timestamp set for this machine (and the value is in the plausible range 2020-01-01 ≤ ts ≤ now+1 day). The MCR scoring penalty only applies while the flag is within its active window, but this field stays true for as long as the timestamp is recorded on-chain. |
event_count | integer | Total events stored on-chain for this machine |
revenue_event_count | integer | Number of revenue events (event_type 0) over the machine’s full event history. |
activity_event_count | integer | Number of activity events (event_type 1) over the machine’s full event history. |
revenue_trend | string | "up", "stable", "down", or "insufficient" (returned when there isn’t enough revenue history to compute a trend). |
total_revenue | integer | Sum of qualifying revenue-event values, in USD cents. Only events meeting the per-event qualifying threshold are summed; daily aggregation for the MCR score uses a separate qualifying threshold. |
average_revenue_per_event | number | Mean value per qualifying revenue event, in USD cents, rounded to 2 decimals. Divides only by events that meet the per-event qualifying threshold, so the divisor can be smaller than revenue_event_count. 0 if no qualifying events. |
last_updated | integer or null | Unix timestamp of the most recent event. null if no events exist. |
mcr: AAA, AA, A, BBB, BB, B, NR, or Provisioned.
Unbonded machines return a rating of NR with mcr_score: 0. Bonded machines that have not yet accumulated enough history return a rating of Provisioned with mcr_score: 0.
| Status | detail | Condition |
|---|---|---|
| 400 | "Empty DID" | Path parameter resolves to an empty string |
| 400 | "Invalid Ethereum address format" | DID or address does not match the expected hex format |
| 404 | "Machine DID not found" | DID address has no machineId attribute in the DID registry |
| 404 | "Machine not registered" | Machine ID is not present in the IdentityRegistry contract |
| 503 | "Service not initialised" | Server started without contract addresses |
| 503 | "Chain unavailable" | RPC call failed during any chain read |
/machine/{did}, resolved by NFT token ID.