Home / Market / carbonmark carbon retirement

carbonmark carbon retirement

Price and retire verified carbon credits on Base through Carbonmark's x402 API. Use when a user asks to offset emissions or buy and retire carbon credits.

skill★ 509180 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: carbonmark-carbon-retirement description: "Price and retire verified carbon credits on Base through Carbonmark's x402 API. Use when a user asks to offset emissions or buy and retire carbon credits." category: api-integration risk: critical source: self source_type: self date_added: "2026-11-18" author: carbonmark tags: [carbon-credits, carbon-retirement, climate, x402, base, usdc]

---

Carbonmark Carbon Retirement

Overview

Retire tokenized carbon credits on Base mainnet through Carbonmark's x402 Carbon Retirement API (https://x402.klimalabs.com), and return the public certificate that proves the retirement.

The skill covers the whole task: list what can be retired and at what price, quote an amount, prepare the retirement for the user's wallet to sign, and fetch the certificate afterwards. Listing, quoting and certificates are free and need no API key or account. A retirement is paid in USDC on Base and is permanent.

No other skill in this catalog covers carbon credits. Use a general payments or wallet skill for the signing step; this skill supplies what to sign and how to check the result.

When to Use

Do not use it to estimate a footprint (it does not calculate emissions), to trade or hold credits (it only retires them), or on any chain other than Base mainnet.

Prerequisites

How It Works

Base URL: https://x402.klimalabs.com/api. All amounts are decimal tonnes: 0.001 is one kilogram.

1. Establish the inputs

Ask for anything missing; do not guess:

Then list the supply:

curl -s "https://x402.klimalabs.com/api/discover"

Add ?maxUsdcPricePerTonne=15 to keep only supply at or under 15 USDC per tonne. Do not send chainId to discover; it rejects it.

Take identifiers only from this response. A made-up carbonClass answers 404 no_candidates. Show the user the options and let them choose, unless they asked for the cheapest.

The prices in discover are indicative. A class can cost more per tonne for a large amount, and the fee differs between classes and listings, so "cheapest" means the lowest quoted total for the amount wanted: quote the two or three lowest-priced classes and the two or three lowest-priced listings, and compare.

2. Perform the task

Quote (free). Identify the supply with exactly one of carbonClass (a carbonClassId) or listingId:

curl -s "https://x402.klimalabs.com/api/quote?chainId=8453&inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&amount=0.001&carbonClass=0x0008f35758a4318942ecb5d5414116ce7b1ede2d"

inputToken is USDC on Base. Read these fields:

| Field | Meaning | |---|---| | pricePerTonneFormatted | price per tonne for this amount | | retirementPriceFormatted | price of the whole amount, before the fee | | feeFormatted | the service fee | | totalFormatted | expected total when the wallet sends the transactions itself (path A) | | relayTotalFormatted | expected total when a relayer sends them (path B); it adds the relayer's gas and can be several times totalFormatted for a small amount | | suggestedMaxInputFormatted | the most that can be spent on path A if the price moves (slippageBps, 4% at the time of writing) |

In humanSummary the figure after @ is the price of the whole amount, not the price per tonne.

Stop and confirm. Before preparing anything, show the user:

Continue only on an explicit yes in the current conversation. A request for a quote is not permission to retire. Do not call the prepare endpoints before that yes: they are free and change nothing, but they send the wallet address and the beneficiary text.

Both paths take the same details: a JSON object, URL-encoded. Its keys are beneficiaryString (the name on the certificate), retirementMessage (optional public message) and beneficiaryAddress (optional, the address the retirement is credited to). An unknown key answers 400 schema_validation. The API can add keys of its own (such as retiringAddress) to the details it returns; leave them as they are. To retire from a listing, replace carbonClass=... with listingId=....

Path A: the wallet sends transactions.

curl -s "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"

The response has transactions[]: an ERC-20 approve, then the retirement call, each with to, value and data, plus chain: "base". After the checks below, send them in that order from the user's wallet, as one atomic batch if supported. For separate transactions, confirm the allowance receipt before submitting retirement. If retirement fails, report any outstanding allowance so the user can decide whether to revoke it. Do not edit the calldata. The quote object in this response is the authoritative price, and approvalInstructions.amountFormatted is the ceiling the wallet approves.

