curl --request PUT \
--url https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "<string>",
"repo": "<string>",
"type": "github",
"installationId": 123,
"repoId": 123,
"public": true,
"branch": "<string>",
"rootDir": "<string>",
"autoDeploy": true,
"buildCommand": "<string>",
"startCommand": "<string>",
"watchPaths": [
"<string>"
],
"port": 32768
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source"
payload = {
"owner": "<string>",
"repo": "<string>",
"type": "github",
"installationId": 123,
"repoId": 123,
"public": True,
"branch": "<string>",
"rootDir": "<string>",
"autoDeploy": True,
"buildCommand": "<string>",
"startCommand": "<string>",
"watchPaths": ["<string>"],
"port": 32768
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '<string>',
repo: '<string>',
type: 'github',
installationId: 123,
repoId: 123,
public: true,
branch: '<string>',
rootDir: '<string>',
autoDeploy: true,
buildCommand: '<string>',
startCommand: '<string>',
watchPaths: ['<string>'],
port: 32768
})
};
fetch('https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => '<string>',
'repo' => '<string>',
'type' => 'github',
'installationId' => 123,
'repoId' => 123,
'public' => true,
'branch' => '<string>',
'rootDir' => '<string>',
'autoDeploy' => true,
'buildCommand' => '<string>',
'startCommand' => '<string>',
'watchPaths' => [
'<string>'
],
'port' => 32768
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source"
payload := strings.NewReader("{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}"
response = http.request(request)
puts response.read_body{
"source": {
"type": "image",
"image": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner": "<string>",
"repo": "<string>",
"branch": "<string>",
"root_dir": "<string>",
"watch_paths": [
"<string>"
],
"auto_deploy": true,
"public": true,
"installation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repo_id": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_build": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repo_binding_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"commit_sha": "<string>",
"status": "queued",
"image_ref": "<string>",
"error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
},
"build": {
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queued": true,
"serviceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": "<string>",
"approvalId": "<string>",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Set service 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).
curl --request PUT \
--url https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "<string>",
"repo": "<string>",
"type": "github",
"installationId": 123,
"repoId": 123,
"public": true,
"branch": "<string>",
"rootDir": "<string>",
"autoDeploy": true,
"buildCommand": "<string>",
"startCommand": "<string>",
"watchPaths": [
"<string>"
],
"port": 32768
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source"
payload = {
"owner": "<string>",
"repo": "<string>",
"type": "github",
"installationId": 123,
"repoId": 123,
"public": True,
"branch": "<string>",
"rootDir": "<string>",
"autoDeploy": True,
"buildCommand": "<string>",
"startCommand": "<string>",
"watchPaths": ["<string>"],
"port": 32768
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '<string>',
repo: '<string>',
type: 'github',
installationId: 123,
repoId: 123,
public: true,
branch: '<string>',
rootDir: '<string>',
autoDeploy: true,
buildCommand: '<string>',
startCommand: '<string>',
watchPaths: ['<string>'],
port: 32768
})
};
fetch('https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'owner' => '<string>',
'repo' => '<string>',
'type' => 'github',
'installationId' => 123,
'repoId' => 123,
'public' => true,
'branch' => '<string>',
'rootDir' => '<string>',
'autoDeploy' => true,
'buildCommand' => '<string>',
'startCommand' => '<string>',
'watchPaths' => [
'<string>'
],
'port' => 32768
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source"
payload := strings.NewReader("{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/services/{serviceId}/source")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"<string>\",\n \"repo\": \"<string>\",\n \"type\": \"github\",\n \"installationId\": 123,\n \"repoId\": 123,\n \"public\": true,\n \"branch\": \"<string>\",\n \"rootDir\": \"<string>\",\n \"autoDeploy\": true,\n \"buildCommand\": \"<string>\",\n \"startCommand\": \"<string>\",\n \"watchPaths\": [\n \"<string>\"\n ],\n \"port\": 32768\n}"
response = http.request(request)
puts response.read_body{
"source": {
"type": "image",
"image": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"owner": "<string>",
"repo": "<string>",
"branch": "<string>",
"root_dir": "<string>",
"watch_paths": [
"<string>"
],
"auto_deploy": true,
"public": true,
"installation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repo_id": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_build": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repo_binding_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"commit_sha": "<string>",
"status": "queued",
"image_ref": "<string>",
"error": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
},
"build": {
"buildId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"queued": true,
"serviceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"status": "<string>",
"approvalId": "<string>",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Session access JWT or an API token (insta_<prefix>_<secret>).
Body
github GitHub App installation id; required unless public
GitHub repository id; required unless public
a public repo, connected without an App installation: one-shot deploys, auto_deploy is always false
the repo branch to track; default: the repo’s default branch
subdirectory 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
rebuild on every push to branch (default true; must be false or omitted for a public repo)
An 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
the port the app listens on; written to the service
1 <= x <= 65535