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

# Query Machine Credit Rating

> Fetch a machine's MCR from the peaqOS MCR API. Covers curl, JavaScript, and Python.

The MCR API (The public web service you call to fetch a machine's credit score and profile as JSON, and the one place a machine's monetization is switched on or off with a signed message. No login needed: reads are open, and the write is authorized by the signature itself.) returns a machine's credit rating (A creditworthiness score for a machine (a Moody's-style grade AAA down to NR, plus a 0-100 number) computed from its recorded earnings and activity. Like a credit score for a robot.) along with event counts (A recorded data point about a machine's work, submitted to the chain to feed its credit score. Revenue events report money earned; activity events report work with no money. NOT a ROS topic message.), revenue trend, and bond status (PEAQ locked when a machine activates, proving skin in the game. It is priced per tier in USD and converted to PEAQ at the oracle rate, and it is not withdrawable. Bonded means the deposit is in place.). It's a public read API. No authentication required.

<details><summary>Key terms in this guide</summary></details>

## Endpoint

```text theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
GET https://mcr.peaq.xyz/mcr/{did}
```

`https://mcr.peaq.xyz` is the public peaq-hosted MCR. It serves machines activated under [Economics 2.0](https://docs.peaq.xyz/peaqos/concepts/economics-2-0.md), homed on peaq or on Solana. `{did}` is the machine's DID (A globally unique, self-owned ID for a machine that lives on the chain and isn't issued by any single company. peaqID is peaq's version: did:peaq:\<machine ID as a decimal> for a machine; did:peaq:0x\<address> names an account, such as an operator.) in the form `did:peaq:<decimal machine id>`. An address DID (`did:peaq:0x...`), a raw EVM (The Ethereum Virtual Machine: the standard runtime many chains share, so the same 0x... addresses and tools work across all of them. peaq is EVM-compatible.) address, or a bare machine ID returns `400 Invalid machine DID format`. The MCR indexes a new machine and its events from chain, so right after activation a read can answer `404` (`NOT_FOUND`). Retry: in the 2026-10-16 mainnet runs the machine and its events were served within a 10-minute poll, once on the first read.

The SDK query helpers read the same server. See [API reference](https://docs.peaq.xyz/peaqos/api-reference/overview.md#machines-and-ids). For a machine homed on Solana the response adds `home_chain` (`5` for Solana) and, until the machine can be rated, a `rating_unavailable` reason.

## Fetch the MCR

```bash curl theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
curl -s "https://mcr.peaq.xyz/mcr/did:peaq:<decimal machine id>"
```

```typescript JS/TS theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
const MCR_API_URL = "https://mcr.peaq.xyz";
const machineId = "<decimal machine id>"; // keep it a string: 2.0 IDs exceed Number precision
const did = `did:peaq:${machineId}`;
const response = await fetch(
  `${MCR_API_URL}/mcr/${encodeURIComponent(did)}`
);

if (!response.ok) {
  throw new Error(`MCR API returned ${response.status}`);
}

const mcr = await response.json();
console.log("Rating:", mcr.mcr);
console.log("Score:", mcr.mcr_score);
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
import requests

MCR_API_URL = "https://mcr.peaq.xyz"
did = "did:peaq:<decimal machine id>"
response = requests.get(f"{MCR_API_URL}/mcr/{did}")
response.raise_for_status()

mcr = response.json()
print("Rating:", mcr["mcr"])
print("Score:", mcr["mcr_score"])
```

## Response shape

```json theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
{
  "did": "did:peaq:<decimal machine id>",
  "machine_id": "<decimal machine id>",
  "mcr_score": 45,
  "mcr": "BB",
  "mcr_degraded": false,
  "bond_status": "bonded",
  "negative_flag": false,
  "event_count": 12,
  "revenue_event_count": 7,
  "activity_event_count": 5,
  "revenue_trend": "stable",
  "total_revenue": 35000,
  "average_revenue_per_event": 5000.0,
  "last_updated": 1711900000
}
```

`machine_id` is a JSON string, because a 2.0 machine ID exceeds what a JavaScript number holds exactly. `total_revenue` and `average_revenue_per_event` are USD cents. Divide by 100 for display ($350 and $50 in this example). `revenue_trend` and `average_revenue_per_event` can be `null`, for example for a Solana-homed machine that is not rated yet, and the SDK query helpers type both as nullable; `null` / `None` means not computable.

A newly registered machine (Putting a machine on the network for the first time, which gives it an ID, a DID, an ownership token, and a locked deposit. On peaq this is one activateMachine call signed by the machine's owner; a machine homed on Solana runs the seven-stage onboarding.) that hasn't accumulated enough history returns `mcr: "Provisioned"` with `mcr_score: 0`. Unbonded machines return `mcr: "NR"` with `mcr_score: 0`. See [GET /mcr/\{did}](https://docs.peaq.xyz/peaqos/api-reference/get-mcr.md) for the full field reference.

## Query an operator's fleet

Use the operator endpoint to list all machines registered under a proxy operator (An account that is DID controller of many machines. Each machine owns itself and pays its own bond; the operator cannot activate a machine it does not own.), paginated with MCR scores per machine. The operator DID stays `did:peaq:0x<address>`, because it names an account, not a machine. Each entry carries its machine as `did:peaq:<decimal machine id>` with `machine_id` as a string.

```bash curl theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
curl -s "https://mcr.peaq.xyz/operator/did:peaq:0xProxyAddress/machines?offset=0&limit=20"
```

```typescript JS/TS theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
const MCR_API_URL = "https://mcr.peaq.xyz";
const operatorDid = "did:peaq:0xProxyAddress";
const response = await fetch(
  `${MCR_API_URL}/operator/${encodeURIComponent(operatorDid)}/machines?offset=0&limit=20`
);
const { machines } = await response.json();

for (const m of machines) {
  console.log(`Machine ${m.machine_id}: ${m.mcr}`);
}
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
import requests

MCR_API_URL = "https://mcr.peaq.xyz"
operator_did = "did:peaq:0xProxyAddress"
response = requests.get(
    f"{MCR_API_URL}/operator/{operator_did}/machines",
    params={"offset": 0, "limit": 20},
)
response.raise_for_status()

for m in response.json()["machines"]:
    print(f"Machine {m['machine_id']}: {m['mcr']}")
```

See [GET /operator/\{did}/machines](https://docs.peaq.xyz/peaqos/api-reference/get-operator-machines.md) for the full response shape and pagination details.

## Caching

The server applies a 1-hour TTL on MCR responses by default, configurable via the `MCR_CACHE_TTL` env var (`0` to disable). Repeat requests within the window return cached values, except for responses with `mcr_degraded: true` and responses for a Solana-homed machine, which are never cached. The `last_updated` field is the timestamp of the machine's most recent event (when it happened, not when it was submitted or indexed).

## Error handling

The MCR API returns standard HTTP status codes: `400` for malformed inputs, `404` when the DID is unregistered, `409` when the machine is homed on a chain this server cannot read, `429` (`rate_limited`) when the server's lookup budget for other chains is spent, and `503` when a chain (A shared, tamper-resistant public database maintained by a whole network of computers with no single owner. Different chains are separate such networks.) is unavailable or the machine is relocating. Bodies are JSON with a `detail` field: a string, or for `409` an object with `code`, `home_protocol_chain_id` and `message`.

If you call through the SDK (peaq's code library (Python and JS) you install to call all this functionality without writing low-level blockchain calls yourself.) (`queryMcr(client, did)` in JS / `query_mcr(client, did)` in Python), HTTP failures surface as `RuntimeError` (JS) or `ApiError` (Python). The `code` attribute carries `NOT_FOUND`, `SERVICE_UNAVAILABLE`, `SERVER_ERROR`, `TIMEOUT`, etc. A machine homed on another chain normally still answers, with `home_chain` set and a `rating_unavailable` reason until its events are indexed. HTTP 409 with the code `MACHINE_HOMED_ELSEWHERE` (`McrApiError` in JS) comes back only when the server cannot read the machine's home chain. See [SDK errors reference](https://docs.peaq.xyz/peaqos/sdk-reference/errors.md) for the full code map.

## Next steps

* [GET /mcr/\{did}](https://docs.peaq.xyz/peaqos/api-reference/get-mcr.md): full API reference for this endpoint
* [GET /machine/\{did}](https://docs.peaq.xyz/peaqos/api-reference/get-machine.md): full machine profile
* [Machine Credit Rating concept](https://docs.peaq.xyz/peaqos/concepts/machine-credit-rating.md): rating scale and lifecycle


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.