Asset Core Docs

Deterministic world-state engine documentation and API references.

Decision Gate docs

HTTP API

Asset Core exposes HTTP APIs through two daemons: the write daemon for commits and the read daemon for queries. This separation keeps writes deterministic and reads fast while preserving a single source of truth.

Overview

The API is RESTful with JSON payloads and mandatory bearer-token authentication. Both daemons provide health endpoints for monitoring, and responses include freshness metadata where applicable. This page summarizes the surface area while the OpenAPI reference provides the full contract.

All data endpoints are namespaced under /v1/write/namespaces/{namespace_id} and /v1/read/namespaces/{namespace_id}. Namespaces are the isolation boundary, so include the correct namespace in every request.

The full specification is available in the OpenAPI reference.

Structure

Auth and Namespace Control Plane

These endpoints let operators inspect principals, enumerate permissions, and manage namespace metadata. Use them for governance workflows and for verifying access before sending commits.

MethodPathDescription
GET/v1/write/auth/whoamiInspect the current principal
GET/v1/write/auth/permissionsList permissions for the current token
GET/v1/write/namespacesList namespaces
GET/v1/write/namespaces/{namespace_id}Fetch namespace details
GET/v1/write/namespaces/changesPoll namespace change feed
GET/v1/write/namespaces/statusList namespace status snapshots
GET/v1/write/namespaces/{namespace_id}/statusGet namespace status
POST/v1/write/namespaces/{namespace_id}/lifecycleProvision or delete a namespace
POST/v1/write/namespaces/{namespace_id}/operational_stateSet namespace operational mode
POST/v1/write/namespaces/{namespace_id}/placementUpdate placement metadata
POST/v1/write/namespaces/fork_from_snapshotFork a namespace from a snapshot

Namespace-Scoped Write Endpoints

These endpoints handle writes. commit/preflight is non-mutating but uses the same validation rules as a real commit. Always use idempotency keys for production commit workloads so retries remain safe.

MethodPathDescription
POST/v1/write/namespaces/{namespace_id}/commitSubmit a transaction
POST/v1/write/namespaces/{namespace_id}/commit/preflightValidate a transaction without mutation
POST/v1/write/namespaces/{namespace_id}/commits/{commit_id}/reverseApply a stored reverse plan from the undo sidecar (conflict-checked)
POST/v1/write/namespaces/{namespace_id}/register_classRegister a new asset class
POST/v1/write/namespaces/{namespace_id}/register_class_shapeRegister a shape for a class
POST/v1/write/namespaces/{namespace_id}/register_class_continuous_shape_1dRegister a continuous 1D shape
POST/v1/write/namespaces/{namespace_id}/register_class_continuous_shape_2dRegister a continuous 2D shape

Namespace-Scoped Read Endpoints

Read endpoints expose projections derived from the commit log and include freshness metadata so you can reason about staleness.

Selected read endpoints are listed below; see the OpenAPI reference for the full catalog.

MethodPathDescription
GET/v1/read/namespaces/{namespace_id}/containersList containers
GET/v1/read/namespaces/{namespace_id}/containers/{id}Get container metadata
GET/v1/read/namespaces/{namespace_id}/containers/{id}/balancesGet container balances
GET/v1/read/namespaces/{namespace_id}/containers/{id}/slotsGet container slots
GET/v1/read/namespaces/{namespace_id}/containers/{id}/grid/cellsGet grid placements
GET/v1/read/namespaces/{namespace_id}/containers/{id}/grid/freeFind free grid space
GET/v1/read/namespaces/{namespace_id}/containers/{id}/contentsUnified container contents
GET/v1/read/namespaces/{namespace_id}/containers/{id}/continuous_1d/placementsContinuous 1D placements
GET/v1/read/namespaces/{namespace_id}/containers/{id}/continuous_2d/placementsContinuous 2D placements
GET/v1/read/namespaces/{namespace_id}/containers/{id}/commitsContainer commit history
GET/v1/read/namespaces/{namespace_id}/commitsCommit history
GET/v1/read/namespaces/{namespace_id}/classesList registered classes
GET/v1/read/namespaces/{namespace_id}/classes/statsClass registry statistics
GET/v1/read/namespaces/{namespace_id}/classes/{id}Get class details
GET/v1/read/namespaces/{namespace_id}/classes/{id}/shapesGet class shapes
GET/v1/read/namespaces/{namespace_id}/instancesList instances
GET/v1/read/namespaces/{namespace_id}/instances/{id}Get instance details
GET/v1/read/namespaces/{namespace_id}/owners/{id}/summaryOwner summary
GET/v1/read/namespaces/{namespace_id}/freshnessGet freshness metadata
GET/v1/read/namespaces/{namespace_id}/replayReplay commit log events
GET/v1/read/namespaces/{namespace_id}/streamStream commits via SSE

