Download

Site API

Get terrain, buildings and trees within a specified boundary.

https://api.jifto.com/v1

Quickstart

Set JIFTO_API_KEY and run the script. It orders a small area of Paris, waits, and saves the files in the current folder.

To study the site in Rhino, an AI agent can turn these files into a jifto terrain with buildings and trees: see Site context in jifto for AI agents.

export JIFTO_API_KEY="jft_..."

# 1. Order the site. The answer holds the job's id.
curl -X POST https://api.jifto.com/v1/sites \
  -H "Authorization: Bearer $JIFTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "polygon": {
      "type": "Polygon",
      "coordinates": [[[2.33, 48.853], [2.336, 48.853], [2.336, 48.857],
                       [2.33, 48.857], [2.33, 48.853]]]
    },
    "layers": ["terrain", "buildings", "trees"]
  }'

# 2. Ask until "status" is "done" or "failed".
export JOB_ID="the id from the answer above"
curl https://api.jifto.com/v1/sites/$JOB_ID \
  -H "Authorization: Bearer $JIFTO_API_KEY"

# 3. Download each file.
for file in terrain.glb buildings.glb trees.geojson.gz; do
  curl -f -O https://api.jifto.com/v1/sites/$JOB_ID/$file \
    -H "Authorization: Bearer $JIFTO_API_KEY"
done
# pip install requests
import os
import time

import requests

API = "https://api.jifto.com/v1"
session = requests.Session()
session.headers["Authorization"] = "Bearer " + os.environ["JIFTO_API_KEY"]

# 1. Order the site.
answer = session.post(f"{API}/sites", json={
    "polygon": {
        "type": "Polygon",
        "coordinates": [[[2.33, 48.853], [2.336, 48.853], [2.336, 48.857],
                         [2.33, 48.857], [2.33, 48.853]]],
    },
    "layers": ["terrain", "buildings", "trees"],
})
answer.raise_for_status()
job = answer.json()

# 2. Ask until it is finished.
while job["status"] not in ("done", "failed"):
    time.sleep(3)
    job = session.get(f"{API}/sites/{job['id']}").json()

if job["status"] == "failed":
    raise SystemExit(job["error"])

# 3. Download what was delivered.
for name, layer in job["layers"].items():
    if layer["status"] != "ok":
        print(name, layer["status"], layer.get("reason") or layer.get("error"))
        continue
    with open(layer["file"], "wb") as file:
        file.write(session.get(layer["url"]).content)
    print(name, layer["file"], layer["sources"])
// Node 18 or newer, saved as a .mjs file
import { writeFile } from "node:fs/promises";

const API = "https://api.jifto.com/v1";
const headers = { Authorization: `Bearer ${process.env.JIFTO_API_KEY}` };

// 1. Order the site.
const answer = await fetch(`${API}/sites`, {
  method: "POST",
  headers: { ...headers, "Content-Type": "application/json" },
  body: JSON.stringify({
    polygon: {
      type: "Polygon",
      coordinates: [[[2.33, 48.853], [2.336, 48.853], [2.336, 48.857],
                     [2.33, 48.857], [2.33, 48.853]]],
    },
    layers: ["terrain", "buildings", "trees"],
  }),
});
if (!answer.ok) throw new Error(await answer.text());
let job = await answer.json();

// 2. Ask until it is finished.
while (job.status !== "done" && job.status !== "failed") {
  await new Promise((resolve) => setTimeout(resolve, 3000));
  job = await (await fetch(`${API}/sites/${job.id}`, { headers })).json();
}
if (job.status === "failed") throw new Error(job.error);

// 3. Download what was delivered.
for (const [name, layer] of Object.entries(job.layers)) {
  if (layer.status !== "ok") {
    console.log(name, layer.status, layer.reason ?? layer.error);
    continue;
  }
  const file = await fetch(layer.url, { headers });
  await writeFile(layer.file, Buffer.from(await file.arrayBuffer()));
  console.log(name, layer.file, layer.sources);
}
// A console program on .NET 8 or newer
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json.Nodes;

const string Api = "https://api.jifto.com/v1";
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
    "Bearer", Environment.GetEnvironmentVariable("JIFTO_API_KEY"));

// 1. Order the site.
var answer = await http.PostAsJsonAsync($"{Api}/sites", new
{
    polygon = new
    {
        type = "Polygon",
        coordinates = new[] { new[]
        {
            new[] { 2.33, 48.853 }, new[] { 2.336, 48.853 }, new[] { 2.336, 48.857 },
            new[] { 2.33, 48.857 }, new[] { 2.33, 48.853 },
        } },
    },
    layers = new[] { "terrain", "buildings", "trees" },
});
answer.EnsureSuccessStatusCode();
var job = (await answer.Content.ReadFromJsonAsync<JsonObject>())!;

