Upload your own tree inventory
You are viewing in-progress documentation for v2. Switch to the stable version for the current production release.
POST /domains/{domain_id}/inventories/tree/upload creates a tree inventory
from your own tree list, such as a field cruise, a plot inventory, or output
from another model.
With the Python SDK it’s one call plus a wait.
create_tree_inventory_from_file creates the inventory and PUTs your file for
you. At the raw HTTP level it’s three calls: create the inventory (and get
a signed upload URL), PUT your file to that URL, then poll until it’s
processed.
Prerequisites
Section titled “Prerequisites”-
An API key: my-api-key.
-
A domain: your-domain-id. CSV tree coordinates must be in this domain’s CRS (meters). GeoJSON and GeoPackage files are reprojected to it automatically.
-
A tree file — CSV, GeoJSON, or GeoPackage. A CSV needs at least
x,y, andheightcolumns (x/yin the domain CRS) plus whatever other attributes you have. Here’s the example used below:trees.csv tree_x,tree_y,dbh_cm,ht_m,cr,spcd720400.0,5190000.0,25.4,14.2,0.45,122720520.5,5190120.0,30.1,16.8,0.50,202720650.0,5190050.5,12.7,8.1,0.35,122720800.0,5190300.0,41.9,21.0,0.60,93720950.5,5190450.0,18.3,10.5,0.40,15721100.0,5190200.0,52.6,24.7,0.65,202Columns that already use the canonical names need no mapping. Map the others to the canonical fields with
columns(SDK) or thecolumnsobject in the request body (HTTP). The canonical fields aretree_id,x,y,height(m),dbh(cm),crown_ratio(FIA compacted live crown ratio, 0–1),crown_base_height(m, the height of the lowest live foliage),crown_radius(m),fia_species_code,fia_status_code, andfia_crown_class_code.
With the Python SDK
Section titled “With the Python SDK”create_tree_inventory_from_file folds the create and the PUT into a single
call. inventory.wait() blocks until processing finishes:
import fastfuels_sdk.v2 as ff
ff.set_api_key("my-api-key")
domain = ff.Domain.from_id("your-domain-id")
# create_tree_inventory_from_file creates the inventory and PUTs your file to# the signed URL in one call. `columns` maps your file's column names onto the# canonical fields; `format` is inferred from the file extension.inventory = ff.inventories.create_tree_inventory_from_file( domain, "trees.csv", columns={ "x": "tree_x", "y": "tree_y", "dbh": "dbh_cm", "height": "ht_m", "crown_ratio": "cr", "fia_species_code": "spcd", }, name="Field-cruise tree inventory",)
# Block until processing finishes. The completed inventory carries the# canonical columns you mapped, normalized.inventory.wait()print(inventory.id, inventory.status)In the columns mapping, each key is a canonical field, and its value is the
column name in your file (here tree_x → x, dbh_cm → dbh, and so on).
The completed inventory carries those canonical columns (x, y, dbh,
height, crown_ratio, fia_species_code here), normalized, plus a
tree_id numbered 1 … N when the file has none. Add fia_status_code too if
your file has a tree-status column.
The raw HTTP flow (curl)
Section titled “The raw HTTP flow (curl)”The same upload as three raw calls, which the SDK makes for you above. Use it outside Python or to see the signed-URL handshake.
Step 1 — Create the upload and map columns
Section titled “Step 1 — Create the upload and map columns”POST to /inventories/tree/upload with the format and a columns
mapping. Each key is a canonical field. Its value is the column name in
your file.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/upload' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "name": "Field-cruise tree inventory", "format": "csv", "columns": { "x": "tree_x", "y": "tree_y", "dbh": "dbh_cm", "height": "ht_m", "crown_ratio": "cr", "fia_species_code": "spcd" }}'{ "inventory": { "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Field-cruise tree inventory", "description": "", "status": "pending", "progress": null, "created_on": "2026-11-05T17:26:47.537586Z", "modified_on": "2026-11-05T17:26:47.537586Z", "checksum": "958f771be3df4f30b9c4081a8e3362ad", "source": { "name": "upload", "format": "csv", "object_name": "inventories/your-inventory-id/upload.csv", "columns": { "x": "tree_x", "y": "tree_y", "height": "ht_m", "fia_species_code": "spcd", "dbh": "dbh_cm", "crown_ratio": "cr" } }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": null }, { "key": "x", "type": "continuous", "unit": "m", "summary": null }, { "key": "y", "type": "continuous", "unit": "m", "summary": null }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": null }, { "key": "fia_status_code", "type": "categorical", "unit": null, "summary": null }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": null }, { "key": "height", "type": "continuous", "unit": "m", "summary": null }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": null }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": null } ], "forestry_metrics": null, "georeference": null, "error": null, "tags": [] }, "upload": { "method": "PUT", "url": "paste-signed-url-from-201-response", "headers": { "Content-Type": "text/csv", "x-goog-content-length-range": "0,524288000" }, "content_type": "text/csv", "expires_at": "2026-11-05T18:26:47.537586Z", "max_size_bytes": 524288000 }}The response nests two objects:
inventory— the new resource (status: "pending"). Record its id: your-inventory-id.upload— the signedPUTURL plusupload.headers, the exact request headers (Content-Typeandx-goog-content-length-range) to replay on the upload. Set the URL here: paste-signed-url-from-201-response.
Step 2 — PUT the file to the signed URL
Section titled “Step 2 — PUT the file to the signed URL”Upload the file directly to GCS — not through the FastFuels API, so send
no api-key. The Content-Type and x-goog-content-length-range headers
must match the upload block from step 1.
# PUT the CSV directly to the signed URL returned in step 1.# This goes to Google Cloud Storage, not the FastFuels API — send no api-key.# Both headers must match the values from the create response.curl -X 'PUT' \ 'paste-signed-url-from-201-response' \ -H 'Content-Type: text/csv' \ -H 'x-goog-content-length-range: 0,524288000' \ --data-binary @trees.csvA successful upload returns 200 OK with an empty body and triggers
processing.
Step 3 — Poll until completed
Section titled “Step 3 — Poll until completed”curl -X 'GET' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/your-inventory-id' \ -H 'accept: application/json' \ -H 'api-key: my-api-key'{ "id": "your-inventory-id", "domain_id": "your-domain-id", "type": "tree", "name": "Field-cruise tree inventory", "description": "", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-05T17:26:47.537586Z", "modified_on": "2026-11-05T17:27:05.451255Z", "checksum": "958f771be3df4f30b9c4081a8e3362ad", "source": { "object_name": "inventories/your-inventory-id/upload.csv", "name": "upload", "format": "csv", "columns": { "y": "tree_y", "dbh": "dbh_cm", "crown_ratio": "cr", "x": "tree_x", "height": "ht_m", "fia_species_code": "spcd" } }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 6 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 720400.0, "max": 721100.0, "mean": 720736.8333333334, "std": 264.3218997106874 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 5190000.0, "max": 5190450.0, "mean": 5190186.75, "std": 167.44961928890731 } }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 4 } }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 12.7, "max": 52.6, "mean": 30.166666666666668, "std": 14.896666293727153 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 8.1, "max": 24.7, "mean": 15.883333333333333, "std": 6.279304632414855 } }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 0.35, "max": 0.65, "mean": 0.49166666666666664, "std": 0.11583033569262703 } } ], "forestry_metrics": null, "georeference": { "crs": "EPSG:32611", "bounds": [720400.0, 5190000.0, 721100.0, 5190450.0] }, "error": null, "tags": []}The processed inventory carries the canonical columns you mapped, normalized.
Add crown base heights
Section titled “Add crown base heights”To voxelize the inventory
or derive canopy fuel
from it, every tree needs a crown_base_height. If your file has
crown_ratio, dbh, and fia_species_code instead, as the example file
does, compute crown base heights with
POST /domains/{domain_id}/inventories/tree/allometry/crown_base_height.
Without this step, both requests return a 422 that names this request.
curl -X 'POST' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/tree/allometry/crown_base_height' \ -H 'accept: application/json' \ -H 'api-key: my-api-key' \ -H 'Content-Type: application/json' \ -d '{ "source_tree_inventory_id": "your-inventory-id", "name": "Field-cruise tree inventory with crown base heights"}'# Compute each tree's crown base height from its species, dbh, crown ratio and# height. The result is a new inventory. The uploaded one is left unchanged.crowns = ff.inventories.create_tree_inventory_with_crown_base_height_allometry( domain, inventory, name="Field-cruise tree inventory with crown base heights",)crowns.wait()print(crowns.id, crowns.status){ "id": "id-of-the-new-inventory", "domain_id": "your-domain-id", "type": "tree", "name": "Field-cruise tree inventory with crown base heights", "description": "", "status": "pending", "progress": null, "created_on": "2026-11-05T17:27:15.751436Z", "modified_on": "2026-11-05T17:27:15.751436Z", "checksum": "1f9e00a16ad7446b948631810804557b", "source": { "name": "crown_base_height", "source_tree_inventory_id": "your-inventory-id", "source_tree_inventory_checksum": "958f771be3df4f30b9c4081a8e3362ad", "model": { "name": "fia_national_logit_2026" }, "overwrite": false }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 6 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 720400.0, "max": 721100.0, "mean": 720736.8333333334, "std": 264.3218997106874 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 5190000.0, "max": 5190450.0, "mean": 5190186.75, "std": 167.44961928890731 } }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 4 } }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 12.7, "max": 52.6, "mean": 30.166666666666668, "std": 14.896666293727153 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 8.1, "max": 24.7, "mean": 15.883333333333333, "std": 6.279304632414855 } }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 0.35, "max": 0.65, "mean": 0.49166666666666664, "std": 0.11583033569262703 } }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": null } ], "forestry_metrics": null, "georeference": null, "error": null, "tags": []}The request creates a new inventory and leaves the uploaded one unchanged. Record its id: id-of-the-new-inventory. Poll it until it completes:
curl -X 'GET' \ 'https://api.fastfuels.silvxlabs.com/v2/domains/your-domain-id/inventories/id-of-the-new-inventory' \ -H 'accept: application/json' \ -H 'api-key: my-api-key'{ "id": "id-of-the-new-inventory", "domain_id": "your-domain-id", "type": "tree", "name": "Field-cruise tree inventory with crown base heights", "description": "", "status": "completed", "progress": { "percent": 100, "message": "Complete" }, "created_on": "2026-11-05T17:27:15.751436Z", "modified_on": "2026-11-05T17:27:17.232431Z", "checksum": "1f9e00a16ad7446b948631810804557b", "source": { "model": { "name": "fia_national_logit_2026" }, "overwrite": false, "name": "crown_base_height", "source_tree_inventory_id": "your-inventory-id", "source_tree_inventory_checksum": "958f771be3df4f30b9c4081a8e3362ad" }, "modifications": [], "treatments": [], "columns": [ { "key": "tree_id", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 6 } }, { "key": "x", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 720400.0, "max": 721100.0, "mean": 720736.8333333334, "std": 264.3218997106874 } }, { "key": "y", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 5190000.0, "max": 5190450.0, "mean": 5190186.75, "std": 167.44961928890731 } }, { "key": "fia_species_code", "type": "categorical", "unit": null, "summary": { "type": "categorical", "count": 6, "null_count": 0, "unique_count": 4 } }, { "key": "dbh", "type": "continuous", "unit": "cm", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 12.7, "max": 52.6, "mean": 30.166666666666668, "std": 14.896666293727153 } }, { "key": "height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 8.1, "max": 24.7, "mean": 15.883333333333333, "std": 6.279304632414855 } }, { "key": "crown_ratio", "type": "continuous", "unit": null, "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 0.35, "max": 0.65, "mean": 0.49166666666666664, "std": 0.11583033569262703 } }, { "key": "crown_base_height", "type": "continuous", "unit": "m", "summary": { "type": "continuous", "count": 6, "null_count": 0, "min": 3.6928000541640333, "max": 5.724822799666926, "mean": 4.544743983446143, "std": 0.8355357182176746 } } ], "forestry_metrics": { "type": "tree", "tree_count": 6, "basal_area_per_area": 0.019438660780001046, "tree_density": 0.02099958803745616, "quadratic_mean_diameter": 13.027590187862023, "dominant_species_groups": [ { "spgrpcd": 2, "name": "Douglas-fir", "basal_area_share": 0.559045134343625 }, { "spgrpcd": 5, "name": "Spruce", "basal_area_share": 0.2672275226341458 }, { "spgrpcd": 4, "name": "Pine", "basal_area_share": 0.12275256784155188 }, { "spgrpcd": 3, "name": "True fir/hemlock", "basal_area_share": 0.05097477518067741 } ] }, "georeference": { "crs": "EPSG:32611", "bounds": [720226.0, 5189762.0, 721534.0, 5190646.0] }, "error": null, "tags": []}The completed inventory carries every uploaded column plus
crown_base_height (m). Use id-of-the-new-inventory as the source
for voxelization or canopy fuel.
By default the national equation fia_national_logit_2026 computes the crown
base heights, and source.model records it. To use a regional equation
instead, set model, for example {"name": "toney_reeves_2009"}. Species a
regional equation doesn’t cover get no crown base height. The model list is in
the API reference. If your file
lacks dbh, crown_ratio, or fia_species_code, use
GDAM allometry
instead, which fills those and the crown base height in one request.
Common pitfalls
Section titled “Common pitfalls”- CSV coordinates in the wrong CRS. A CSV’s
x/ymust be in the domain’s projected CRS (meters). GeoJSON and GeoPackage files are reprojected automatically. Trees outside the domain are dropped, and if none remain, processing fails withEMPTY_AFTER_FILTER. Reproject a CSV before uploading. - Mistyped column mappings. Columns already named with canonical names
are read without a mapping. A typo in the source column name of an optional
field (e.g.
dbh_cmvsdbh_CM) silently drops that attribute — check the completed inventory’s columns. A typo in the mapping forx,y, orheightmakes processing fail. - Signed URL expires.
expires_atis one hour after creation. If the URL expires before thePUTsucceeds, start over from step 1 for a fresh URL. - Mismatched upload headers. GCS rejects the
PUTwith400/403ifContent-Typeorx-goog-content-length-rangedon’t match what step 1 returned. Echo them verbatim. (Only a concern on the raw HTTP path.)