List or create units
GET https://repopack.com/api/v0/projects/<key>/apps/<app>/units
Authorization: Bearer <token>
With app.read, returns {app, units} with public unit presentations in creation order. To create a unit, POST the same URL with Content-Type: application/json and {"name":"web","type":"runner","containerfile":"Containerfile","context":".","http_port":6161,"public_unit":true}. name, type (runner or builder) and containerfile are required; context defaults to ., public_unit to false. Optional depends is an array of unit names and health is {type:"none"}, {type:"tcp",port:...}, or {type:"http",path:...}. Requires app.write; an invalid graph/check rolls back the just-created unit and returns 400. Success is {unit, app}. Inspect the list after an uncertain creation response.
Edit or remove one unit
PATCH /api/v0/projects/<key>/apps/<app>/units/<unit> accepts optional type, containerfile, context, http_port, clear_http_port, public_unit, depends, and health in JSON; it returns {app,unit,units}. DELETE that URL removes the named unit and returns {ok:true}. Both require app.write and configurable App access; missing unit is 404, invalid health or incompatible unit graph is 400 or the update helper's refusal. Removing a unit changes configuration for later deployments; do not assume it deletes volume data. See unit env and volumes.