Request control
From RobFlow 9 only one client operates the Robot at a time. A program that moves the Robot over
the HTTP API, including Start streaming, or that changes what is stored on
it, must first request control and send the returned token with every gated request. Requests
that only read, such as GET requests, need no token.
Request control
POST /api/v3.0/control/request
Response:
{
"token": "…",
"ownerId": "…"
}
The most recent request wins: it takes control from any RobFlow browser session or other
program, without stopping the Robot. Every RobFlow browser session then shows View-only mode. While the PLC
has control over Profinet, the request is rejected with 409 ("Profinet control is enabled").
Disable Profinet control first to take control; see
Single Point of Control.
Send the token
Send the token as the X-Robflow-Control-Token header on every gated request. Without the
header, or with a token that is no longer valid, the request is rejected with 409. The
detail.message is "missing X-Robflow-Control-Token header: …" or "invalid control token: …",
followed by the reason (for example "control is held by another session"). detail also contains
the current owner as kind and ownerId.
Query and release control
GET /api/v3.0/control/ownerreturns{"kind": "frontend" | "profinet" | null, "ownerId": …}.PUT /api/v3.0/control/releasewith theX-Robflow-Control-Tokenheader gives control back.
Gated endpoints
These endpoints require holding control.
Robot motion and settings:
PUT /start-streaming,/set-streaming-feedback-properties,/stop,/stop-joggingPUT /move-joint-angles,/move-cartesian,/move-cartesian-referencedPUT /jog-joint,/jog-multiple-joints,/jog-cartesian,/hand-guidingPUT /global-speed,/payload,/payload-inertial-parameters,/set-tool,/base-shiftPUT /collision_avoidance,/set-collision-detection-params,/desired-robot-statePUT /outputs/{bank_id}/{output_id}PUT /flows/{uuid}/run,/flow-control/run,/flow-control/pause,/flow-control/resume,/flow-control/resume-not-on-trajectory,/flow-control/move-back-to-trajectoryPOST /run-nodePUT /settings,PUT /robot-config/,PUT /robot-config/importPOST /set-peripheral-port-config,POST /reconnect-modbus
Stored Flows, Subflows, Dashboards and Variables:
POST /flows/,POST /flows/import,PATCH /flows/{uuid},DELETE /flows/{uuid},POST /flow-environmentPOST /subflows/,POST /subflows/import,PUT /subflows/{uuid},PATCH /subflows/{uuid},DELETE /subflows/{uuid}POST /dashboards/,POST /dashboards/import,PUT /dashboards/{uuid},PATCH /dashboards/{uuid},DELETE /dashboards/{uuid}POST /variables,POST /variables/import,PATCH /variables/{variable_uuid},PATCH /variables/by-expression/{variable_uuid},DELETE /variables/{variable_uuid}
PUT /stop is gated too: a client without control cannot stop the Robot over the API.
Losing control
An operator who presses Take control in RobFlow, or another program that requests control,
invalidates your token. Your next gated
request is then rejected with 409; request control again to continue.
Calls from RobFlow
A Dashboard's Generic Button (action HTTP Call) and the HTTP Request Node can call a Robot's API with a token. Their Control Token setting offers:
- Send the current session's token (Generic Button only): the token of the RobFlow session the button is pressed in, for a call to the Robot's own API. Without control, the button opens the take-control dialog instead.
- Acquire a token automatically: before the call, RobFlow sends
POST <scheme>://<host>/api/vX.Y/control/requestto the Robot the URL addresses, and sends the call with the returned token. The URL must contain the Robot's API root (…/api/vX.Y/…). Whoever held control of that Robot loses it.
If no token can be had, the call is not sent and RobFlow reports HTTP_REQUEST_ERROR in the
Message Log. Over POST /http-request the same setting is the optional controlToken field,
{"source": "session", "token": "<token>"} or {"source": "acquire"}; when no token can be had,
the response is [-1, "<reason>"].
Example
import requests
BASE = f"http://{robot_ip}/api/v3.0"
response = requests.post(f"{BASE}/control/request", timeout=10)
response.raise_for_status()
token = response.json()["token"]
response = requests.put(
f"{BASE}/start-streaming",
headers={"X-Robflow-Control-Token": token},
json={"mode": 1, "target_frequency": 200, "source_ip": {"address": "192.168.1.99"}},
timeout=10,
)