inis.run

Self API

The small HTTP API a workload inside a session uses to pause itself, describe itself, emit events and ask your backend a question.

A process inside a session can talk to the platform at http://169.254.169.254, plain HTTP on port 80. It is separate from the public API: no API key, no SDK, any HTTP client works. The session is identified by the VM the request came from, so a workload cannot address another session.

curl http://169.254.169.254/v1/self        # which capabilities are on
curl http://169.254.169.254/v1/self/info   # session id, template, size
curl -X POST http://169.254.169.254/v1/self/pause
EndpointWhat it does
GET /v1/selfCapabilities and switch state: {"capabilities": {"info": true, "pause": true, "events": false, "request": false, ...}}
GET /v1/self/infoSession id, template, size, vCPUs, memory, created_at, max_lifetime_ms. No secrets
POST /v1/self/pausePause this session now. Optional body {"unless_ingress_within_seconds": N} (1 to 86400) refuses with 409 if a request reached the session more recently than that
POST /v1/self/eventsSend an event to your webhooks. Needs events: true at create
POST /v1/self/requestAsk your backend a question and read its JSON answer. Needs request: true at create

events and request are off by default. Opt in per session in POST /v1/sessions:

{ "events": true, "request": true }

Without the switch, the call returns 403 {"error":"self_api_disabled"}. GET /v1/sessions/{id} reports the switches as self_api: {"events": …, "request": …} on a live read; the field is omitted when the session is not live, which means unknown, not off. A fork inherits its parent's switches.

Both calls take the same body, at most 16 KiB:

{"type": "order.created", "data": {"order_id": 123}}
FieldNotes
typeUp to 64 characters of a-z 0-9 . _ -. Required for both calls: a missing or empty type is refused with 400 {"error":"invalid_type"}. For events, a non-empty type that is too long or uses other characters is sent as guest.event
dataAny JSON, delivered unchanged

Events

POST /v1/self/events queues a delivery to your webhook endpoints and answers 202 {"status":"accepted","endpoints":N}. endpoints is how many endpoints matched. 0 means nobody is listening and nothing was stored.

Your endpoint receives the standard event envelope with event_type set to guest.<type> and data set to:

{"source": "guest", "type": "order.created", "payload": {"order_id": 123}}

source is always guest. Treat payload as untrusted input. Delivery, retries and signing are the same as for other webhooks. A session may have at most 500 undelivered guest deliveries; past that the call returns 503. Other refusals: 400 invalid_type for a missing type, 413 over 16 KiB, 429 rate limited.

Request

POST /v1/self/request is a synchronous question to your backend. Register one HTTPS URL per account (owner or admin):

Endpoint
POST /v1/org/request-endpointCreate, body {"url": "https://..."}. The response includes secret once. A second create is 409
GET /v1/org/request-endpointRead. 404 if none. No secret
POST /v1/org/request-endpoint/rotate-secretNew secret, shown once
DELETE /v1/org/request-endpointRemove

The URL must be HTTPS. Redirects are not followed and private or link-local addresses are refused.

Your endpoint receives:

POST <your url>
Content-Type: application/json
Inis-Signature: t=<unix>,v1=<hex>
Inis-Request-Id: greq_...

{"kind":"guest.request","session_id":"...","request_id":"greq_...",
 "data":{"source":"guest","type":"order.created","payload":{"order_id":123}}}

Inis-Signature is verified exactly like a webhook. Resolve session_id inside your own account and enforce your own policy.

Your endpoint must reply with a JSON object or array of at most 16 KiB, within about 25 seconds. A reply that is not JSON (including a 200 with an HTML or plain-text body), is too large, redirects, or cannot be reached becomes 502 {"error":"tenant unreachable","code":"tenant_unreachable"} in the workload. A reply that takes too long becomes 504 {"error":"tenant timeout","code":"tenant_timeout"}. Headers are not passed back.

The workload sees:

{"status": "answered", "http_status": 200, "body": {"ok": true}}

Any status your endpoint returns (2xx, 4xx, 5xx) is answered; http_status carries it. Other refusals: 403 self_api_disabled, 404 no_request_endpoint, 400 invalid_type, 413 payload_too_large, 429 rate_limited.

There is no retry and no deduplication. After 502 or 504 the outcome is unknown, so retry only with the same idempotency key inside data (for example request_id); Inis-Request-Id changes on every attempt. The session cannot pause itself while a request is in flight.

On this page