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, 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.
- In your web app, embed the world instead (section 5): it renders in your users' browsers.
- Any other WebGPU browser can run a session too: open its
page_url. - Hosted worlds, rendered on Metaplanets GPUs (
hosted: true), are enabled per account on request.
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
- Sign in or register at
<EARTH_URL>/console.html. Your Metaplanets account is your API account. - Create a secret key (
sk_…) for servers and agents. It is shown once; keep it server-side. - 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.
#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):
- 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. - They come back to your
redirect_uriwithcodeand yourstate. The code works once, for 2 minutes. - From your server,
POST <EARTH_URL>/api/earth/oauth/token(form-encoded) withgrant_type=authorization_code,code,redirect_uri,client_id,code_verifier(andclient_secretif you have one). The answer'saccess_tokenis a secret key (sk_…) for that account: use it exactly like one. It does not expire; usage counts against the user's account. - 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()

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
- Session: one world. It renders in a browser on your side: launched by the SDK (
launch()), opened at itspage_url, or embedded in your web app. Calls from the SDK go to that page directly; REST and MCP calls reach it through Project Earth. (hostedsessions render on Metaplanets GPUs, where enabled.) - Methods (19):
world.status,world.goto,world.set_time,world.set_weather,world.get_weather,world.weather_presets,terrain.sample,terrain.profile,route.plan,vehicle.spawn,vehicle.drive,vehicle.control,vehicle.stop,vehicle.telemetry,vehicle.list,vehicle.remove,camera.follow,camera.release,camera.snapshot. Call:POST /v1/sessions/{id}/methods/{method}with params as JSON →{"result": …}. - Weather is simulated: a global model of winds, pressure systems, fronts, cloud, rain, snow and
storms runs with the world. It is not real-world weather (no observations or forecasts).
world.set_weatherpicks a preset orauto, or designs the weather in detail: cloud layers by type, base, top and coverage; precipitation; wind by height; visibility and fog; temperature and pressure; storms and lightning (world.weather_presetslists the presets with their full states;world.get_weatherreads the weather in force).world.set_timealso takes aseason. Weather lasts for the session: every new session starts with a clear sky (clear;autoturns the live simulation on). In the world, press U (or Settings → World & weather) for the weather designer, which previews clouds and storms before you apply them. Each vehicle's telemetry reports the conditions where it is. - Units: WGS84 lat/lon, metres, degrees, m/s and km/h, Unix milliseconds. Terrain is detailed within
about 9 km of the camera (
world.gotofirst); elevation only beyond. - Events (Server-Sent Events,
GET /v1/sessions/{id}/events):vehicle.arrived,vehicle.blocked,vehicle.telemetry(1 Hz while moving) and more. Resume withLast-Event-ID; the SDKs do this. - Driving:
vehicle.drivefollows waypoints (or plans withplan: true), avoids slopes and water it cannot handle, and re-plans round obstacles (withplan: true, round water too).world.gotowaits for mapped rivers to load, so a route planned on arrival knows them.wait: truereturns theoutcome: arrived, blocked, stuck, stopped, replaced, removed or timeout.
#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).
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

