https://api.ephemera.run. Bodies are JSON. Errors come back with a 4xx or 5xx status and a body like:
Authentication
Requests with a session that change something (
POST, DELETE) must come from the dashboard’s own site: they need its Origin header. Browsers on other sites get no CORS headers, so they can’t read the API with your cookie.
A token or a session sees only its own account’s sandboxes and hosts. Another account’s sandbox or host is “not found”, not “forbidden”, so ids can’t be probed.
Endpoints
/v1/runs needs Postgres; a server keeping its state in files has no run history. The /v1/me, /v1/tokens, /v1/join-codes and device endpoints exist only when GitHub sign-in is set up.
Sandboxes
POST /v1/sandboxes
token_hash is the hex SHA-256 of an access token you make and keep; the host checks requests for the sandbox against it. name is optional: lowercase letters, digits and hyphens, up to 40 characters, starting and ending with a letter or digit. Leave it out and the server makes one up, like amber-dune-42. A bad name gets 400; a name one of the account’s running sandboxes already has gets 409. Every spec field is optional. network is none, allow or open; with allow entries, it defaults to allow.
It answers 201 with the sandbox:
host_url over TLS, checking that its certificate carries host_key. A token over its limits gets 429 with a message saying which limit.
GET /v1/runs
The newest 100, newest first. ?before=<RFC 3339 time> returns the 100 before that time, for paging back.
ended_at is missing while a sandbox runs. name is empty for sandboxes made before names. end_reason is destroyed (the CLI or someone destroyed it), limit (its token ran out of minutes), gone (its host stopped reporting it), failed (the host couldn’t make it) or expired (it reached its maximum lifetime; it ends as soon as its host says so, and DELETE /v1/sandboxes/{id} still returns its signed record while the host keeps it, for an hour).
The host sends the last three when the sandbox ends. exit_code is the last command’s exit code, 124 if its timeout stopped it. It’s missing if no command ran or the last one couldn’t finish. connections_allowed and connections_blocked count the connections its egress proxy let through and refused. All three are missing while a sandbox runs, for one that never started, and for one whose host is older than the server.
GET /v1/usage
With a token, that token’s day; with a session, the whole account’s, without limits.
Hosts
GET /v1/hosts
online: false.
POST /v1/join-codes
ephemera-host join --server URL CODE.
Tokens
GET /v1/tokens
last_used is when the token last made a request. The server writes it at most once a minute per token, so it can be up to a minute behind. It’s missing for a token that was never used.
POST /v1/tokens
201 with the token, and its secret, which is never shown again: