---
seo:
  description: >-
    Use the Spacefolder HTTP API to create Worlds, Fold application events, and
    Navigate predictions with a workspace API key.
sidebar:
  label: Overview
title: API reference
---
Use the Spacefolder HTTP API to create Worlds, Fold application events, and Navigate predictions with a workspace API key.

## API conventions

Base URL: `https://api.spacefolder.com/v1`. `/api/v1` is also accepted. Requests and responses use JSON.

Browse Worlds, Fold, and Navigate below, or download [OpenAPI JSON](/docs/spacefolder-api.openapi.json). The domain schemas are generated from the Rust contracts used by the API and SDKs.

### Authentication

Send `Authorization: Bearer YOUR_API_KEY` on each request. Obtain a workspace key in the [platform](https://platform.spacefolder.com/api-keys). Keys grant workspace access until expiry or signing-key rotation; individual revocation is unavailable. Never distribute an operator/admin credential to users.

Create keys in the platform before making API requests. Each key is scoped to its workspace.

### Requests

Create a World before folding or navigating. JSON request bodies are limited to 8 MiB. Use a batch size your application can retry comfortably. Keep event IDs stable when retrying Fold requests. Supply the same required `nav_id` for a recurring decision in a World. Each Navigate request creates its own `run_id`, including retries.

#### Navigate context

Every `POST /navigate` request requires a `context` JSON object containing the user or task information available at decision time. Keys are application-defined. Context describes the immediate situation alongside the World's folded history; continue folding observed events and outcomes.

For example, a prediction without action alternatives can include the movie currently shown to a viewer:

```json
{
  "world_id": "my_app",
  "nav_id": "watch_after_impression",
  "entity_id": "user_123",
  "context": {
    "movie_id": "movie_456",
    "screen": "movie_details"
  },
  "predictions": {
    "watch": {
      "event": "movie_watched",
      "horizon": "1h"
    }
  }
}
```

When updating an older request, give the recurring decision a stable `nav_id` and add `"context": {}` if no decision-time information is available. This applies to HTTP, SDK, and CLI requests, including predictions without actions. Omitting `context`, passing `null`, or passing an array or scalar is invalid. See [Context](/docs/concepts/primitives#context) and the [Navigate request schema](/docs/reference/api/navigate/navigate).

Dates and times are RFC 3339 strings with a timezone, such as `2026-01-09T12:00:00Z`. Elapsed times such as `duration_ms` are numbers.

#### Navigate confidence

Read `confidence` on each scored prediction under `predictions` or `actions.<action>.predictions`. A score is a number from 0 to 1, rounded to hundredths. It measures support from comparable World observations. For an event, `probability` estimates the likelihood of occurrence and `confidence` describes support for that estimate. A numeric series has one score for its least-supported interval.

Treat `0` as a valid score. A `null` or absent field carries no score. A saved run returns the original forecast and confidence along with the latest verification values. See [Confidence](/docs/concepts/primitives#confidence).

### Pagination

World listing uses `limit` (1–100) and a `cursor` from the previous page. Continue using `next_cursor` until it is null.

Fold and Navigate history require `world_id`. Each row identifies one run. Pass `next_cursor` back as `cursor`, keeping the World and any `nav_id` filter consistent. Read a saved result at `GET /navigate/{id}`. It returns the forecast with current verification values. Add `?trace=true` to inspect its original execution.

### Errors

| Status | Meaning |
| --- | --- |
| 400 / 422 | Invalid input, query, or unsupported request |
| 401 / 403 | Missing/invalid credentials or rejected access |
| 404 | Record not found |
| 409 | Conflict, inactive World, or permanently deleted World ID |
| 501 | No verified model runtime configured |
| 503 | Runtime, state, storage, or authentication dependency unavailable |

A non-successful response includes an explanation in its body. Error bodies vary by route: some use an `error` string, others an `error` object. Inspect the HTTP status and returned body. The SDKs preserve status and payload in `SpacefolderApiError`; CLI failures use JSON on stderr.

Deletion can return `202` while cleanup is in progress. Inspect `state` and retry the same confirmed deletion; a `202` is not proof cleanup has completed.

### Agents

Read [/llms.txt](/docs/llms.txt) for the documentation index, [/llms-full.txt](/docs/llms-full.txt) for the full text, or append `.md` to a page URL. Use [/spacefolder-api.openapi.json](/docs/spacefolder-api.openapi.json) for the machine-readable API contract.

Version 0.1.0

Base URL: `https://api.spacefolder.com/v1`

## Worlds

- [`POST /worlds`](/docs/reference/api/worlds/create-world) — Create a world.
- [`GET /worlds`](/docs/reference/api/worlds/list-worlds) — List worlds.
- [`GET /worlds/{id}`](/docs/reference/api/worlds/get-world) — Get a world.
- [`PATCH /worlds/{id}`](/docs/reference/api/worlds/rename-world) — Rename a world.
- [`DELETE /worlds/{id}`](/docs/reference/api/worlds/delete-world) — Delete a world.

## Fold

- [`POST /fold`](/docs/reference/api/fold/fold) — Fold events.
- [`GET /fold`](/docs/reference/api/fold/list-fold-runs) — List Folds.
- [`GET /fold/{id}`](/docs/reference/api/fold/get-fold-detail) — Get a Fold.

## Navigate

- [`POST /navigate`](/docs/reference/api/navigate/navigate) — Navigate predictions.
- [`GET /navigate`](/docs/reference/api/navigate/list-navigate-runs) — List navigations.
- [`GET /navigate/{id}`](/docs/reference/api/navigate/get-navigate-detail) — Get a navigation.