Global Health Endpoints

Health and metrics endpoints are designed for load balancers and monitoring systems. They should be part of your standard deployment checks.

MethodPathDescription
GET/v1/write/healthWrite daemon health status
GET/v1/read/healthRead daemon health status
GET/v1/write/livezWrite daemon liveness probe
GET/v1/read/livezRead daemon liveness probe
GET/v1/write/readyzWrite daemon readiness probe
GET/v1/read/readyzRead daemon readiness probe
GET/v1/write/startupzWrite daemon startup probe
GET/v1/read/startupzRead daemon startup probe
GET/v1/write/metricsWrite daemon Prometheus metrics (listener when enabled)
GET/v1/read/metricsRead daemon Prometheus metrics (listener when enabled)

Fields

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer token for the current principal
Content-TypeYesMust be application/json for POST requests
x-assetcore-namespaceConditionalNamespace for read health/probe endpoints when not configured
x-assetcore-min-world-seqNoRequire projection to reach a minimum world sequence
x-correlation-idNoClient correlation ID for tracing

Response Headers

HeaderDescription
x-asset-idempotencyhit if response was served from idempotency cache
Content-TypeAlways application/json

Common Response Fields

Success responses include:

{
  "namespace": 5001,
  "commit_id": "00000000000000000000000000000001",
  "outcome": "Committed",
  "world_seq_start": 42,
  "world_seq_end": 42,
  "event_count": 2,
  "start_time_ms": 1769800000000,
  "commit_time_ms": 1769800000123,
  "server_correlation_id": "wr-0000000000000001-0000000000000042",
  "client_correlation_id": "doc-example-2026-01-15",
  "echo": { ... }
}

Preflight responses include: status, executed_ops, failed_op_index, op_outcomes, and validated_world_seq. See Preflight and Reverse Commit for semantics.

Query responses include freshness:

{
  "server_correlation_id": "rd-0000000000000001-0000000000000042",
  "client_correlation_id": "doc-example-2026-01-15",
  "freshness": {
    "namespace": 5001,
    "world_seq": 42,
    "commit_log_world_seq": 45,
    "lag": 3,
    "lag_ms": 125
  }
}

Examples

Submit a Transaction

curl -X POST http://localhost:8080/v1/write/namespaces/5001/commit \
  -H "Authorization: Bearer $ASSETCORE_WRITE_TOKEN" \
  -H "x-correlation-id: doc-example-2026-01-15" \
  -H "Content-Type: application/json" \
  -d '{
    "operations": [
      {
        "op": "CreateContainer",
        "args": {
          "container_id": 1001,
          "kind": { "type": "balance" },
          "owner": null,
          "policies": null
        }
      }
    ],
    "idempotency_key": "create-container-2026-01-15"
  }'

Response:

{
  "namespace": 5001,
  "commit_id": "00000000000000000000000000000001",
  "outcome": "Committed",
  "world_seq_start": 1,
  "world_seq_end": 1,
  "event_count": 1,
  "start_time_ms": 1769800000000,
  "commit_time_ms": 1769800000123,
  "server_correlation_id": "wr-0000000000000001-0000000000000042",
  "client_correlation_id": "doc-example-2026-01-15",
  "echo": {
    "idempotency_key": "create-container-2026-01-15"
  },
  "created_entities": {
    "containers": [1001]
  }
}

Query Container Balances

curl -H "Authorization: Bearer $ASSETCORE_READ_TOKEN" \
  http://localhost:8081/v1/read/namespaces/5001/containers/1001/balances

Response:

{
  "container_id": 1001,
  "balances": [
    {
      "class_id": 100,
      "key": 1,
      "quantity": 500
    }
  ],
  "server_correlation_id": "rd-0000000000000001-0000000000000042",
  "freshness": {
    "namespace": 5001,
    "world_seq": 1,
    "commit_log_world_seq": 1,
    "lag": 0,
    "lag_ms": 0
  }
}

Check Health

curl -H "Authorization: Bearer $ASSETCORE_ADMIN_TOKEN" \
  http://localhost:8080/v1/write/health

Response:

{
  "status": "healthy",
  "version": "0.1.0",
  "api_version": "0.1.0",
  "build_git_sha": "abc123",
  "uptime_secs": 3600
}