Skip to main content

API Contract

RUF exposes exactly two HTTP endpoints. Both accept and return JSON.

Headers

Every request should include:

HeaderDescription
x-request-idA unique UUID generated per request. Used for idempotency and optimistic rollback matching.

POST /session/create

Called once when the application starts (or restarts). Establishes the initial session and returns the first screen to render.

Request

{
"screen": "HOME",
"screenParams": {},
"context": {
"os": "ios",
"version": "2.4.1"
},
"previousSessionMeta": {}
}
FieldTypeRequiredDescription
screenstringYesThe initial screen name to load
screenParamsobjectNoRoute-level parameters for the screen
contextobjectYesDevice/environment context (OS, app version, etc.)
previousSessionMetaobjectNoPersisted meta from a previous session, for state restore

Response

Returns a Session object.


POST /session/action

Called for every user interaction. The client sends the current screen, the action to perform, and the full current SessionMeta.

Request

{
"screen": "HOME",
"action": {
"type": "GET_HOME_CONTENT",
"payload": {}
},
"meta": {}
}
FieldTypeRequiredDescription
screenstringYesThe name of the screen where the action originated
action.typestringYesThe action identifier
action.payloadobjectYesAction-specific input data
metaobjectYesThe full current SessionMeta

Response

Returns a Session object. Only fields that changed are included — the response may contain a subset of screens and components.


Session response shape

Both endpoints return the same Session structure:

{
"currentScreen": "HOME",
"screens": {
"HOME": {
"components": {
"appbar": { "behavior": "VISIBLE", "locale": {}, "payload": {} },
"product_list": { "behavior": "VISIBLE", "locale": {}, "payload": {}, "mergeStrategy": { "type": "REPLACE" } }
},
"metrics": [],
"navigationMetrics": []
}
},
"navigation": {
"id": "nav-uuid",
"mode": "PUSH",
"screen": "HOME",
"flow": { "name": "DISCOVERY", "behavior": "START_NEW" },
"transition": "FADE"
},
"actionResult": {
"type": "SUCCESS",
"message": "Welcome back"
},
"meta": {
"token": "..."
},
"debug": {}
}
FieldTypeDescription
currentScreenstringThe screen the client should display after this response
screensobjectMap of screen name → screen payload (partial, only changed screens)
screens[name].componentsobjectMap of relComponent
screens[name].metricsarrayMetrics fired on screen load
screens[name].navigationMetricsarrayMetrics fired when screen becomes active
navigationobjectOptional Navigation directive
actionResultobjectOptional ActionResult
metaobjectPartial SessionMeta patch
debugobjectOptional debug information