Update service source
PATCHhttps://api.instacloud.com/projects/{projectId}/services/{serviceId}/source
Token scope: account · org · project — read-only tokens refused (not a GET).
Change how a connected service builds (admin+): the tracked branch, root directory, auto-deploy, build/start commands. A branch, root-directory or command change deploys the new configuration now (even at the same commit).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
projectId | path | string | yes | |
serviceId | path | string | yes |
Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
branch | string | no | |
rootDir | string | null | no | |
autoDeploy | boolean | no | |
buildCommand | string | null | no | |
startCommand | string | null | no | |
watchPaths | string[] | null | no |
Responses
200
Default Response
| Field | Type | Required | Description |
|---|---|---|---|
source | object | yes | Where a compute service’s running image comes from: an image somebody deployed (type=image, the absence of a connected source) or a connected repository (type=github). |
source.type | "image" | "github" | yes | |
source.image | string | null | no | type=image — the image the service runs; null when nothing has been deployed yet |
source.id | string | no | |
source.owner | string | no | |
source.repo | string | no | |
source.branch | string | no | the repo branch this service tracks; defaults to the repo’s default branch |
source.root_dir | string | null | no | subdirectory to build from (monorepo); null = repo root. Also decides which pushes deploy this service: the build context is this directory, so a push that changed nothing under it is skipped |
source.watch_paths | string[] | null | no | include list of gitignore patterns, matched against paths relative to the repository root (not to root_dir); a push deploys this service only when it changed a matching path. null/absent falls back to the root-directory rule: a service with root_dir deploys when a push changed something under it, one building from the repo root deploys on every push |
source.auto_deploy | boolean | no | a push to `branch` rebuilds and redeploys; always false for a public repo (no App, no webhooks) |
source.public | boolean | no | connected as a public repo, without a GitHub App installation |
source.installation_id | string | null | no | |
source.repo_id | string | null | no | GitHub repository id (bigint as string) |
source.build_command | string | null | no | custom build command for source builds without a Dockerfile; null uses automatic detection |
source.start_command | string | null | no | |
source.created_at | string | no | |
source.updated_at | string | no | |
source.last_build | object | null | no | the newest build of this service (null before the first) |
source.last_build.id | string | no | |
source.last_build.source_id | string | null | no | the service source that queued it; null once that source was disconnected |
source.last_build.project_id | string | no | |
source.last_build.service_id | string | null | no | |
source.last_build.branch_id | string | null | no | |
source.last_build.commit_sha | string | no | |
source.last_build.status | "queued" | "fetching" | "building" | "deploying" | "live" | "failed" | no | |
source.last_build.image_ref | string | null | no | |
source.last_build.error | string | null | no | |
source.last_build.created_at | string | no | |
source.last_build.updated_at | string | no | |
build | object | no | |
build.buildId | string | yes | |
build.queued | boolean | yes | false when this commit already has a build (dedup) |
build.serviceId | string | yes |
202
Default Response
| Field | Type | Required | Description |
|---|---|---|---|
status | string | yes | |
approvalId | string | yes | |
action | string | yes | |
actions | string[] | yes | |
message | string | yes | |
url | string | yes |
400
Default Response
| Field | Type | Required | Description |
|---|---|---|---|
error | string | yes |
403
Default Response
| Field | Type | Required | Description |
|---|---|---|---|
error | string | yes |
404
Default Response
| Field | Type | Required | Description |
|---|---|---|---|
error | string | yes |