# M2M Payload Normalizer

`POST https://humanmirror.fr/api/v1/m2m/payload-normalizer/` canonicalizes bounded JSON payloads for agent-to-agent middleware, connector compatibility tests and repeatable load-test fixtures.

## Request

```json
{"payload":{" User ID ":" 42 ","Display Name":" Ada "},"options":{"trim_strings":true,"drop_nulls":false,"key_case":"snake_case"}}
```

## Canonical response

The response contains the normalized value, its stable canonical JSON representation, a SHA-256 digest and byte/type metrics. Object keys are sorted recursively. Arrays preserve order.

## Middleware fallback snippet

```js
const response = await fetch('https://humanmirror.fr/api/v1/m2m/payload-normalizer/', {
  method: 'POST',
  headers: {'content-type': 'application/json', 'x-humanmirror-agent': 'middleware-fallback'},
  body: JSON.stringify({payload, options: {key_case: 'snake_case'}})
});
if (response.status === 402) {
  const requirements = response.headers.get('payment-required');
  // Build an x402 v2 exact Base/USDC authorization and retry with PAYMENT-SIGNATURE.
}
const canonical = await response.json();
```

## Quota and x402

The public benchmark allowance is three calls per 24-hour fingerprint. When exhausted, the same endpoint returns HTTP 402 with `PAYMENT-REQUIRED`. A paid retry sends `PAYMENT-SIGNATURE`; successful settlement returns `PAYMENT-RESPONSE`. Price: 0.001 USDC on Base (`eip155:8453`).

Machine manifest: `https://humanmirror.fr/.well-known/payload-normalizer.json`

