PROJECT EARTH APIGuideAPI referenceDeveloper consoleopenapi.json

Project Earth API — Integration Guide

World API v1 (2026-11-07).

Project Earth simulates the whole planet on real terrain. Your code moves the world anywhere on Earth, reads the ground, plans and drives routes, controls vehicles, and gets telemetry, events and camera images back. The world renders on your own GPU, next to your code: in a browser the SDK launches on your machine, or inside your web app. Project Earth streams the world to it.

Lauterbrunnen valley, Swiss Alps, rendered by Project Earth

Lauterbrunnen, Switzerland: a camera.snapshot.

#What you can build

Use How
Drive worlds from scripts and agents, on your GPU Python and TypeScript SDKs: sessions.launch()
Drive worlds over HTTP REST /v1
LLM agents (any MCP client) /v1/mcp, tool definitions at /v1/tools
Reinforcement learning (PyTorch) metaplanets_earth.agents.EarthDriveEnv (Gymnasium API)
Training at scale without GPUs headless worlds (render=False): CPU physics and sensors, world.step
Embed in your web app <earth-world> with a publishable key
Explorable world on any page free snippet, no key

#Where the world runs

On your machine. sessions.launch() starts a session and opens its world in Chrome on the machine running your code (WebGPU, your GPU); every call then runs in that page directly, so a step costs milliseconds rather than a round trip across the internet. Run several sessions for parallel environments. Project Earth streams the world itself (terrain, imagery, land cover) and keeps the session for your account.

Physics on CPUs, pictures on GPUs. Every world simulates on the CPU: terrain, water, trees, rocks and vehicle physics on a fixed 60 Hz clock. Only drawing needs a GPU. So a gym environment picks per session:

Session Runs on Observations Metered as
Rendered (render: true, the default) a WebGPU browser: yours, your users', or ours with hosted: true images (camera.snapshot) and everything below calls; hosted: GPU minutes
Headless (render: false) any CPU: your machines, or ours with hosted: true sensor.rays, sensor.heightmap, vehicle.telemetry calls; hosted: headless (CPU) minutes

Both are the same World API, keys and quotas, and every call is validated, rate limited and metered on the server first. Scale out by running more sessions: they are independent worlds.

Limits: 2 open sessions at a time and 5 requests a second (bursts of 20) per account; embeds show a "Project Earth by Metaplanets" badge. Tell us what your workload needs and we will set your account up for it.

#1. Get access

  1. Sign in or register at <EARTH_URL>/console.html. Your Metaplanets account is your API account.
  2. Create a secret key (sk_…) for servers and agents. It is shown once; keep it server-side.
  3. For embedding, create a publishable key (pk_…) and list your site's origins (https://app.example.com, http://localhost:*).

Rotate a key to get a new one while the old one keeps working for 24 hours; revoke ends it at once.

#Train autonomous AI using Simulusion

Simulusion connects your agent to a hosted Project Earth world (Alpine Meadows by Waypoints) so it controls the world autonomously. Watch it live, record episodes, and train it from Python like any Gymnasium environment.

Train autonomous AI using Simulusion ↗Connect with a secret key from the developer console. Hosted worlds are enabled per account on request; usage counts against your own account. Simulusion is a separate service with its own sign-in.

#Sign in with Metaplanets (OAuth)

Apps that act for Project Earth users (launchers, agent platforms) can connect an account in one click instead of asking people to paste a key. It is OAuth 2.0's authorization code flow with PKCE (S256):

  1. Send the user to <EARTH_URL>/api/earth/oauth/authorize?response_type=code&client_id=…&redirect_uri=…&state=…&code_challenge=…&code_challenge_method=S256&scope=world. They sign in with their Metaplanets account, pick the API account (personal or a team) and allow.
  2. They come back to your redirect_uri with code and your state. The code works once, for 2 minutes.
  3. From your server, POST <EARTH_URL>/api/earth/oauth/token (form-encoded) with grant_type=authorization_code, code, redirect_uri, client_id, code_verifier (and client_secret if you have one). The answer's access_token is a secret key (sk_…) for that account: use it exactly like one. It does not expire; usage counts against the user's account.
  4. The user can disconnect your app in the developer console at any time; your app can disconnect itself with POST <EARTH_URL>/api/earth/oauth/revoke (token, client_id). Connecting again replaces the key.

