Read the site environment
get_site_environment
Returns the lines of a site's environment, how its last build went and which build its machines use.
A site's environment is the list of lines Modulify adds on top of its own base, Node.js 22 on Debian 12, when it builds the machines for the preview, the live site and its publish build. A packages line installs Debian 12 system packages, and a command line runs one setup command while the machine image is built.
The answer holds:
| Field | What it holds |
|---|---|
Allowed |
Whether the site can change its environment. It is false when the environment is turned off for the site. |
Lines |
The lines saved last. |
LinesHash |
A fingerprint of Lines. Pass it to update_site_environment as linesHash. |
Latest |
That save and its Status: queued, building, ready, failed, canceled or superseded. A failed save also carries Failure, Error, Failed_Line and Excerpt, the last lines the failing line printed. Failure is preview-start when the build worked but the preview did not start on it. |
Active |
The build the machines use, or null for the standard environment. |
Building |
Whether a build is waiting or running. |
History |
The last saves, newest first. |
Live |
Published, and UpToDate when the live site already runs the newest environment that works. |
Limits |
How many lines the site can hold, how many saves it gets a day and how many it has used today. |
Dockerfile |
The Dockerfile Modulify builds the preview from the saved lines, the same file View as Dockerfile shows. It is empty on the standard environment. |
While Building is true, read it again every 10 to 15 seconds to follow the build until Latest.Status is no longer queued or building. The preview moves to a new build once it works and only if it starts on it; otherwise it keeps the environment it had. The live site uses a new build from its next publish, and a publish started while a build runs waits for it. See Environment.
Request
Call it with a POST to https://api.modulify.ai/v1/get_site_environment, sending the inputs below as a JSON object. The token needs the config:read scope.
It only reads and changes nothing, so retrying it is safe.
curl -X POST https://api.modulify.ai/v1/get_site_environment \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"projectId":"PROJECT_ID"}'Over MCP, the same method is the get_site_environment tool.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
Response
Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.