REST API Cloud Sessions

Cloud session routes record the lifetime and account usage for a cloud simulator or build. They do not provision that infrastructure. The service that owns the simulator or build starts the metering session, heartbeats it while the resource is alive, and stops it during teardown.

These routes require the sims scope.

Start a session

POST /api/v1/rnx/sessions
Authorization: Bearer sk_rnx_...
Content-Type: application/json

{
  "kind": "sim",
  "name": "iOS simulator",
  "externalId": "provider-sim-123",
  "device": "iPhone 16 Pro",
  "tier": "semantic",
  "region": "us-west"
}

Use kind: "sim" for simulators and kind: "build" for builds. size selects the simulator meter, so a service hosting a micro simulator must send size: "micro". The optional fields name, externalId, device, tier, and region let the owning service map its resource to the account record. tier accepts semantic or pixel. projectId may also associate the usage with an account resource, and repo (owner/repo) files the session under that repo when the account has linked it.

An API key always starts the session on its own account. If accountId is present and names another account, the request returns 403 forbidden. A session Bearer token names a person rather than an account, so it must send an accountId the signed-in user can access: in the body when starting a session, and as ?accountId=<account-id> when sending a heartbeat, stopping, or listing.

A successful start returns 201:

{
  "session": {
    "id": "rnxbox_...",
    "accountId": "acct_...",
    "externalId": "provider-sim-123",
    "kind": "sim",
    "name": "iOS simulator",
    "status": "running",
    "device": "iPhone 16 Pro",
    "tier": "semantic",
    "region": "us-west",
    "startedAt": 1788072000000,
    "stoppedAt": null,
    "stopReason": null,
    "meteredMs": 0,
    "retailMicrocents": 0,
    "projectId": null,
    "repoId": null
  }
}

Starting a session whose externalId is already running on the account returns 409 invalid_request. Starting a session checks account coverage and the plan's concurrency limit. It returns 402 when the account cannot cover the operation and 429 concurrency_limit when that kind is already at its limit.

Heartbeat a session

POST /api/v1/rnx/sessions/<session-id>
Authorization: Bearer sk_rnx_...

A heartbeat banks elapsed runtime and returns the updated session. Send one at least every five minutes. A session that misses that window is stopped as idle at its last successful heartbeat, so an absent client does not keep accruing usage.

Stop a session

DELETE /api/v1/rnx/sessions/<session-id>
Authorization: Bearer sk_rnx_...

Stopping banks the remaining runtime and returns the session with status: "stopped". An API-key stop records stopReason: "client". Stopping an already stopped session returns 200 with the same stopped session and adds no further charge.

List sessions

GET /api/v1/rnx/sessions
Authorization: Bearer sk_rnx_...

The response contains the account's running and stopped sessions:

{
  "accountId": "acct_...",
  "actor": { "userId": "user_...", "keyId": "ssk_..." },
  "sessions": []
}

actor identifies the caller; keyId is present only for an API key.

API keys read their own account without a query parameter. The optional kind (such as sim or build), status (running or stopped), name, and reference query parameters filter the list.

Metering debits the same usage grants, prepaid balance, and spending limits described under Billing and Limits. See Remote simulator pricing for the current rates.