Machine Preview Probe
Machine Preview Probe
/v2/machines/{machine_id}/preview/probeReport whether anything is serving HTTP on a port of the machine right now. A preview link is minted whether or not anything listens on its port, so use this to wait for the app to start before you open the link. It sends one GET to the root of the port through the same provider URL the preview link opens, and answers with the port and a serving flag. A 502, 503 or 504 answer, or a connection failure, means serving is false. Any other status means serving is true, including a redirect or an error page from the app itself. If no status arrives within 5 seconds, serving is true: a dev server is usually compiling its first page. Side effect: a sleeping machine is transparently resumed first, so this can take a few seconds on a cold sandbox. Minting a link with GET /v2/machines/{machine_id}/preview does not resume it; opening the link does. HTTP 409 with detail "machine has been torn down (dead); cannot open a preview" means the machine no longer exists. HTTP 422 means Modal machines do not support previews, or the port cannot be opened through a preview link (an AWS microVM port that needs extra routing headers); the detail names which. HTTP 502 with detail "failed to reach the machine's preview" means the provider could not be asked.
Path Parameters
machine_idstring · uuidrequiredQuery Parameters
portintegeroptionalPort on the machine to check. Omit to use the machine's default preview port, which is 8000 unless its provider uses another.
curl --request GET \
--url https://api.brainbaselabs.com/v2/machines/{machine_id}/preview/probe \
--header 'Authorization: Bearer YOUR_API_KEY'{
"port": 0,
"serving": true
}