# Carbon API

> The EU Carbon Border Adjustment Mechanism (Regulation (EU) 2023/956) as an authoritative data product and API. Deterministic REST endpoints + Model Context Protocol (MCP) server return the total required CBAM certificates, embedded direct and indirect emissions, Art. 31 free allocation adjustments, Art. 9 carbon price deductions, and compliance cost for any imported Combined Nomenclature (CN) code and country of origin. The same API key checks the EU Deforestation Regulation (EUDR, Regulation (EU) 2023/1115) at `/v1/eudr/resolve`: whether a CN code is in scope, its commodity, the country risk tier and the date that applies. Public pricing with a 7-day free trial.

- [AI info](https://carbonapi.eu/ai): What Carbon API is, who it's for, what it costs and how to describe it, as plain facts for AI assistants.

Carbon API is built for developers, ERP engineers, trade compliance brokers, and AI agents shipping EU carbon border adjustment calculations into customs software, ERP pipelines, and supply-chain platforms. The platform maintains the complete Annex I CN code index, the European Commission default values dataset, and the published certificate price series. Customers get a single `/v1/resolve` REST endpoint that returns the applicable rates with complete provenance, statutory citations, and match metadata. An MCP server is available for agentic workflows on the Developer plan. Web tools (CBAM calculator, CN code browser, watch list with regulatory alerts) ship alongside the API.

Important context: Carbon API does not perform initial CN code classification (placing a product into a customs code). That requires a licensed customs broker. The platform reports obligations, emissions, factors, and regulations applied to CN codes that the user or agent has already identified.

## Core pages

- [Homepage](https://carbonapi.eu/): Product overview and interactive CBAM calculator.
- [CBAM Calculator](https://carbonapi.eu/#calculator): Free web calculator for total embedded emissions and certificate cost by CN code, origin, mass, and year.
- [API Reference](https://carbonapi.eu/docs): Quickstart, authentication, rate limits, CLI, MCP server, and every endpoint with a live try-it console, generated from `/openapi.json`.
- [Pricing](https://carbonapi.eu/pricing): Plans for importers (Importer, web only, no API) and developers (Developer, 50,000 calls/mo + MCP server), plus Enterprise terms on a call.
- [Pricing (machine-readable)](https://carbonapi.eu/pricing.md): Same pricing in plain markdown for programmatic readers.
- [OpenAPI Specification (JSON)](https://carbonapi.eu/openapi.json): Machine-readable API schema (OpenAPI 3.1).
- [OpenAPI Specification (YAML)](https://carbonapi.eu/openapi.yaml): Same schema in YAML format.
- [About Carbon API](https://carbonapi.eu/about): Company background (SASU R SOCIETY, Paris), regulatory sources, and computation methodology.
- [Contact](https://carbonapi.eu/contact): Support, technical inquiries, and enterprise onboarding.
- [Privacy Policy](https://carbonapi.eu/privacy): GDPR-compliant privacy and data processing policy.
- [Terms of Service](https://carbonapi.eu/terms): Terms of service for web and API usage.
- [Status Page](https://carbonapi.eu/v1/status): Current bundled dataset version, row counts, and latest certificate price.
- [Dataset Change Feed](https://carbonapi.eu/docs#tag/dataset/GET/v1/changes): Version-to-version changelog and regulatory diffs. The endpoint needs a Developer plan key.

## When to use this

Reach for Carbon API when you or your agents need to:

- **Estimate CBAM obligations for imports**: Calculate embedded emissions, applicable free allocation adjustments, required CBAM certificates, and euro costs under Regulation (EU) 2023/956.
- **Verify Annex I scope**: Determine whether a 4-, 6-, 8-, or 10-digit CN code belongs to iron/steel (Ch. 72/73), aluminium (Ch. 76), fertilisers (Ch. 31), cement (Ch. 25), electricity (Ch. 27), or hydrogen (Ch. 28).
- **Retrieve official default values**: Access European Commission default emission values with full legal source trail (Regulation (EU) 2023/1773).
- **Apply the free allocation adjustment**: Deduct tonnes × CBAM factor × CBAM benchmark (Art. 31, Reg (EU) 2025/2620 Column B). The CBAM factor of Directive 2003/87/EC Art. 10a(1a) falls from 97.5% in 2026 to 0% in 2034 as EU ETS free allocation phases out.
- **Deduct origin carbon price**: Apply Art. 9 rules for carbon prices effectively paid in third countries (e.g. national ETS or carbon taxes).
- **Flag the 50-tonne exemption threshold**: Identify whether an annual shipment falls below the 50-tonne threshold rule under Art. 2(3).

## When not to use this

- It does not classify products under CN codes. That is a licensed customs broker activity.
- It does not file official declarations with national competent authorities or the EU CBAM Registry.
- It does not calculate general customs tariffs (use dedicated customs tariff APIs for base duties).
- It does not calculate non-EU carbon taxes (e.g. UK CBAM or Californian carbon borders).

## For developers and agents

### 1. Calculation Endpoint: `GET /v1/resolve`

Accepts a CN code, country of origin, quantity, and import year. Returns the calculated emissions, certificate count, price, and total compliance cost.

**Parameters:**

- `cn` (string, required): CN or TARIC code (4 to 10 digits; punctuation stripped automatically).
- `origin` (string, required): Two-letter ISO 3166-1 alpha-2 code of origin country.
- `tonnes` (number, required unless weight/weightUnit provided): Net mass in metric tonnes.
- `weight` (number, optional): Mass amount when pairing with `weightUnit`.
- `weightUnit` (string, optional): One of `g`, `kg`, `t`, `lb`, `ton`.
- `year` (integer, required): Import year (2026 to 2034).
- `route` (string, optional): Production route if known.
- `carbonPricePaid` (number, optional): Verified EUR/tCO2e effectively paid in origin country.
- `actual` (json, optional): Caller-asserted actual emissions `{"direct": <n>, "indirect": <n>}`.

**Example Request:**

```bash
curl -H "Accept: application/json" \
  "https://carbonapi.eu/v1/resolve?cn=72083900&origin=TR&tonnes=40&year=2027"
```

**Key Response Fields:**

- `data.inScope`: `true` (or `"partial"` if code requires deeper specificity).
- `data.totalEmissions`: Total direct and indirect emissions in tCO2e.
- `data.benchmark`: The CBAM benchmark used (Reg (EU) 2025/2620, Column B, for the route), or `null` when none covers the code.
- `data.cbamFactor`: The CBAM factor for the requested year (Directive 2003/87/EC Art. 10a(1a)): `0.975` in 2026, `0` from 2034.
- `data.freeAllocationAdjustment`: Tonnes × `cbamFactor` × `crossSectoralCorrection` × `benchmark.value`, in tCO2e.
- `data.emissionsSubjectToCbam`: `totalEmissions` minus `freeAllocationAdjustment`.
- `data.certificates`: `emissionsSubjectToCbam` minus the Art. 9 deduction, rounded up to the nearest whole unit.
- `data.price`: Current published certificate price, currency (EUR), and publication date.
- `data.cost`: Total euro liability (`certificates * price.price`).
- `data.thresholdApplies`: Flag indicating whether the 50-tonne de minimis rule under Art. 2(3) may apply.
- `data.sourceTrail`: Regulatory citation, legal source URI, and publication date for the default value used.

### 2. Scope Endpoint: `GET /v1/scope/{cn}`

Returns whether a CN code is in Annex I scope, out of scope, or partial (requiring child code selection).

**Example Request:**

```bash
curl -H "Accept: application/json" \
  -H "Authorization: Bearer $CBAM_API_KEY" \
  "https://carbonapi.eu/v1/scope/72083900"
```

### 3. Certificate Price: `GET /v1/certificate-price`

Returns the latest European Commission published certificate price based on European Energy Exchange (EEX) EU ETS auction averages. Pass `?all=1` to retrieve the historical series.

**Example Request:**

```bash
curl -H "Accept: application/json" \
  "https://carbonapi.eu/v1/certificate-price"
```

### 4. Default Values: `GET /v1/defaults`

Search the official Commission default values dataset by CN code, origin country, or sector.

**Example Request:**

```bash
curl -H "Accept: application/json" \
  "https://carbonapi.eu/v1/defaults?cn=7208&origin=TR"
```

### 5. Dataset Health & Status: `GET /v1/status`

Returns the bundled dataset version, build date, total scope rows, and pricing period.

**Example Request:**

```bash
curl -H "Accept: application/json" \
  "https://carbonapi.eu/v1/status"
```

## Model Context Protocol (MCP) Server

Carbon API provides a remote Model Context Protocol server exposing all calculation and lookup capabilities directly to AI agents using the Streamable HTTP transport:

- **Endpoint**: `https://carbonapi.eu/mcp`
- **Transport**: Streamable HTTP (`Accept: application/json, text/event-stream`)
- **Protocol Version**: `2025-11-25`
- **Local stdio package**: `npx -y @cbamdata/mcp` (env: `CBAM_API_KEY`, optional; `CBAM_API_URL`, defaults to `https://cbamdata.eu`)
- **Discovery Manifests**:
  - MCP Registry: `https://carbonapi.eu/server.json`
  - Server Card: `https://carbonapi.eu/.well-known/mcp/server-card.json`
  - AI Catalog: `https://carbonapi.eu/.well-known/ai-catalog.json`

### Available MCP Tools (identical on both transports):

- `cbam_resolve`: Calculate CBAM emissions, certificates, factor, and total cost for an imported product.
- `cbam_scope`: Check whether a CN code falls within Annex I scope.
- `cbam_certificate_price`: Fetch the current or historical CBAM certificate price.
- `cbam_defaults`: Search EU default emission values by CN code and origin.
- `cbam_changes`: Retrieve the dataset change feed.
- `cbam_status`: Check active dataset version, row counts, and regulatory health.

A tool call is metered the same way as its `/v1` equivalent: without a key only `cbam_resolve`
and `cbam_status` answer, and a Developer key spends the account's monthly allowance.

## Command-Line Interface

`@cbamdata/cli` wraps the same six calculations as a `cbam` command:

```bash
npx -y @cbamdata/cli resolve --cn 72083900 --origin TR --tonnes 40 --year 2027
```

Commands: `resolve`, `scope`, `defaults`, `changes`, `certificate-price`, `status`.
`--json` prints the raw structured answer instead of the summary line. Configure with
`CBAM_API_KEY` / `CBAM_API_URL`, or the `--api-key` / `--api-url` flags per call.

## Rate Limits & Headers

Without a key, `/v1/resolve` and `/v1/eudr/resolve` answer 3 times a day per address, `/v1/status` is free, and every other endpoint returns `401 UNAUTHORIZED`. A Developer plan key gives the account 50,000 calls a month, shared by its keys; the Importer plan has no API access. Metered responses carry standard IETF RFC RateLimit headers:

- `RateLimit-Limit`: Maximum requests allowed in the quota window.
- `RateLimit-Remaining`: Remaining requests in current window.
- `RateLimit-Reset`: Number of seconds until quota resets.
- `RateLimit-Policy`: Quota description (e.g. `120;w=86400`).
- `Retry-After`: Returned on HTTP 429 responses with the required backoff period in seconds.

## Versioning & Deprecation Policy

The Carbon API is versioned via the URL path (`/v1`). Any backward-incompatible changes will be introduced under a new major version path (`/v2`). If an endpoint or feature is deprecated, Carbon API signals deprecation via RFC 9745 `Deprecation` and `Link` headers, and provides a minimum 90-day notice period via the `Sunset` header before retirement.