The world scope runs worlds and calls the World API; it cannot see or change keys, members or billing. Metadata: GET <EARTH_URL>/api/earth/oauth/metadata. Apps are registered by us: send your app's name and its exact redirect URIs (https) to [email protected].

#Teams

Create a team in the console to share keys, usage and a plan with colleagues. Switch between your personal account and teams at the top of the console.

Role Can
owner everything below, plus billing, handing over ownership and deleting the team
admin invite, remove and change the roles of developers and viewers; rename the team
developer create, rotate and revoke keys; set embed origins
viewer see usage, keys and members

Invite people from Members with a link that works once, for 7 days. The owner hands over ownership before leaving.

Deleting a team or your personal API account (in Account) revokes its keys, ends its sessions and erases its keys, usage and members. Your Metaplanets sign-in stays. Cancel a paid plan first.

Passwords: email [email protected] from your account's address to reset one.

Reference for every call: <EARTH_URL>/docs/reference. OpenAPI spec: <EARTH_URL>/v1/openapi.json.

#SDKs and examples

The SDKs are not on PyPI or npm yet; install them from this site:

Python 3.11+ pip install "metaplanets_earth[local] @ <EARTH_URL>/sdk/metaplanets_earth-1.1.0-py3-none-any.whl"
TypeScript, Node 18+ curl -O <EARTH_URL>/sdk/metaplanets-earth-1.1.0.tgz && npm install ./metaplanets-earth-1.1.0.tgz playwright (imports as @metaplanets/earth)
Browser embed <EARTH_URL>/sdk/earth.js (no install)
Examples <EARTH_URL>/sdk/examples/ (also in the kit below)
Integration kit <EARTH_URL>/sdk/project-earth-integration-kit-2026-11-07.zip: this guide, the OpenAPI spec, both SDKs, examples

The local extra (and playwright for Node) is what launches the world in Chrome on your machine; it uses your installed Google Chrome. Other languages: plain HTTPS and JSON, with the world open at a session's page_url.

#2. First drive (Python)

pip install "metaplanets_earth[local] @ <EARTH_URL>/sdk/metaplanets_earth-1.1.0-py3-none-any.whl"
curl -O <EARTH_URL>/sdk/examples/python/drive_and_report.py
export EARTH_URL=<EARTH_URL> EARTH_SECRET_KEY=sk_...
python drive_and_report.py
from metaplanets_earth import Earth

earth = Earth(api_key=EARTH_SECRET_KEY, base_url=EARTH_URL)
session = earth.sessions.launch()                    # the world opens in Chrome on this machine
session.call("world.goto", lat=46.6195, lon=8.03709) # the meadows, Swiss Alps
car = session.call("vehicle.spawn", kind="pickup")
plan = session.call("route.plan", from_lat=46.6195, from_lon=8.03709, to_lat=46.62059, to_lon=8.02807)
end = session.call("vehicle.drive", vehicle=car["vehicle"], waypoints=plan["waypoints"], plan=True, wait=True)
print(end["outcome"], end["telemetry"]["odometer_m"])   # arrived 748.3
open("view.jpg", "wb").write(session.snapshot())
session.delete()

A pickup driving the meadows route, chase camera

The example's pickup on its route (camera.follow, chase view).

TypeScript (Node 18+): download <EARTH_URL>/sdk/metaplanets-earth-1.1.0.tgz and npm install that file (npm 12 refuses tarball URLs), then the same calls on Earth from @metaplanets/earth (<EARTH_URL>/sdk/examples/typescript/drive-and-report.mjs).