The driver view (camera.follow with view: "driver").
- Observation: camera image (H×W×3) and 11 state values (goal offset and distance, heading, speed, pitch, roll, slope, health, water depth).
- Action: throttle and steer, each −1 to 1, held for
step_s(0.5 s) viavehicle.control. - Reward: metres of progress, minus time and damage; +10 on arrival.
<EARTH_URL>/sdk/examples/python/pytorch_agent.pytrains a CNN policy with REINFORCE;--baselineruns a scripted controller. Install the SDK with its PyTorch extras:pip install "metaplanets_earth[torch,local] @ <EARTH_URL>/sdk/metaplanets_earth-1.1.0-py3-none-any.whl".- The environment launches its world on your machine (
EarthDriveEnv(..., headless=True)on a machine with GPU-backed headless Chrome). Calls take a few milliseconds; a step lastsstep_sof simulated driving. Run one environment per session for parallel rollouts.
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
- Observations without images:
sensor.rays(a lidar-like fan),sensor.heightmap(relative heights, water depth and blocked cells around the vehicle),vehicle.telemetry. world.step(seconds)runs at 60 steps per simulated second; one call can advance minutes. After the first step the world waits for the next. Calls that wait then advance it by exactly what they wait for:vehicle.control(defaultwait: true) byduration_s,vehicle.drivewithwaituntil the route ends.- Steps run one at a time, in order: a second
world.stepsent while one runs waits for it. While a step runs, nothing else advances the clock, so a run is the same however the calls are timed. - Before simulating onto new ground, a step waits for the terrain 150 m ahead of each vehicle to stream
in. One call spends at most 40 s of wall time: if the ground is still arriving, it stops early and
ticks(fixed steps actually run) is less thanseconds× 60. Step again;time_sis the clock. - Use one session per environment for parallel rollouts. Hosted headless worlds are enabled per account on request (Team 4 at once, Platform 16, Enterprise 32, or as agreed); a headless world on your own machine needs about a fifth of a CPU core and 1.3 GB.
camera.snapshotanswersnot_availablein a headless world; use a rendered session for images.
#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:
POST /v1/uploadswith{"kind": "asset", "name": "…", "type": "vehicle", "bytes": <size>}. Use"kind": "bundle"for a.mpscene. The answer has the uploadid,part_bytes(64 MiB) andparts.PUT /v1/uploads/{id}/parts/{n}for n = 0 … parts − 1, with each slice of the file as the body. Every part ispart_byteslong except the last. Parts may go in any order or in parallel; send a failed one again.POST /v1/uploads/{id}/completechecks the file and stores it, asPOST /v1/assetsorPOST /v1/scenes/importwould.
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:
- over MCP:
chat_inboxwaits for messages,chat_replyanswers, andprogress: trueshows a status line; - over REST:
GET /v1/agent/inbox?after=&wait=20, thenPOST /v1/drafts/{draft}/messages; - in the SDKs:
earth.agent.listen()andearth.agent.reply(); - or by webhook: set an https address in the panel (Connect…). Each message the creator writes is POSTed
there, signed with
X-Metaplanets-Signature: sha256=<HMAC-SHA256 of the body>; the secret is shown once. Webhooks go to public addresses only.
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:
chat_inbox,chat_reply,chat_history;scene_list,scene_create,draft_open,draft_status,scene_read;scene_propose,changeset_wait;script_write,script_check,asset_search,asset_info;playtest_run,playtest_result,docs_get.
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):
player:{"mode": "vehicle", "vehicle": "<entity>"},on_foot,free_cameraorspectator.rules:score(start,goal),lives,countdown_s,checkpoints(trigger ids in order),win(score,checkpoints,survive,script) andlose(lives,countdown,script). A HUD shows them. Events:rules.changed,checkpoint.reached,game.won,game.lost. Methods:rules.get,rules.set.input: named actions with default keys. Scripts getinputevents for those actions only, and touch screens get buttons.ui: panels of widgets (text,bar,button,list,image,timer) placed at an anchor. Text is always plain text. Methods:ui.set,ui.clear,ui.toast; buttons sendui.click.store: declared per-player keys and leaderboards (store.get,store.set,store.submit,store.top).
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.
- Players run it in their own browser and GPU (WebGPU); no hosted session is made.
- Plays count on the creator's account, and a link works only while the creator's plan is in good standing.
- Players sign in with a Metaplanets account to play. Visibility is
unlisted(any signed-in player with the link) orprivate(members of the account). There is no public gallery yet. - Per-player values and leaderboards are kept per experience, under the player's Metaplanets account; leaderboards show players' Metaplanets usernames. The world runs on the player's machine, so treat stored values and leaderboards as unverified.
- Anyone who plays an experience can, in principle, copy its models and textures.
#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>
- The world only starts on the key's origins. Calls from your page are metered like REST calls.
- To avoid exposing a key, mint a short-lived token on your server with
POST /v1/embed-tokensand pass it asembed-token. - Full page:
<EARTH_URL>/sdk/examples/embed/index.html. Free snippet:<div data-earth-snippet data-lat="…" data-lon="…"></div><script src="<EARTH_URL>/embed.js"></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 |
- Sessions end after 6 idle hours and on server restarts (
session.closed). Create, use, delete. - Session creation is safe to retry with
Idempotency-Key(the SDKs send one). - One request lasts at most 80 s.
world.gotoandvehicle.drivewithwait: truecan take longer: the SDKs keep waiting up to yourtimeout_s. Over plain HTTP, a trip still under way after 80 s answersworld_timeoutand continues (pollworld.status), and a waiting drive answersoutcome: "timeout"while the vehicle keeps driving (pollvehicle.telemetry:route.state). - Secret keys are refused in pages and URLs. Browsers use publishable keys, embed tokens or view tokens
(
POST /v1/sessions/{id}/view-tokens).
#7. Versioning and support
/v1only gains methods and fields; breaking changes come as a new version, with notice. Responses carryEarth-Version.- Support: your Metaplanets contact. Include the
x-request-id.