// 2. Ask until it is finished.
while (job["status"]!.GetValue<string>() is not ("done" or "failed"))
{
    await Task.Delay(3000);
    job = (await http.GetFromJsonAsync<JsonObject>($"{Api}/sites/{job["id"]}"))!;
}
if (job["status"]!.GetValue<string>() == "failed")
    throw new Exception(job["error"]?.ToString());

// 3. Download what was delivered.
foreach (var (name, layer) in job["layers"]!.AsObject())
{
    if (layer!["status"]!.GetValue<string>() != "ok")
    {
        Console.WriteLine($"{name}: {layer["status"]} {layer["reason"] ?? layer["error"]}");
        continue;
    }
    string path = layer["file"]!.GetValue<string>();
    await File.WriteAllBytesAsync(path, await http.GetByteArrayAsync(layer["url"]!.GetValue<string>()));
    Console.WriteLine($"{name}: {path}");
}
$api = "https://api.jifto.com/v1"
$headers = @{ Authorization = "Bearer $env:JIFTO_API_KEY" }

# 1. Order the site.
$site = @{
    polygon = @{
        type = "Polygon"
        coordinates = @(, @(
            @(2.33, 48.853), @(2.336, 48.853), @(2.336, 48.857),
            @(2.33, 48.857), @(2.33, 48.853)
        ))
    }
    layers = @("terrain", "buildings", "trees")
} | ConvertTo-Json -Depth 6
$job = Invoke-RestMethod -Method Post "$api/sites" -Headers $headers `
    -ContentType "application/json" -Body $site

# 2. Ask until it is finished.
while ($job.status -notin "done", "failed") {
    Start-Sleep -Seconds 3
    $job = Invoke-RestMethod "$api/sites/$($job.id)" -Headers $headers
}
if ($job.status -eq "failed") { throw $job.error }

# 3. Download what was delivered.
foreach ($entry in $job.layers.PSObject.Properties) {
    $layer = $entry.Value
    if ($layer.status -ne "ok") {
        "$($entry.Name): $($layer.status) $($layer.reason)$($layer.error)"
        continue
    }
    Invoke-WebRequest $layer.url -Headers $headers -OutFile $layer.file
    "$($entry.Name): $($layer.file)"
}

Authentication

Send your API key with every request. Keep it out of browser code.

Authorization: Bearer jft_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

POST/v1/sites

Order a site

polygonRequired. GeoJSON Polygon, WGS84, [longitude, latitude]. One closed outline without holes or self intersections.
layersRequired. Any of terrain, buildings, trees.
terrain_max_error_mLargest height error of the terrain mesh, 0.02 to 0.5 m, default 0.05. Larger values give smaller files. Very steep sites can fail at low values.
{
  "id": "vr6eflqp75ekukr",
  "status": "queued",
  "created": "2026-11-01 00:56:50.264Z",
  "area_km2": 0.249444,
  "layers_requested": ["terrain", "buildings", "trees"]
}

GET/v1/sites/{id}

Read a job

Ask every few seconds until status is done or failed. Times are UTC.

Job

statusqueued, running, done or failed. done: all layers were attempted and at least one was delivered. failed: none was, and error says why.
billabletrue when done. Failed jobs are free.
crs, originSee Coordinates.
files_untilDownload the files before this time. After it, layers have no url, and files_removed gives the time they went.

Layer

statusok, unavailable (with reason) or failed (with error). Check each layer: a done job can lack one.
sourcesThe data used. The best source for the place, then the next one if it fails, which can be coarser.
attributionThe credit you must show wherever you use or publish the result.
countBuildings or trees delivered. Some sources count building parts.
heightsBuildings: absolute, or above ground when the source measures from the ground and no terrain was ordered.
{
  "id": "vr6eflqp75ekukr",
  "status": "done",
  "created": "2026-11-01 00:56:50.264Z",
  "finished": "2026-11-01 00:57:14.356Z",
  "area_km2": 0.249444,
  "billable": true,
  "layers_requested": ["terrain", "buildings", "trees"],
  "crs": "EPSG:32630",
  "origin": [440290.4580543572, 4474257.382006545],
  "files_until": "2026-11-08 00:57:14.356Z",
  "layers": {
    "terrain": {
      "status": "ok",
      "file": "terrain.glb",
      "url": "https://api.jifto.com/v1/sites/vr6eflqp75ekukr/terrain.glb",
      "bytes": 152748,
      "triangles": 124458,
      "vertices": 63383,
      "sources": ["es-cnig-terrain"],
      "attribution": ["Centro Nacional de Información Geográfica (CNIG), ..."]
    },
    "buildings": {
      "status": "ok",
      "file": "buildings.glb",
      "url": "https://api.jifto.com/v1/sites/vr6eflqp75ekukr/buildings.glb",
      "bytes": 212344,
      "count": 366,
      "triangles": 81018,
      "heights": "absolute",
      "sources": ["jifto-lod2"],
      "attribution": ["Buildings reconstructed by jifto from Spanish open data: ..."]
    },
    "trees": {
      "status": "unavailable",
      "reason": "The tree sources returned no trees for this polygon."
    }
  }
}

GET/v1/sites/{id}/{file}

Download a file

Use a layer's url with the same header.

terrain.glb    buildings.glb    trees.geojson.gz

GET/v1/usage

Read your usage

This calendar month (UTC), across all keys of your account. For an earlier month, add ?month=2026-10.

km2Area of the billable jobs.
km2_layersArea times layers delivered: 1 km² with three layers is 3.
bytesSize of the files delivered.
curl https://api.jifto.com/v1/usage \
  -H "Authorization: Bearer $JIFTO_API_KEY"
import os

import requests

usage = requests.get(
    "https://api.jifto.com/v1/usage",
    headers={"Authorization": "Bearer " + os.environ["JIFTO_API_KEY"]},
).json()
print(usage["billable_requests"], usage["km2_layers"])
const answer = await fetch("https://api.jifto.com/v1/usage", {
  headers: { Authorization: `Bearer ${process.env.JIFTO_API_KEY}` },
});
const usage = await answer.json();
console.log(usage.billable_requests, usage.km2_layers);
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json.Nodes;

using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
    "Bearer", Environment.GetEnvironmentVariable("JIFTO_API_KEY"));

var usage = await http.GetFromJsonAsync<JsonObject>(
    "https://api.jifto.com/v1/usage");
Console.WriteLine($"{usage!["billable_requests"]} {usage["km2_layers"]}");
$usage = Invoke-RestMethod "https://api.jifto.com/v1/usage" `
    -Headers @{ Authorization = "Bearer $env:JIFTO_API_KEY" }