#3. Concepts

#4. Agents and machine learning

Fastest start: train autonomous AI using Simulusion. Your agent controls a hosted world on its own while you watch and record it, without installing a browser or GPU stack (section 1).

Train autonomous AI using Simulusion ↗Hosted worlds are enabled per account on request.

MCP. Point any MCP client at the account endpoint; the agent starts sessions with session_create, which returns a page_url to open in a WebGPU browser on your side:

{"mcpServers": {"project-earth": {"type": "http", "url": "<EARTH_URL>/v1/mcp",
  "headers": {"Authorization": "Bearer sk_..."}}}}

Tools: session_create, session_list, session_delete, and every method (world_goto, vehicle_drive, camera_snapshot…) with a session argument. For your own loop, GET /v1/tools?format=anthropic|openai|mcp.

Reinforcement learning. EarthDriveEnv follows the Gymnasium API (with gymnasium installed it is a gymnasium.Env):

from metaplanets_earth.agents import EarthDriveEnv, obs_to_tensor
env = EarthDriveEnv(earth, start=(46.6195, 8.03709), goal=(46.62059, 8.02807), image_size=(96, 96))
obs, info = env.reset()
obs, reward, terminated, truncated, info = env.step([0.7, 0.1])   # throttle, steer
x = obs_to_tensor(obs)          # {"state": [1, 11], "image": [1, 3, 96, 96]} torch tensors

Driver's-eye camera from the pickup

The driver view (camera.follow with view: "driver").

Training at scale: headless worlds. When your agent does not need pictures, create the session with render=False. The world runs without a renderer: terrain, water, trees, rocks and vehicle physics are all there, it needs no GPU (any CPU machine runs it, many at once), and you advance it yourself with world.step, faster than real time:

s = earth.sessions.launch(render=False)          # hidden Chrome, no GPU
s.call("world.goto", lat=46.6195, lon=8.03709)
car = s.call("vehicle.spawn", kind="pickup")
for _ in range(1000):
    rays = s.call("sensor.rays", count=16, range_m=40)            # ranges to trees, rocks, slopes, water
    s.call("vehicle.control", vehicle=car["vehicle"], throttle=0.7, steer=0.0, duration_s=0.1, wait=False)
    s.step(0.1)                                                  # 0.1 s of simulation, at once

#Scenes, custom assets and scripts

Included with every paid plan (Team, Platform, Enterprise). On the Free plan these methods and routes answer 402 plan_required.

A scene is a JSON document that describes what sits on top of the world: your models, rigged vehicles, lights, trigger volumes, cleared ground, the time and weather, and scripts. Make one in Dragon Editor or in code, store it in your account, and load it into any session. Its format is Metaplanets Scene v1, published as JSON Schema at <EARTH_URL>/v1/scene-v1.json.

In Dragon Editor, Scene → Scripts… opens a code editor (the VS Code editor component) with tabs, completions for world.*, and the script check shown inline. Scene → Script library… adds ready-made scripts with parameters (lap timer, checkpoint race, collectibles, doors and gates, vehicle spawner, scoreboard, countdown and more), and you can save your own scripts to your library.

from pathlib import Path
truck = earth.assets.upload(Path("haul-truck.glb").read_bytes(), name="haul-truck.glb", type="vehicle")
scene = earth.scenes.create({
    "format": "metaplanets.scene", "version": 1, "name": "Quarry",
    "base": {"type": "earth", "origin": {"lat": 46.6195, "lon": 8.03709}},
    "bounds": {"center": [0, 0, 1700], "size": [800, 800, 200]},
    "assets": [{"id": "truck", "type": "vehicle", "name": "haul-truck.glb", "uri": f"asset://{truck['id']}"}],
    "entities": [
        {"id": "t1", "name": "Truck 1", "transform": {"position": [0, 0, 1650], "rotation_deg": [0, 0, -90], "scale": [1, 1, 1]},
         "components": {"vehicle": {"asset": "truck", "max_speed_mps": 12}}},
        {"id": "gate", "name": "Weighbridge", "transform": {"position": [0, 120, 1652], "rotation_deg": [0, 0, 0], "scale": [1, 1, 1]},
         "components": {"trigger": {"shape": "box", "size": [12, 6, 6]}}}],
})
s = earth.sessions.launch(render=False, scene=scene["id"])   # loads once the world is ready (scene.loaded or scene.failed)
info = s.call("scene.info")                                 # vehicles: the scene's vehicle ids
s.call("vehicle.drive", vehicle=info["vehicles"][0], waypoints=[{"lat": 46.6206, "lon": 8.0371}], plan=True, wait=True)

