Blog · article

Soil carbon API: organic carbon stock, trend and practice scenarios for any field

How to get a field's topsoil organic carbon stock from an API, which way it is heading under the farm's management, and which practice would add the most. With real requests and responses, and what a model estimate can and can't do for a carbon project.

Carbon projects, food companies with farm emission targets, lenders and farm apps ask two questions about a field's soil carbon: how much is there now, and which way is it moving? A soil carbon API answers both from a coordinate, before anyone takes a sample. This guide shows our two calls, what comes back and how to read it, using real requests and responses.

Two questions, two calls

  • How much organic carbon is there now: POST /v1/soil/pixel with "property": "soc" for a point (1 credit), or POST /v1/soil/raster for a map of the whole field (hectare-seasons). These are the soil map calls, explained in our soil data API guide. In Italy, organic carbon is graded lab-tested and comes with a likely range.
  • Which way it is heading: POST /v1/carbon/balance, 5 credits. It runs RothC, a soil carbon model used in research for decades, month by month on the field's soil, its climate and its management. You get the carbon stock in the top 30 cm, the carbon a year that would hold it steady, what the crops and manure actually return, the change over the next ten years and the same change under other practices.

Your first balance call

Send the point, the crop and its yield, and what happens to the residues:

curl -X POST https://spectral.aspace.company/v1/carbon/balance \
  -H "X-API-Key: $ASPACE_KEY" -H "Content-Type: application/json" \
  -d '{"lat": 41.46, "lon": 15.55, "country": "IT",
       "crop": "durum wheat", "yield_t_ha": 4.0, "residues": "retained"}'

That point is a durum wheat field near Foggia, in Puglia. Here is the answer, shortened to the fields you will use most:

{
  "status": "gaining",
  "stock_t_c_ha": 45.25,
  "soc_g_kg": 11.173,
  "maintenance_input_t_c_ha": {"p10": 2.042, "p50": 2.398, "p90": 2.753},
  "input_t_c_ha": 4.248,
  "input_sources_t_c_ha": {"crop_residues": 2.599, "roots": 1.649,
                           "cover_crop": 0.0, "manure": 0.0},
  "change_t_c_ha_yr": {"p10": 0.234, "p50": 0.605, "p90": 0.975},
  "change_t_co2_ha_yr": {"p10": 0.858, "p50": 2.218, "p90": 3.575},
  "horizon_years": 10,
  "stock_after_t_c_ha": {"p10": 48.07, "p50": 54.24, "p90": 60.42},
  "evidence": "model-estimate (unvalidated)",
  "model_version": "5D-C1.0-rc.1"
}

How to read the answer

stock_t_c_ha. 45 tonnes of organic carbon per hectare in the top 30 cm. It comes from the organic carbon content (11.2 g/kg, from our soil map at the point), the soil's bulk density and the depth. Bulk density defaults to 1.35 t/m³, and the stock scales with it: send a measured one in bulk_density if you have it.

maintenance_input_t_c_ha. The fresh carbon a year (residues, roots, manure) that would hold this stock steady in this soil and climate: here about 2.4 t C/ha.

input_t_c_ha and input_sources_t_c_ha. What the management actually returns: 4.2 t C/ha a year, 2.6 from the straw and stubble left on the field and 1.6 from roots. They are estimated from the yield with the IPCC reference figures, so a real yield matters more than any other field you send.

change_t_c_ha_yr. The average change over the next horizon_years (10 by default): about +0.6 t C/ha a year here, or +2.2 t CO2/ha in change_t_co2_ha_yr. p50 is the middle estimate. p10 and p90 are a low and a high case: the starting stock 15 % lower or higher (5 % with a lab value) and the residue and root inputs 25 % lower or higher. stock_after_t_c_ha is where the stock is heading after those ten years.

status. One word for the direction: gaining or losing when even the low or high case agrees, steady when the middle estimate is under 0.1 t C/ha a year either way, and uncertain when the range crosses zero. This is the field to sort or filter on.

evidence. Always model-estimate (unvalidated): the model has not been checked against repeated carbon measurements on this field. More on what that means below.