"$($usage.billable_requests) $($usage.km2_layers)"
{
  "month": "2026-11",
  "requests": 1,
  "billable_requests": 1,
  "failed_requests": 0,
  "km2": 0.249444,
  "km2_layers": 0.748332,
  "bytes": 403244,
  "jobs": [{
    "id": "vr6eflqp75ekukr",
    "status": "done",
    "created": "2026-11-01 00:56:50.264Z",
    "area_km2": 0.249444,
    "layers_delivered": 3,
    "km2_layers": 0.748332,
    "bytes": 403244,
    "billable": true
  }]
}

Files

terrain.glbOne simplified triangle mesh, cut to the polygon.
buildings.glbAll buildings in one mesh. _FEATURE_ID_0 gives each vertex its building number, which is how the sample separates them. Vertices also have POSITION and NORMAL. A building is kept whole when 80 % of it lies inside the polygon.
trees.geojson.gzGzip-compressed GeoJSON points, each [longitude, latitude, elevation]: WGS84 degrees, and the ground elevation at the tree in metres. Elevation comes from the terrain mesh, so it is left out when the order does not include terrain.

Both meshes are glTF 2.0 with KHR_draco_mesh_compression and positions on a 1 cm grid.

Tree properties

height_mHeight of the tree.
crown_diameter_mWidth of the crown.
trunk_height_mHeight of the crown's underside.
crown_styleblob round, conical conifer, columnar narrow upright, umbrella flat top, palm palm.
sourcemapped from a tree dataset, canopy from a canopy height model.
# pip install DracoPy numpy
import json
import struct

import DracoPy
import numpy as np