Path B: the wallet signs, a relayer sends. The wallet needs USDC but no ETH.

curl -s "https://x402.klimalabs.com/api/prepare-auth?chainId=8453&inputToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&amount=0.001&carbonClass=0x0008f35758a4318942ecb5d5414116ce7b1ede2d&from=0xYOUR_WALLET_ADDRESS&beneficiaryIsPayer=true&details=%7B%22beneficiaryString%22%3A%22Example%20beneficiary%22%7D"

Replace 0xYOUR_WALLET_ADDRESS with the paying wallet. This path must say who the retirement is credited to, in one of two ways: beneficiaryIsPayer=true as its own query parameter (the paying wallet), or beneficiaryAddress inside details (another address). With neither it answers 400. beneficiaryIsPayer is never a key inside details.

The response has:

Then:

  1. Have the wallet sign typedData exactly as returned (EIP-712, eth_signTypedData_v4).
  2. Add the hex signature to the request as a new key, actionsRetireRequest.authPayload.signature. The note in the response describes the accepted signature formats.
  3. POST the whole actionsRetireRequest, otherwise unchanged, as JSON to https://x402.klimalabs.com/api/actions/retire.

Use one prepare-auth response from start to finish: every call returns a new salt and nonce. The authorization expires (validBefore, about an hour after the call at the time of writing); if signing takes longer, prepare again.

The request carries a salt tied to what was signed. Changing the amount, the credit or the details afterwards answers 400 params_mismatch.

The answer has transactionHash and retirements[]. status: "pending_index" means the retirement is confirmed on-chain and the certificate is not indexed yet; fetch it in step 3.

On either path, check the ceiling before signing or sending. Verify the wallet preview against the authorized chain, payer, token, approved contract, exact beneficiary, amount, and maximum spend. Stop if the wallet cannot verify what it is authorizing or if the ceiling or fees exceed the user-approved maximum. Ask for a new explicit confirmation for any changed terms. Never approve an unlimited allowance.

3. Verify the result

Take the transaction hash (from the wallet on path A, from transactionHash on path B) and fetch the certificate:

curl -s "https://x402.klimalabs.com/api/certificate?txHash=0x4be83c30c99a3347593f6ee695253147a032085ceee287c8d613173a3f5cec14"

Success is a retirements[] entry with a certificateUrl on app.carbonmark.com. Give the user that link, the amount and the transaction hash.

404 retirement_not_found just after the transaction means it is not indexed yet: wait a few seconds and retry, up to about a minute. If it still fails, report the transaction hash and say the certificate is not available yet. Do not report a retirement as complete without the certificate or a confirmed transaction.

Examples

Illustrative, with prices as observed on 2026-11-18; they will differ:

User request: Retire 2 kg of carbon for "Acme Robotics", cheapest option. My wallet 0xAbc...123
  can sign typed data but holds no ETH.
Inputs: amount 0.002 t; beneficiary "Acme Robotics"; wallet 0xAbc...123; path B (no ETH).
Expected result: the agent quotes the lowest-priced candidates and picks the lowest total, then
  stops and shows: Wind Energy - Small Scale, 0.002 t, about 0.027 USDC relayed (0.010 USDC if
  the wallet sent it itself), beneficiary "Acme Robotics", irreversible. After the user says yes
  it calls prepare-auth, has the wallet sign, posts the request, and returns a certificate link
  of the form https://app.carbonmark.com/retirements/id/8453-0x...-0.

A read-only request:

User request: What would it cost to retire 5 tonnes of carbon at under $10 a tonne?
Expected result: the agent calls discover with maxUsdcPricePerTonne=10, quotes 5 tonnes for each
  matching class, says how many marketplace listings also match and quotes the cheapest of those
  with at least 5 tonnes left, and reports the totals. Nothing is prepared, signed or spent.

Limitations