Deployments
Update a project's deployment settings
Change a project's g1t.page deployment settings; only what you give changes.
/workspaces/{workspace}/projects/{project}/deployments/settingsenabled: true turns Deployments on, as Turn on deployments under Settings → Deployments does: production starts building from the default branch at once, and every pull request gets a preview. That needs the g1t plan on the workspace (refused with payment_required otherwise; an owner starts it under Billing), and is refused for a project set to be a library, a tool or other until update_project makes it an app. enabled: false takes production and every preview down now and stops building; turning production or previews off takes those apps down. build_command, output_dir and dockerfile take null or “” to go back to what is found by itself; idle_days is 1 to 90; build_as is auto, static, workers or docker; instance_type is a container size (lite, basic, standard-1 to standard-4). Needs the Admin role on the project’s repository. Returns the settings as get_deployment_settings does.
Only the fields given change. enabled: true turns Deployments on: production starts building from the default branch at once (an empty repository’s first push to it deploys), and every pull request gets a preview. It is refused with 402 payment_required when the workspace does not have the g1t plan, saying where an owner starts it, and with 409 conflict for a project set to be a library, a tool or other (change kind with update_project first). enabled: false takes production and every preview down at once. build_command, output_dir and dockerfile given as null or "" go back to what is found by itself; idle_days is 1 to 90; anything else is refused with 422 invalid. Needs the Admin role on the project’s repository (403 otherwise, saying so) and a token with repo:admin. To turn them on as a repository is made, give deploy: true to create_repo. See Turn on deployments.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
workflowwithactionupdate_deployment_settings, and the same inputs - Scope: An access token needs
repo:admin.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
workspace |
string | Yes | The workspace’s slug, e.g. “flagon-io”. |
project |
string | Yes | The project’s slug, as in g1t.sh/{workspace}/{project}; a repository’s own project has its name. |
Body parameters
Section titled “Body parameters”Send a JSON object. Names are snake_case, as in responses; the camelCase spelling is accepted too.
| Name | Type | Required | Description |
|---|---|---|---|
enabled |
boolean | No | Turn Deployments on (production builds at once; needs the g1t plan) or off (every app comes down). |
production |
boolean | No | Deploy the default branch to production on every push. |
previews |
boolean | No | A preview for every branch with an open pull request. |
build_as |
string | No | What it is built as; auto finds it from its files. One of auto, static, workers, docker. |
build_command |
string or null | No | Runs instead of the project’s own build script; null or “” for its own. |
output_dir |
string or null | No | What a static site serves; null or “” to find it by itself. |
dockerfile |
string or null | No | For a container: its Dockerfile’s path inside the project; null or “” for Dockerfile or Containerfile. |
instance_type |
string | No | For a container: the size it runs at. One of lite, basic, standard-1, standard-2, standard-3, standard-4. |
idle_days |
integer | No | A preview no one visits for this many days comes down. |
via_workflow |
boolean | No | Build through the deploy workflow g1t manages for the project, listed under Actions. |
Example request
Section titled “Example request”curl -X PATCH https://api.g1t.sh/workspaces/flagon-io/projects/session-lab/deployments/settings \ -H "Authorization: Bearer $G1T_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enabled": true }'Example response
Section titled “Example response”A successful request answers 200 with:
{ "workspace": "flagon-io", "project": "session-lab", "enabled": true, "production": true, "previews": true, "production_url": "https://session-lab-flagonio.g1t.page", "primary_domain": null, "build_as": "auto", "build_command": null, "output_dir": null, "dockerfile": null, "instance_type": "lite", "idle_days": 7, "via_workflow": false, "detected": null, "framework": null}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 409 | conflict |
The request conflicts with the current state. |
| 422 | invalid |
The input is not valid. message says which field and why. |