def read_buildings(path):
    """Yields (building number, vertices, normals, triangles), each building with its own vertex numbering."""
    data = open(path, "rb").read()
    length = struct.unpack_from("<I", data, 12)[0]
    doc = json.loads(data[20:20 + length])
    binary = data[20 + length + 8:]
    draco = doc["meshes"][0]["primitives"][0]["extensions"]["KHR_draco_mesh_compression"]
    view = doc["bufferViews"][draco["bufferView"]]
    mesh = DracoPy.decode(binary[view["byteOffset"]:view["byteOffset"] + view["byteLength"]])
    attribute = lambda name: np.asarray(mesh.get_attribute_by_unique_id(draco["attributes"][name])["data"])

    vertices = np.asarray(mesh.points).reshape(-1, 3)
    triangles = np.asarray(mesh.faces).reshape(-1, 3)
    normals = attribute("NORMAL").reshape(-1, 3)
    numbers = attribute("_FEATURE_ID_0").reshape(-1)

    of_triangle = numbers[triangles[:, 0]]
    for number in np.unique(numbers):
        keep = numbers == number
        renumber = np.cumsum(keep) - 1
        yield int(number), vertices[keep], normals[keep], renumber[triangles[of_triangle == number]]


for number, vertices, normals, triangles in read_buildings("buildings.glb"):
    print(number, len(vertices), "vertices,", len(triangles), "triangles")
// npm install @gltf-transform/core @gltf-transform/extensions draco3dgltf
import { NodeIO } from "@gltf-transform/core";
import { KHRDracoMeshCompression } from "@gltf-transform/extensions";
import draco3d from "draco3dgltf";

const io = new NodeIO()
  .registerExtensions([KHRDracoMeshCompression])
  .registerDependencies({ "draco3d.decoder": await draco3d.createDecoderModule() });

const document = await io.read("buildings.glb");
const mesh = document.getRoot().listMeshes()[0].listPrimitives()[0];
const positions = mesh.getAttribute("POSITION").getArray();
const normals = mesh.getAttribute("NORMAL").getArray();
const numbers = mesh.getAttribute("_FEATURE_ID_0").getArray();
const indices = mesh.getIndices().getArray();

// One mesh per building, each with its own vertex numbering.
const buildings = new Map();
const renumber = new Uint32Array(numbers.length);
numbers.forEach((number, v) => {
  if (!buildings.has(number)) buildings.set(number, { positions: [], normals: [], triangles: [] });
  const building = buildings.get(number);
  renumber[v] = building.positions.length / 3;
  building.positions.push(positions[v * 3], positions[v * 3 + 1], positions[v * 3 + 2]);
  building.normals.push(normals[v * 3], normals[v * 3 + 1], normals[v * 3 + 2]);
});
for (let i = 0; i < indices.length; i += 3) {
  buildings.get(numbers[indices[i]]).triangles.push(
    renumber[indices[i]], renumber[indices[i + 1]], renumber[indices[i + 2]]);
}

for (const [number, building] of buildings) {
  console.log(number, building.positions.length / 3, "vertices,", building.triangles.length / 3, "triangles");
}
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [-3.7010498, 40.4146309, 656.54]
  },
  "properties": {
    "height_m": 11.25,
    "crown_diameter_m": 6.75,
    "crown_style": "blob",
    "trunk_height_m": 0.2,
    "source": "mapped"
  }
}

Coordinates

GLB vertices are metres in the site's UTM zone, measured from the site's centre, with Y up. The job's crs and origin, repeated in each file's asset.extras, place them.

Heights use the source's vertical datum, which differs by country.

east   = origin[0] + x
north  = origin[1] - z
height = y

Limits

Polygon area2.25 km²
Bounding box side1,500 m
Polygon vertices500
Latitude85° north to 85° south
Open jobs per key3
Open jobs in total20, run one at a time, oldest first
Time per job20 minutes
Files kept7 days

A key can have a monthly allowance of requests or km² times layers. Failed jobs do not count.

Errors

StatusCodeMeaning
400BAD_POLYGONNot a usable polygon. The message says why.
400POLYGON_TOO_LARGEPast the limits.
400BAD_LAYERSNo layer, an unknown one, or one twice.
400BAD_ERROR_BOUNDterrain_max_error_m out of range.
400BAD_MONTHmonth not like 2026-10.
401UNAUTHORIZEDNo valid key.
404NOT_FOUNDNo such job or file on this account.
429MONTHLY_LIMITMonthly allowance used up.
429TOO_MANY_OPEN_JOBSThree jobs open. Wait for one to finish.
503BUSYQueue full. See Retry-After.
503UNAVAILABLECould not queue the job. Try again later.

Nothing is started or charged. A job that runs out of memory or time ends as failed: try a smaller polygon or a larger terrain_max_error_m.

{
  "code": "POLYGON_TOO_LARGE",
  "message": "The polygon's bounding box is limited to 1500 m a side."
}