The frame. Positions are metres in ENU at base.origin: x east, y north, z up (height above sea level), the frame of the USD and Gazebo exports. rotation_deg turns about east, north and up, in that order; z is counter-clockwise seen from above, so a heading of 90° (east) is [0, 0, -90]. Models keep their glTF axes (+Y up) with their front facing north at rotation 0.

Entities are a fixed set of components: primitive (box, sphere, cylinder, torus; 1 m), mesh (a model, streamed in within stream_m of the player), vehicle (a built-in kind, jet included, or a rigged vehicle asset), light, trigger (a box or sphere that fires trigger.enter and trigger.exit for vehicles), physics (static objects block vehicles, routes and sensors), semantics (a class and tags), script, turbine, builtin and geo (shown in Dragon Editor). Unknown fields are refused, so a scene cannot carry pages, URLs or code outside a script asset.

Ground. base.type is earth (the real terrain), flat (a plane at elevation_m) or heightmap (a greyscale PNG, 8 or 16 bit, stretched over size_m between height_range_m). Inside the scene volume, a flat or heightmap base replaces the ground for vehicles, sensors and route planning, is drawn, and clears Earth's vegetation. Place such scenes over open water or flat land: higher terrain shows through. terrain.exclusions clears vegetation from up to 16 boxes on any base.

Assets (POST /v1/assets?name=…&type=…, the file as the body, up to 64 MiB in one request; the same file again answers the asset you already have). Larger files, up to 256 MiB for an asset and 2 GiB for a bundle, go up in parts (see Large uploads below; the SDKs do this for you):

type Files Checked and measured
model one .glb, or .gltf with its data embedded. Draco, meshopt and KTX2 allowed no external files or unknown required extensions; bounds, triangles (at most 3 million), animations
vehicle a rigged model (below) as model, plus its rig: wheels, steered wheels, front, measured size
texture PNG, JPEG, WebP, KTX2 at most 8192 px a side
script JavaScript (.js), at most 1 MB UTF-8 text
geo GeoJSON, GeoTIFF type
heightmap greyscale PNG at most 4097 px a side

