Undo the last environment change

undo_site_environment

Goes back to the last environment of a site that worked and starts a build of its lines.

POST /v1/undo_site_environmentScopeconfig:writeMakes changes

It does what Undo does in the Environment tab, and works out what to go back to the same way:

  • When the newest save is not the build the machines use and did not work, because it failed, was canceled or is still queued or building, the site goes back to the environment its machines use now.
  • Otherwise it goes back to the newest earlier build that worked with different lines, or to the standard environment when there is none.

When there is nothing to go back to, the call is refused with a 400 reading There is no earlier environment to go back to! and nothing changes. Otherwise it answers like update_site_environment, with the environment after the change.

Pass linesHash, the LinesHash that get_site_environment returned, and the call is refused with a 409 when the lines changed since you read them, in the Environment tab, from chat or from another client. The build counts as one of the site's saves for the day and runs like any other, so follow it with get_site_environment. See Environment.

Request

Call it with a POST to https://api.modulify.ai/v1/undo_site_environment, sending the inputs below as a JSON object. The token needs the config:write scope.

It makes changes, so send an Idempotency-Key header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

curl -X POST https://api.modulify.ai/v1/undo_site_environment \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'

Over MCP, the same method is the undo_site_environment tool.

Inputs

Input Type Required Description
projectId string Yes The site id.
linesHash string No The LinesHash from get_site_environment for the lines you are going back from. When the saved lines changed since, nothing changes and the call is refused with a 409. Leave it out to go back regardless.

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.