The full response also has a 12-month ledger (carbon in and CO2 out each month), a year-by-year trajectory, the climate normals used, and a limitations list that states every assumption made for this request.

Send the rotation, not one crop

Most fields don't grow the same crop every year. Send rotation, one entry per year, cycled, with its own yield, residues, cover crop and manure:

curl -X POST https://spectral.aspace.company/v1/carbon/balance \
  -H "X-API-Key: $ASPACE_KEY" -H "Content-Type: application/json" \
  -d '{"lat": 44.75, "lon": 11.0, "country": "IT",
       "rotation": [
         {"crop": "maize", "yield_t_ha": 12, "residues": "retained"},
         {"crop": "soft wheat", "yield_t_ha": 7, "residues": "removed",
          "manure": [{"type": "fym", "t_ha": 30, "month": 9}]}]}'

That is a maize and wheat field in the Po valley, with the wheat straw baled and 30 t/ha of farmyard manure every other year. The soil map gives 17.9 g/kg of organic carbon and 41 % clay, so the stock is 72.6 t C/ha. The rotation returns 7.2 t C/ha a year against a maintenance input of 6.5 (5.5 to 7.4). The middle estimate is +0.2 t C/ha a year, but the low case loses 0.35 and the high case gains 0.77, so status is uncertain: the direction itself isn't settled.

The scenarios list shows what would change, each run from the same starting soil and compared with today's management:

  • Leave the wheat straw on the field: +0.55 t C/ha a year more than today.
  • Sow a winter cover crop after the maize: +0.39.
  • Add 10 t/ha of farmyard manure a year: +0.26.

The list adapts to the field. The residue scenario shows the opposite of what happens today: on the Foggia wheat, where the straw stays, it shows what baling it would cost (0.72 t C/ha a year less than today). A winter cover crop appears only after a summer crop, a grass cover between the rows only for olive groves, orchards and vineyards, and extra manure always. The limitations list also says when a default was used, here that the maize is assumed irrigated (send "irrigated": false if it is not).

Where the inputs come from

The soil block tells you what the balance ran on. At the Po valley point, organic carbon and clay both came from the Italy soil map at 30 m, and each carries its vintage. The soil map calls grade them at that point: organic carbon lab-tested, clay benchmarked. You can replace either:

  • Lab values: send soc_g_kg, clay_pct and bulk_density from a soil test, and the balance uses them. A lab carbon value also narrows the range.
  • Lab tuning: send the soc correction from POST /v1/soil/calibrate in soil_calibration, and the map's organic carbon moves to agree with the farm's own labs. That narrows the range too.

Where the soil maps have no value at the point, or the soil read fails, a typical regional organic carbon (the European LUCAS survey's cropland median for the climate zone) and 20 % clay stand in, and the response lists them in soil.defaulted and in limitations. Check that list before you show a number as the field's own.

The climate is the last 10 years of ERA5 reanalysis weather for the point, as monthly normals (climate_years sets 3 to 20). Show the attribution line ("Weather data by Open-Meteo.com", CC BY 4.0) wherever you display the results.

What a model estimate can and can't do

The Carbon Balance is a carbon budget, not a measurement. It assumes the field has been managed in a similar way for a long time, and its constants are typical values from the literature, not fitted to the field. It covers the top 30 cm and does not model tillage or erosion. The direction and the maintenance input are firmer than the yearly rate.

So it can't certify carbon credits: certification needs the scheme's own soil measurements. What it does well is the work before and around them:

  1. Screen a supply base or a portfolio. One call per field gives the stock and the direction, and status sorts them.
  2. Rank practices on each field. The scenarios show which change adds the most carbon there, before a farmer commits to it.
  3. Decide where to sample. Fields that come back uncertain, or whose soil inputs were defaulted, are the first ones worth a lab test.
  4. Explain a trend. The ledger and the input sources show a farmer or an auditor why the soil is gaining or losing.

Start

Get a free key and make your first call in a few minutes. The developers page lists every endpoint and what each call costs, and the console has a Postman collection and the OpenAPI file with a working example for every endpoint. To see the same balance as a farmer sees it, read how the Carbon Balance works.

A model estimate, not a measurement: it can't certify carbon credits.