{"service":"x402 Carbon Retirement API","apiVersion":"1.3.6","versionedHosts":{"latest":"x402.klimalabs.com","current":"v1.x402.klimalabs.com","note":"The bare host serves the latest release. Pin v1.x402.klimalabs.com to stay on this major across future releases. Prior majors keep answering at their own v<major>.x402.klimalabs.com host."},"releases":[{"version":"1.3.6","releaseDate":"2026-09-25","breaking":false,"changes":[{"kind":"added","action":"quote","summary":"New `relayExecutorGas` / `relayExecutorGasFormatted` and `relayTotal` / `relayTotalFormatted`. They estimate the gas reimbursement paid to the relayer when you retire through prepare-auth + actions/retire, in the input token, and `total` plus it. `total` is unchanged and still excludes it, because prepare/retire sends from your own wallet and pays no reimbursement. The relay re-estimates gas when it submits. The fields are null when gas can't be priced; the rest of the quote is still returned."},{"kind":"added","action":"*","summary":"ECO (ERC-1155) credits are live and no longer marked \"coming soon\" in discover's `supportedCreditTypes`. One ECO token is one whole tonne, so ECO credits retire in whole tonnes only: a fractional `amount` returns 422 amount_not_whole_tonnes, as Puro credits already do, instead of being rounded down on-chain."},{"kind":"fixed","action":"*","summary":"ECO retirements no longer fail with 422 insufficient_liquidity. Quote, prepare/retire, prepare-auth and actions/retire compared the requested tonnes, scaled to 18 decimals, against ECO liquidity in whole-token units, so no amount could pass. Addressing an ECO credit by `credit` id also now resolves its real tokenId instead of 0."},{"kind":"fixed","action":"discover","summary":"ECO credits in `creditsDetailed` now carry their registry, vintage, project ids, `creditId` and project name; they were all null. Each ERC-1155 tokenId now gets its own liquidity, where credits sharing a token address previously all showed the first one's. Liquidity for every credit is now in 18-decimal tonnes, so an ECO batch of 201 tonnes reads `liquidity: \"201000000000000000000\"` / `liquidityFormatted: \"201\"` instead of `\"201\"` / `\"0.000000000000000201\"`. ECO classes now carry a price instead of null."},{"kind":"changed","action":"discover","summary":"`minRetirementTonnes` / `minRetirementTonnesFormatted` are 1 tonne for a class whose credits all retire in whole tonnes (Puro, ECO), and `minRetirementNote` says so. Other classes keep the 0.001-tonne (1 kg) protocol minimum."},{"kind":"changed","action":"*","summary":"The amount_not_whole_tonnes message names the credit's registry instead of always saying Puro. The integration guide now points at `minRetirementTonnesFormatted` as the floor for `amount`, which is in tonnes, rather than the 18-decimal `minRetirementTonnes`."}]},{"version":"1.3.5","releaseDate":"2026-09-18","breaking":false,"changes":[{"kind":"fixed","action":"*","summary":"Prepare/retire and prepare-auth are no longer described as free in the catalog (description, `endpoints.note`, `catalogNote`), the OpenAPI document (their operation descriptions and `info.description`), the well-known manifest, and /llms.txt, which also now lists retirement under Paid. Discover, quote and certificate are free; retiring is paid, costing the credit price plus a fee (and executor gas when relayed through actions/retire)."},{"kind":"changed","action":"*","summary":"Descriptions across the OpenAPI document, the well-known manifest, the catalog, /llms.txt and the error registry call the retirement charge a fee (previously protocol fee), and name the service x402 Carbon Retirement API throughout."},{"kind":"changed","action":"*","summary":"The documentation at /.well-known/x402-docs.json (GET alias /api/docs) is updated. The integration guide is rewritten for the current API (marketplace listings, the relayed prepare-auth + actions/retire path, the paid catalog). Every page states that discover, quote and certificate are free and retiring is paid. The endpoints table lists the catalog. The fee schedule now appears only in the endpoint reference, marked as current values subject to change; the live fee is always in `quote.fee`."}]},{"version":"1.3.4","releaseDate":"2026-09-18","breaking":false,"changes":[{"kind":"changed","action":"catalog","summary":"An unpaid request now gets a readable JSON 402 body instead of `{}`. It repeats the challenge from the `PAYMENT-REQUIRED` header (`x402Version`, `resource`, `accepts`, `extensions`) and adds the price, the payment header name, instructions, and links to the free endpoints (discover, quote, OpenAPI, manifest, llms.txt). The header is unchanged."},{"kind":"changed","action":"catalog","summary":"The Bazaar output example that registries show is now a real snapshot (3 carbon classes and 3 marketplace listings with prices and tonnes) instead of empty `classes` and `listings`."},{"kind":"added","action":"*","summary":"`/llms.txt`: a plain-text agent guide to the retirement flow (discover, quote, prepare/retire or prepare-auth + actions/retire, certificate) and its rules. Linked from the OpenAPI document (`x-agentcash-guidance.llmsTxtUrl`), the manifest (`service.llms`) and the GET /api index."}]},{"version":"1.3.3","releaseDate":"2026-09-17","breaking":false,"changes":[{"kind":"changed","action":"openapi","summary":"The service name x402 Carbon Retirement API is now used across every surface: GET /api/catalog's x402 serviceName (the name Bazaar listings show), the GET /api index, GET /api/health, the well-known manifest (where `service.operator` is now `Carbonmark`, previously `KlimaDAO`), the changelog and error-registry documents, and the docs index. Previously these said Klima Retirement Aggregator (or `x402-klima-ra-new` on /api/health)."}]},{"version":"1.3.2","releaseDate":"2026-09-16","breaking":false,"changes":[{"kind":"changed","action":"openapi","summary":"The OpenAPI document's `info.title` is now `x402 Carbon Retirement API`, and `info.contact.name` is now `Carbonmark`."}]},{"version":"1.3.1","releaseDate":"2026-09-16","breaking":false,"changes":[{"kind":"changed","action":"catalog","summary":"The response leads with `endpoints`, the directory for the rest of the API, ahead of the supply snapshot. Each entry is now `{ url, method }` instead of a bare URL string, so `actionsRetire` is marked `POST`, and a `manifest` entry links /.well-known/x402.json. `endpoints.note` says which endpoints are free, what a retirement costs, and links the full OpenAPI spec. In 1.3.0 each `endpoints` entry was a URL string; read `endpoints.<name>.url` instead. The snapshot's top-level `note` is renamed `catalogNote`. `classes` and `listings` are unchanged."},{"kind":"changed","action":"catalog","summary":"The route's description (shown by x402 registries and in the 402 challenge) and its OpenAPI summary now present it as the API entry point, with the supply snapshot as the add-on, and point to /api/discover, /api/quote and /openapi.json."},{"kind":"added","action":"catalog","summary":"Optional `FEATURED_PROJECTS` configuration (JSON `{ classes, listings }`): featured carbon classes, matched by class id, and marketplace listings, matched by `projectKey`, are included after the top 3. Only priced supply with liquidity appears."},{"kind":"added","action":"*","summary":"`/favicon.ico` and `/api/favicon.ico` serve the Carbonmark mark (256px PNG), which x402 registries show next to the listing."},{"kind":"changed","action":"*","summary":"The OpenAPI document's `info.contact` now includes an `email`, which registries use to verify ownership, and names KlimaProtocol."}]},{"version":"1.3.0","releaseDate":"2026-09-15","breaking":false,"changes":[{"kind":"added","action":"*","summary":"`/openapi.json`: an OpenAPI 3.1 description of every endpoint — parameters, request and response schemas, and the error codes each can return — linked from the manifest (`service.openapi`) and the /api index. x402 registries and agent tooling read it to discover the API."},{"kind":"added","action":"actions/retire","summary":"`POST /api/actions/retire`: the relayed retirement at its own path. Same request and response as `POST /api` with `action: \"actions/retire\"`; the `actionsRetireRequest` from prepare-auth can be posted to it unchanged. `POST /api` is unaffected."},{"kind":"added","action":"catalog","summary":"`GET /api/catalog`: a paid snapshot ($0.001 USDC on Base, standard x402 v2 `exact`, settled by the Coinbase facilitator) of the top 3 carbon classes by liquidity and the top 3 marketplace listings by tonnes left, with prices and links to the free quote, prepare and retire endpoints. An unpaid request returns 402 with the challenge in the `PAYMENT-REQUIRED` header; a failed response is not charged."},{"kind":"added","action":"catalog","summary":"Error code `503 payment_unavailable`: the catalog's payment is not configured on the deployment. Nothing is charged; GET /api/discover returns the full catalog for free."}]},{"version":"1.2.1","releaseDate":"2026-09-14","breaking":false,"changes":[{"kind":"fixed","action":"prepare-auth, actions/retire","summary":"Marketplace authorizations include 0.02 USDC of executor-gas headroom in `authValue`. Listings carry no slippage buffer, so a gas-price rise between prepare-auth and actions/retire made the relay's re-estimate exceed the signed value and returned 400 insufficient_authorized_value. The headroom is not spent: the settlement contract refunds everything above retirement + fee + executor gas to the payer in the same transaction. Protocol-supply authorizations are unchanged; their 4% slippage buffer already absorbs the drift."}]},{"version":"1.2.0","releaseDate":"2026-09-03","breaking":false,"changes":[{"kind":"changed","action":"*","summary":"Addresses in requests are case-insensitive. Previously `actions/retire` and `prepare-auth` compared `inputToken` to their token list exactly, so lowercase USDC or checksummed kVCM returned 400 unsupported_input_token; and an address with a wrong EIP-55 checksum passed validation, then surfaced as a misleading contract_revert. A valid checksummed or lowercase address is passed through unchanged, so responses that echo it are unaffected; only a mis-checksummed or all-uppercase address is normalized to lowercase."},{"kind":"added","action":"discover","summary":"Marketplace supply. The response gains a top-level `marketplaceListings[]` — seller-listed credits at a fixed ask, one entry per listing — alongside the existing `carbonClasses[]`. Every entry on both arrays now carries a `source` tag (\"protocol\" or \"marketplace\"), and `marketplaceEnabled` in the envelope distinguishes a disabled marketplace from one with no open listings. Purely additive: existing `carbonClasses[]` fields are unchanged."},{"kind":"added","action":"discover","summary":"Per-credit descriptive attributes (project, country, region, category, methodology, vintage), joined from each credit's own project metadata rather than aggregated at the class level. `source`, `carbonClass`, `creditToken`, `project`, `credit`, `vintage`, `country`, `category`, `methodology` and `maxUsdcPricePerTonne` are AND-combined filters that apply to both arrays; a per-credit filter also trims a matched class down to its matching credits."},{"kind":"added","action":"discover","summary":"Filter matching is normalized on both sides — Unicode NFKC, case, and surrounding or repeated whitespace — so a value typed one way matches the same value stored another. `project`, `credit` and `methodology` additionally fold `-`, `_` and space to a single separator (CMARK-5, CMARK_5 and \"CMARK 5\" are one project). `project`, `methodology`, `country` and `category` now accept several values, OR-combined within the field and still AND-combined across fields; `project`, `credit` and `methodology` also accept a comma-separated string, while `country` and `category` deliberately do not, since a comma can be part of a name. Prefix and substring matching remain unsupported."},{"kind":"added","action":"discover","summary":"`filterDiagnostics` in the response envelope, present only when a filter ran. Per filter it reports `matched`, `excludedNoMatch` and `excludedAttributeNull` — the last distinguishing an entry excluded because its attribute was missing from one excluded because it genuinely differed. A nonzero `excludedAttributeNull` beside `matched: 0` means some candidates could not be evaluated because the attribute was missing; it does not establish whether matching supply exists. Counts are per predicate-unit (one carbon-class credit, or one listing) and conditional on the filters that ran before."},{"kind":"added","action":"discover","summary":"A `projectKey` on every credit and listing — the registry-qualified project id (\"VCS-1234\"). `projectId` keeps its v1.0.0 meaning, the registry's own unqualified id (\"1234\"), which can collide across registries; `projectKey` is the unambiguous form, and is null when the registry is unindexed. The `project` filter accepts either form."},{"kind":"added","action":"discover","summary":"A `creditId` on every credit and listing — one project at one vintage (\"VCS-1234-2020\") — and a matching `credit` filter. `project` returns every vintage of a project; `credit` narrows to one. Read from the carbon subgraph, which indexes it; derived from `projectKey` + `vintage` only where the subgraph has none, and null when neither is available."},{"kind":"changed","action":"discover","summary":"`source` now selects the supply surface before fetching rather than after. A `source: \"protocol\"` request no longer fails when the marketplace subgraph is down, and a `source: \"marketplace\"` request no longer pays for per-class protocol quotes it discards."},{"kind":"added","action":"discover","summary":"Project name, region and category on every credit and listing, read from the Carbonmark CMS and joined on the registry-qualified project id. The carbon subgraph indexes a project's country and methodology codes but never these three, so `projectName`, `region` and `category` were null for all supply; they now resolve for any project the CMS carries. The subgraph still wins wherever it has a value — the CMS only fills gaps — and enrichment is best-effort: if the CMS is unreachable, discover serves subgraph attributes rather than failing. This also makes the `category` filter useful, since nothing previously populated the field it matches on."},{"kind":"added","action":"quote","summary":"A `credit` field addressing supply by the `creditId` /discover reports (\"VCS-1044-2011\"). It resolves to the credit token and the carbon class that registers it, so an agent can retire what it discovered without translating back to `creditToken` + `tokenId` itself. Exactly one of `carbonClass`, `listingId` or `credit` may be given. A credit no class registers returns `credit_not_found`, naming the `listingId` if an open listing carries it; a credit with more than one route returns `credit_ambiguous` listing them, rather than the server choosing a price."},{"kind":"added","action":"prepare/retire","summary":"`credit` addressing, identical to /quote's: the resolved carbon class is both priced and encoded into the retirement calldata, so a `credit`-addressed prepare builds the same transaction as the equivalent `carbonClass` request. Also accepted by prepare-auth and actions/retire."},{"kind":"changed","action":"quote","summary":"`vintage` accepts a full YYYYMMDD date as well as a 4-digit year. About a third of live credits are indexed with a date rather than a year (PUR-602-20230407), and credit resolution compares the stored value exactly, so a year-only rule made those credits unselectable. Coercion of `null`, `\"\"`, `false` and `[]` into a year is still rejected; `null` and `\"\"` read as an omitted field."},{"kind":"changed","action":"discover","summary":"A year-shaped `vintage` filter now also matches credits indexed with a full date, so `vintage: 2023` finds a credit stored as `20230407`. A date-shaped filter still matches only that exact date."},{"kind":"changed","action":"quote","summary":"Marketplace fills and protocol supply are now priced on two independent settlement-fee schedules rather than one shared rate. Quotes ask the settlement contract for the schedule the retirement will actually settle under, so a listing fill quotes the marketplace fee and protocol supply quotes the protocol fee. No change to the response shape; the fee a caller already sees in `fee`/`feeFormatted` is simply the correct one for the route."},{"kind":"changed","action":"discover","summary":"Listings whose remaining supply has fallen below their own minimum fill are no longer advertised. Partial fills can leave a listing that passes the subgraph's leftToSell > 0 filter but reverts PurchaseBelowMinimumFill on every attempt; those are now filtered out rather than presented as available supply."},{"kind":"added","action":"quote, prepare/retire, prepare-auth, actions/retire","summary":"Retire against a marketplace listing. New optional `listingId` (bytes32, from discover.marketplaceListings[]) addresses one seller's fixed ask instead of pooled protocol supply. `carbonClass` becomes optional as a result: supply is addressed by exactly one of the two, and passing both or neither returns 400 schema_validation. A listing names its own credit, so creditToken/vintage/tokenId are ignored on that path and `alternatives` comes back empty."},{"kind":"changed","action":"quote, prepare/retire","summary":"A listing quote carries no slippage buffer: `suggestedMaxInput` equals `total` exactly, where the protocol path still pads by 4%. A listing fills at its `unitPrice` or reverts, so there is no price impact to buffer against. The settlement fee is unchanged and computed the same way for both sources."},{"kind":"changed","action":"prepare-auth, actions/retire","summary":"Authorizations for a marketplace fill expire after 5 minutes, and a longer caller-supplied timeToLiveSeconds is capped rather than honored. The seller can cancel or reprice at any time, so a long-lived signature would commit to terms that may no longer exist when it is relayed. Protocol retirements keep the 1-hour default."},{"kind":"added","action":"quote, prepare/retire, prepare-auth, actions/retire","summary":"New listing-specific errors: 404 listing_not_found (cancelled or unknown id), 422 listing_expired, 422 below_min_fill (below the seller's minimum, which is per-listing), 422 insufficient_listing_supply (another buyer took supply first), and 400 marketplace_requires_usdc (listings settle in USDC only; kVCM remains available for protocol supply). The aggregator's CarbonmarkMarketplace_* reverts are now decoded onto contract_revert with per-error retry advice instead of surfacing as UnknownError."},{"kind":"added","action":"actions/retire","summary":"New 503 gas_limit_exceeds_cap. When a simulated retirement estimates above the executor's configured gas ceiling the request is now refused instead of broadcast with a clamped limit. Previously the limit was silently lowered to the cap, which mined an out-of-gas transaction and burned executor funds without retiring anything. Nothing is signed or spent."}]},{"version":"1.1.0","releaseDate":"2026-08-19","breaking":false,"changes":[{"kind":"added","action":"prepare-auth, actions/retire","summary":"On the USDC path `authPayload.signature` is no longer restricted to 65 bytes, so smart accounts (ERC-1271) and EIP-7702 delegated wallets can pay. USDC hands the signature to the account to validate, so its length and layout are defined by the account, not by secp256k1. Previously any payer holding contract code was rejected: USDC selects its verification path on whether the signer has code and never attempts ecrecover for such an account, so a 7702 delegated wallet was locked out even though it still held its key. Split `v`/`r`/`s` and 65-byte signatures are accepted exactly as before and need no change."},{"kind":"changed","action":"actions/retire","summary":"The settlement contract now recomputes the authorization commitment (keccak256 of the retirement plus `salt`) and refuses to settle unless it equals the signed nonce. In 1.0.0 that binding was checked only by this API, so it held only as long as the relayer behaved. No client change: a mismatch is still rejected with 400 params_mismatch before anything is broadcast. One that reaches the chain now surfaces as 422 contract_revert with `decoded.errorName` of CommitmentMismatch."}]},{"version":"1.0.0","releaseDate":"2026-07-27","breaking":true,"changes":[{"kind":"breaking","action":"prepare-auth, actions/retire","summary":"A relayed retirement must now name its beneficiary unless beneficiaryIsPayer is set to true. Previously an omitted details.beneficiaryAddress silently defaulted to the payer (`from`); it now returns 400 attribution_required."},{"kind":"added","action":"prepare-auth, actions/retire","summary":"New optional boolean `beneficiaryIsPayer`. Set it to true to credit the paying wallet deliberately; this is the explicit form of the old default behavior. Accepts a JSON boolean or the string \"true\"/\"false\" (GET aliases pass query values as strings)."},{"kind":"changed","action":"prepare-auth, actions/retire","summary":"On the USDC path the EIP-3009 authorization nonce is now keccak256 of the retirement being authorized (credit, tokenId, amount, the full attribution struct) plus a per-authorization salt, instead of a random value. Since nonce is a signed field, the signature now binds what is retired and who is credited, not just the spend value. actions/retire rebuilds the retirement, re-hashes it with the submitted salt, and returns 400 params_mismatch on a mismatch. No client change if you post `actionsRetireRequest` as returned. The kVCM (EIP-2612) path is unchanged. Permit's nonce is the token's own counter, so it cannot carry a commitment."},{"kind":"added","action":"prepare-auth, actions/retire","summary":"New top-level `salt` (bytes32). prepare-auth mints a fresh one per authorization and returns it inside `actionsRetireRequest`; actions/retire requires it alongside a USDC authPayload and returns 400 invalid_auth_payload without it. It is the second input to the authorization nonce. It is not a secret: the nonce is fixed by the payer's signature, so no attacker-chosen salt can make a different retirement hash to it. Its purpose is to keep the commitment verifiable without being deterministic. USDC burns each (from, nonce) pair permanently, so an unsalted commitment would make two identical retirements by the same payer collide and the second revert inside the token. Absent on the kVCM path."},{"kind":"added","action":"*","summary":"This changelog, at /.well-known/x402-changelog.json (GET alias /api/changelog)."},{"kind":"added","action":"*","summary":"A machine-readable error-code registry at /.well-known/x402-errors.json (GET alias /api/errors): every `error` value the API can return, with its HTTP status, group, retryable flag, emitting actions, meaning, and remedy. The discovery manifest links it and now lists per-action `errorCodes`. No response shape changed — this documents codes that already existed."},{"kind":"added","action":"*","summary":"Unknown routes and GET /api now return a machine-readable action index instead of a bare not_found body."},{"kind":"added","action":"certificate, actions/retire","summary":"Each entry in `retirements[]` now carries `beneficiaryAddress`, the address credited on-chain. It is the field to check when verifying attribution: `retiringAddress` is the aggregator's settlement address, not the party the retirement was made for. Additive — existing fields are unchanged."},{"kind":"changed","action":"prepare/retire","summary":"Unaffected by the attribution requirement. On the self-submit path the payer is msg.sender, so defaulting attribution to the payer stays correct."}],"migration":"On prepare-auth and actions/retire, send details.beneficiaryAddress set to the party the retirement is for. If you are retiring for yourself and want the paying wallet credited, send beneficiaryIsPayer: true instead. If you build the actions/retire body yourself instead of posting the returned `actionsRetireRequest`, note that on USDC the authorization nonce now commits to the retirement — you must forward the top-level `salt` from prepare-auth, and altering creditToken, tokenId, amount, or details after signing returns 400 params_mismatch. A salt is single-use; reusing one from an earlier authorization will not reproduce the nonce. The previous major version stays available at the v0 host (see `versionedHosts` in this document) if you need time to migrate."},{"version":"0.2.1","releaseDate":"2026-07-10","breaking":true,"changes":[{"kind":"breaking","action":"prepare/retire, prepare-auth, actions/retire","summary":"The request body became strict at the top level. Unknown top-level keys previously passed validation and were silently discarded; they now return 400 schema_validation with the offending key in `issues`. This shipped without a changelog entry at the time and is recorded here retroactively."}],"migration":"Attribution fields belong inside the `details` object, not at the top level: send { details: { beneficiaryAddress, beneficiaryString, ... } }. A top-level beneficiaryAddress was never read and before this release it was dropped silently, so retirements sent that way were attributed to the payer default rather than to the intended party."},{"version":"0.1.0","releaseDate":"2026-05-18","breaking":false,"changes":[{"kind":"added","action":"*","summary":"First tagged release. Changes before this point are not tracked here."}]}]}