Docs · API · Quickstart

From a sentence to Unity.

Seven requests take a world from one sentence to a package Unity opens. The Studio does the same in your browser.

  1. 01/GET /v1/me

    Get a token

    Every request carries a token from your TerraKit account. Sign-in opens with the Studio; until then the API is in private testing.

    export TERRAKIT_TOKEN=<your token>
    curl https://terrakit.studio/v1/me -H "Authorization: Bearer $TERRAKIT_TOKEN"

    Answer

    {"id": "9f1c…", "email": "you@studio.com", "credits": 10}
  2. 02/POST /v1/worlds

    Describe a world

    Send a sentence. The planner writes the world's settings, then it is built. Detail is 1025 (Standard), 2049 (High) or 4097 (Very high).

    curl -X POST https://terrakit.studio/v1/worlds -H "Authorization: Bearer $TERRAKIT_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"name":"glacier valley","prompt":"A glacial valley with a braided river and pine on the slopes","detail":1025}'

    Answer

    {"world": {"id": "4b7e…", "name": "glacier valley", "head_version": 0},
     "job": {"id": "c03a…", "kind": "create", "status": "queued", "cost": 2}}
  3. 03/GET /v1/jobs/{job}

    Wait for the build

    A job goes queued, running, then succeeded (or failed, which refunds its credits). Poll it every few seconds. Once the build succeeds, the world's head_version is 1.

    curl https://terrakit.studio/v1/jobs/$JOB -H "Authorization: Bearer $TERRAKIT_TOKEN"

    Answer

    {"id": "c03a…", "status": "running", "progress": 0.42}
  4. 04/POST /v1/worlds/{world}/edits

    Edit it by sentence

    Say what to change. That one thing changes, the rest stays, and the result is a new version. A sentence that changes nothing fails and is refunded.

    curl -X POST https://terrakit.studio/v1/worlds/$WORLD/edits -H "Authorization: Bearer $TERRAKIT_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"instruction":"thin out the trees and raise the lake"}'
  5. 05/POST /v1/worlds/{world}/versions/{n}/exports

    Export it

    Pick an engine: unity (with urp or hdrp), unreal, blender or raw. Export any version.

    curl -X POST https://terrakit.studio/v1/worlds/$WORLD/versions/$VERSION/exports -H "Authorization: Bearer $TERRAKIT_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"format":"unity","pipeline":"urp"}'
  6. 06/GET /v1/jobs/{job}/download

    Download the file

    When the export job succeeds, ask for a short-lived link. The file comes straight from storage.

    curl https://terrakit.studio/v1/jobs/$EXPORT_JOB/download -H "Authorization: Bearer $TERRAKIT_TOKEN"
    curl -o world.unitypackage "<url from the answer>"

    Answer

    {"url": "https://…", "filename": "…_urp.unitypackage", "expires_in": 900}
  7. 07/Unity 6

    Open it in Unity

    Double-click the .unitypackage with a Unity 6 project open, then Import. Terrain, layers, trees and water arrive with nothing to install.