# x402 Carbon Retirement API > Retire tokenized carbon credits on Base through Klima Protocol and the Carbonmark marketplace, then fetch the public Carbonmark certificate. Discovery, quotes and certificates are free. Retiring is paid: each retirement costs the credit price plus a fee (and executor gas when relayed through actions/retire). ## Start here - [OpenAPI spec](https://x402.klimalabs.com/openapi.json): every endpoint with its parameters, request and response schemas, and error codes - [Discover](https://x402.klimalabs.com/api/discover): free. Carbon classes (retire by `carbonClass`) and marketplace listings (retire by `listingId`), with USDC-per-tonne prices and liquidity - [Quote](https://x402.klimalabs.com/api/quote): free. Price, fee and total for an amount in tonnes ## Working examples Every URL below is complete and uses real values, so each answers 200 as written, with no wallet, key or account. Do not invent a `carbonClass`, a `listingId` or a `txHash`: a made-up value answers 404 or 400. - List everything retirable: https://x402.klimalabs.com/api/discover - List supply at or under 20 USDC per tonne: https://x402.klimalabs.com/api/discover?maxUsdcPricePerTonne=20 - Quote 0.001 tonnes (1 kg): https://x402.klimalabs.com/api/quote?chainId=8453&inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&amount=0.001&carbonClass=0x0008f35758a4318942ecb5d5414116ce7b1ede2d - Build the transactions to send from your own wallet: https://x402.klimalabs.com/api/prepare/retire?chainId=8453&inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&amount=0.001&carbonClass=0x0008f35758a4318942ecb5d5414116ce7b1ede2d&details=%7B%22beneficiaryString%22%3A%22Example%20beneficiary%22%7D - Build the authorization to sign for a relayed retirement: https://x402.klimalabs.com/api/prepare-auth?chainId=8453&inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&amount=0.001&carbonClass=0x0008f35758a4318942ecb5d5414116ce7b1ede2d&from=0x000000000000000000000000000000000000dEaD&beneficiaryIsPayer=true - Certificate for a confirmed retirement: https://x402.klimalabs.com/api/certificate?txHash=0x4be83c30c99a3347593f6ee695253147a032085ceee287c8d613173a3f5cec14 Two values in these examples are yours to replace before a real retirement: - `carbonClass` is the Wind Energy class. Supply changes, so read the current classes from /api/discover: each has a `carbonClassId`, which you pass as `carbonClass`. If a quote answers `404 no_candidates`, that class has no supply; pick another. - `from` is a placeholder address that nobody controls. Use the wallet that will pay: the authorization is only valid when signed by `from`. ## Retire carbon 1. GET /api/discover and pick a class (`carbonClassId`, sent as `carbonClass`) or a marketplace `listingId`. 2. GET /api/quote with `chainId=8453`, `inputToken`, `amount` in tonnes, and exactly one of `carbonClass` or `listingId`. See the quote example above. 3. Then either: - Your own wallet sends the transactions: GET /api/prepare/retire with the same parameters plus `details` (URL-encoded JSON), then send the returned [approve, retire] calls in order. - Relayed, with nothing to send: GET /api/prepare-auth with the same parameters plus `from` (your wallet) and one statement of who the retirement is for: either `beneficiaryIsPayer=true` as its own query parameter, or `beneficiaryAddress` inside `details`. `beneficiaryIsPayer` is never a key of `details`; putting it there answers 400. Sign `typedData` exactly as returned, set `authPayload.signature`, and POST `actionsRetireRequest` unchanged to /api/actions/retire. 4. GET /api/certificate?txHash= followed by the 0x-prefixed, 64-hex-character transaction hash, for the certificate URL. A 404 right after confirmation means it is not indexed yet; retry after a few seconds. ## Rules - Base mainnet only: chainId 8453. Input tokens: USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 or kVCM 0x00fbac94fec8d4089d3fe979f39454f48c71a65d. Marketplace listings settle in USDC only. - `amount` is a decimal tonne string, minimum "0.001". Puro and ECO credits retire in whole tonnes. Puro credits also need beneficiaryLocation, consumptionCountryCode and the consumption period in `details`. - `details.beneficiaryString` and `retirementMessage` appear on the public certificate and cannot be edited after the retirement confirms. - Errors are JSON with a stable `error` code; match on it, not on `message`. Remedies: https://x402.klimalabs.com/.well-known/x402-errors.json ## Paid - Retirement (prepare/retire, or prepare-auth + POST /api/actions/retire): the credit price plus a fee, plus executor gas when relayed. Paid from your wallet or your signed USDC authorization; see /api/quote for the exact total. - [Catalog](https://x402.klimalabs.com/api/catalog): $0.001 USDC per call (x402 v2 `exact`). The endpoint directory plus the top 3 carbon classes and marketplace listings by liquidity. Optional: /api/discover returns the full catalog for free. ## Optional - [Manifest](https://x402.klimalabs.com/.well-known/x402.json) - [Changelog](https://x402.klimalabs.com/.well-known/x402-changelog.json) - [Documentation](https://x402.klimalabs.com/.well-known/x402-docs.json)