Documentation menu

Set service source

PUThttps://api.instacloud.com/projects/{projectId}/services/{serviceId}/source

Token scope: account · org · project — read-only tokens refused (not a GET).

Connect a repository to this compute service (admin+; replaces any previous source) — the tracked branch is built now and deployed into the service; every later push to it redeploys (unless autoDeploy is false, or the repo is public).

Parameters

NameInTypeRequiredDescription
projectIdpathstringyes
serviceIdpathstringyes

Request body

application/json

FieldTypeRequiredDescription
type"github"no
ownerstringyes
repostringyes
installationIdintegernoGitHub App installation id; required unless public
repoIdintegernoGitHub repository id; required unless public
publicbooleannoa public repo, connected without an App installation: one-shot deploys, auto_deploy is always false
branchstringnothe repo branch to track; default: the repo’s default branch
rootDirstring | nullnosubdirectory to build from (monorepo); relative, no leading / or ..; null/omitted = repo root. It also decides which pushes deploy this service: the build context is this directory, so a push that changed nothing under it is skipped
autoDeploybooleannorebuild on every push to `branch` (default true; must be false or omitted for a public repo)
buildCommandstring | nullno
startCommandstring | nullno
watchPathsstring[] | nullnoAn include list of gitignore patterns, matched against paths RELATIVE TO THE REPOSITORY ROOT rather than to `rootDir` — e.g. ["apps/web/**", "packages/ui/**"]. A push deploys this service only when it changed a matching path; omit or null to fall back to the root-directory rule (a service with `rootDir` deploys when a push changed something under it, one building from the repo root deploys on every push). `!` narrows the list under git's own rule that a path cannot be re-included once an earlier pattern took its directory, so ["apps/web/**", "!**/*.md"] drops apps/web/README.md but not apps/web/docs/guide.md. Inert on a public repo, which cannot auto-deploy at all
portinteger | nullnothe port the app listens on; written to the service

Responses

200

Default Response

FieldTypeRequiredDescription
sourceobjectyesWhere 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.imagestring | nullnotype=image — the image the service runs; null when nothing has been deployed yet
source.idstringno
source.ownerstringno
source.repostringno
source.branchstringnothe repo branch this service tracks; defaults to the repo’s default branch
source.root_dirstring | nullnosubdirectory 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_pathsstring[] | nullnoinclude 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_deploybooleannoa push to `branch` rebuilds and redeploys; always false for a public repo (no App, no webhooks)
source.publicbooleannoconnected as a public repo, without a GitHub App installation
source.installation_idstring | nullno
source.repo_idstring | nullnoGitHub repository id (bigint as string)
source.build_commandstring | nullnocustom build command for source builds without a Dockerfile; null uses automatic detection
source.start_commandstring | nullno
source.created_atstringno
source.updated_atstringno
source.last_buildobject | nullnothe newest build of this service (null before the first)
source.last_build.idstringno
source.last_build.source_idstring | nullnothe service source that queued it; null once that source was disconnected
source.last_build.project_idstringno
source.last_build.service_idstring | nullno
source.last_build.branch_idstring | nullno
source.last_build.commit_shastringno
source.last_build.status"queued" | "fetching" | "building" | "deploying" | "live" | "failed"no
source.last_build.image_refstring | nullno
source.last_build.errorstring | nullno
source.last_build.created_atstringno
source.last_build.updated_atstringno
buildobjectyes
build.buildIdstringyes
build.queuedbooleanyesfalse when this commit already has a build (dedup)
build.serviceIdstringyes

202

Default Response

FieldTypeRequiredDescription
statusstringyes
approvalIdstringyes
actionstringyes
actionsstring[]yes
messagestringyes
urlstringyes

400

Default Response

FieldTypeRequiredDescription
errorstringyes

403

Default Response

FieldTypeRequiredDescription
errorstringyes

404

Default Response

FieldTypeRequiredDescription
errorstringyes

409

Default Response

FieldTypeRequiredDescription
errorstringyes

View as Markdown