Rigged vehicles. One .glb in metres. Wheels are nodes named Wheel_0, Wheel_1, … (Wheel_0 and Wheel_1 steer), or Wheel_FL, Wheel_FR, Wheel_RL, Wheel_RR (the front ones steer). At least three. Optional nodes: Spin_N (the part of wheel N that rolls), SteeringWheel, Steering, Door_L, Door_R, Paint. The front may face −Z (like the built-in vehicles) or +Z (glTF's convention): the steered wheels tell which. Length, width, wheelbase, track and clearance are measured from the model. Mass, top speed and acceleration come from the scene's vehicle component. A custom vehicle drives like the built-in ones: vehicle.drive, vehicle.control, sensors and telemetry (kind: "custom", asset). Without a scene: vehicle.spawn with asset.

Methods. scene.load (travels there, places everything, starts the scripts), scene.unload, scene.info, entity.list, entity.get, entity.spawn (any components; geographic or scene-frame position; on the ground by default), entity.set, entity.remove, script.list, script.send. Events: scene.loaded, scene.failed, entity.spawned, entity.removed, trigger.enter, trigger.exit, script.log, script.error, script.message. world.goto unloads the scene.

Scripts run with the scene inside the world, one sandbox each. A sandbox has no network, no storage and no access to the page. A tick's handlers get 50 ms, and a script that stops answering for a second is stopped (script.error):

// Count trucks over the weighbridge; tell the caller every time.
let count = 0;
world.on('trigger.enter', async e => {
  if (e.trigger !== 'gate') return;
  count++;
  const t = await world.call('vehicle.telemetry', {vehicle: e.vehicle});
  world.emit({count, speed_kmh: t.speed_kmh});        // the caller gets a script.message event
});
world.on('message', m => { if (m.reset) count = 0; }); // from script.send
world.on('tick', () => {});                            // 10 times a simulated second; world.time, world.dt

Scripts call World API methods with world.call (not world.goto, scene.load or camera.snapshot). world.params holds the script component's params, and world.entity is the entity the script belongs to. In a stepped headless world, world.step waits for the scripts every tenth of a second, so a run is the same however the calls are timed.

Bundles. GET /v1/scenes/{id}/bundle downloads a scene with its assets as one .mpscene ZIP: scene.json, with asset uris assets/<file>, plus the files. POST /v1/scenes/import (up to 2 GiB) brings a bundle into an account. The SDKs have earth.scenes (list, get, create, update, delete, bundle, import/import_bundle) and earth.assets (list, info, upload, download, delete).

Large uploads. One request carries at most 64 MiB. A larger file goes up in parts:

  1. POST /v1/uploads with {"kind": "asset", "name": "…", "type": "vehicle", "bytes": <size>}. Use "kind": "bundle" for a .mpscene. The answer has the upload id, part_bytes (64 MiB) and parts.
  2. PUT /v1/uploads/{id}/parts/{n} for n = 0 … parts − 1, with each slice of the file as the body. Every part is part_bytes long except the last. Parts may go in any order or in parallel; send a failed one again.
  3. POST /v1/uploads/{id}/complete checks the file and stores it, as POST /v1/assets or POST /v1/scenes/import would.

GET /v1/uploads/{id} lists the parts still missing, so an interrupted upload can resume. DELETE /v1/uploads/{id} abandons it. Unfinished uploads are removed after a day.

With Simulusion. Simulusion signs in with your account (Sign in with Metaplanets), so your scenes and assets are there. Create the session with scene, or call scene.load in it. Usage counts against your own account.

#Bring your own agent: drafts, gameplay and publishing

Paid plans, like scenes. Creators build playable experiences together with their own AI agent: any model, framework or in-house workflow. Claude and other MCP clients work, and so does your own code through the REST API or the SDKs. Metaplanets runs no model for it and needs no AI key. The agent proposes changes; the creator decides in Dragon Editor.

The AI panel. In Dragon Editor, Scene → AI agent opens a chat with the account's agent. The agent hears what the creator writes:

The panel shows whether an agent is listening. A complete stand-in agent, where your model plugs into one function, is at <EARTH_URL>/sdk/examples/python/scene_agent.py.

Drafts and changesets. POST /v1/scenes/{id}/drafts opens the scene's draft, a shared working copy. The creator's open editor works on the same draft. An AI sends a changeset: a title, a rationale, and ops.

Op Fields
entity.add entity (a full entity)
entity.update id; set (name, visible, parent, transform fields, components replaced per component); unset (component names)
entity.remove id (children too)
asset.add, asset.remove asset / id
script.attach, script.detach asset, params
scene.set path (name, base, bounds, environment, terrain, spawn, cameras, player, input, ui, rules, store), value

A changeset is checked against the scene format, then waits as pending in the editor's Changes panel. The creator accepts all of it or ticked ops, or rejects it with a comment, and can undo any accepted step. GET /v1/drafts/{id}/changesets/{n}?wait=20 returns once the creator decides. A key cannot accept, save or publish, unless the creator opened the draft with review off. Saving writes a scene revision; the last 50 are kept (GET /v1/scenes/{id}/revisions, restore any of them).

Agents through MCP. Add <EARTH_URL>/v1/mcp as a connector in Claude (claude.ai, Claude Desktop, Claude Code) or any MCP client. Sign in with Metaplanets and allow scenes:write. On paid plans the server lists authoring tools:

The creator skill tells Claude how to work with them. docs_get serves the guide, the script API and the scene schema.

Playtests. playtest_run runs a draft in a headless world and checks expectations, for example [{"event": "game.won"}, {"rule": "score", "min": 3}, {"no_errors": true}]. On the server this needs hosted headless worlds, which are enabled per account on request. Anyone can run the same playtest on their own machine with earth.playtest(draft=…, seconds=60, expect=[…]) (Python SDK), or press Play in Dragon Editor: the editor's own world runs the scene with its vehicles, triggers, input, UI, rules and scripts.

Gameplay sections (/v1/scene-v1.json):

Scripts gain simulation-time timers (world.after, world.every) and world.broadcast to the scene's other scripts. They are limited to 50 calls a second, 16 waiting at once, and 20 log lines a second.

Publishing. In Dragon Editor (Scene → Publish), or with POST /v1/scenes/{id}/publish (header X-Earth-Publish: yes, from your own program), a scene's saved revision becomes an experience at <EARTH_URL>/play/<slug>. Each publish freezes a new version.

#5. Embedding in your web app

<earth-world publishable-key="pk_..." lat="46.6195" lon="8.03709" style="height:480px"></earth-world>
<script type="module" src="<EARTH_URL>/sdk/earth.js"></script>
<script type="module">
  const world = document.querySelector('earth-world');
  world.addEventListener('ready', async () => {
    const car = await world.call('vehicle.spawn', {kind: 'pickup'});
    await world.call('vehicle.drive', {vehicle: car.vehicle, waypoints: [{lat: 46.62059, lon: 8.02807}], plan: true, wait: true});
  });
</script>

#6. Errors, limits and reliability

Every error has this shape, and every response carries x-request-id:

{"error": {"type": "invalid_request", "code": "invalid_param", "param": "lat",
           "message": "terrain.sample: lat must be a number", "request_id": "…"}}
Status Meaning Fix
400 invalid_param bad or missing parameter (param names it), or a field of the wrong type fix the call
400 / 415 invalid_json body is not JSON, or no content-type: application/json send a JSON body
413 too_large request body too large send less
401 missing_key, invalid_key, token_expired credentials check the key or mint a new token
402 quota_exceeded monthly allowance used ask us to raise it
402 plan_required scenes, custom assets and scene scripts need a paid plan upgrade in the console
403 origin_not_allowed, key_in_query origin not listed; secret key in a URL add the origin; send keys in headers
403 account_suspended account suspended contact us
403 hosted_not_enabled hosted worlds are not enabled for this account run the world locally (sessions.launch())
403 not_available not in this kind of world (world.step rendered, camera.snapshot headless) use the other kind of session
404 session_not_found, vehicle_not_found session ended; wrong vehicle start a new session
403 review_required, insufficient_scope a person decides in Dragon Editor; the app was connected without scenes:write let the creator accept; connect the app again
409 superseded the draft moved on and the changeset no longer applies read the draft and propose again
404 scene_not_found, entity_not_found, asset_not_found not in your account or this world GET /v1/scenes, entity.list, GET /v1/assets
400 / 422 invalid_scene, invalid_asset the document or file does not match the format the message names the field or the problem
409 not_connected world not attached yet wait_until_connected
422 no_route, out_of_range, not_ready no drivable route; too far away; still loading change the goal; world.goto first
429 rate_limited, session_limit too fast; too many sessions the SDKs honour Retry-After; end idle sessions
502–504 world disconnected or timed out retry; long calls take timeout_s

#7. Versioning and support