sandboxes

A short-lived token a browser uses to reach this one sandbox directly.

The token runs commands, reads and writes files and reaches previews in this sandbox only, and cannot stop, pause, extend, fork, snapshot or change it, create anything, or reach anything else. It acts as this key's agent and ends when this key is revoked. Lasts ttlSeconds (3600 unless asked, 60 to 86400). Needs a key that may run commands in the sandbox. The token is in this answer only.

post/v1/sandboxes/{id}/sessions

Request

  • Base URL: https://api.withruntime.com
  • URL: https://api.withruntime.com/v1/sandboxes/{id}/sessions
  • Auth: HTTP bearer

Path parameters

idstring required

Resource identifier (UUID).

Headers

Idempotency-Keystring

Replaying the same key with the same request within 24 hours returns the first result and never repeats the effect. A refusal is not kept: a request refused before it ran (no_capacity, busy, a limit) runs afresh when sent again with its key. The SDKs send one automatically; the server makes one when absent and returns it in the idempotency-key response header.

Request body

ttlSecondsinteger

How long it lasts, in seconds: an hour unless asked, a day at most.

originsstring[]

The pages that may use it: exact origins, https://host[:port], or http://localhost[:port] while developing. The API answers CORS for these and refuses a request from any other page. Leave empty for a session used only outside a browser.

namestring

Your own handle for it, such as the user it is for.

Response

Success

idstring uuid
sandboxIdstring uuid
namestring nullable
originsstring[]
createdBystring

The agent whose key made it; the session acts as it.

createdAtstring date-time
expiresAtstring date-time
revokedAtstring date-time nullable
state'active' | 'expired' | 'revoked'
tokenstring nullable

The bearer token, shown once. Null when this answer replays an earlier create with the same Idempotency-Key: revoke that session and make a new one.

apiUrlstring

Where the session is used: this API's origin.

Changes

No recorded changes to this operation across all 1 revision of this API.