v8

latestOpenAPI 3.0.0Apache 2.0raw.githubusercontent.com2025-10-165266542.4 MB
DigitalOcean-public.v2-new_Apps

Update an App

Update an existing app by submitting a new app specification. For documentation on app specifications (AppSpec objects), please refer to the product documentation.

put/v2/apps/{id}

Path parameters

idstring required

The ID of the app

Request body

update_all_source_versionsboolean

Whether or not to update the source versions (for example fetching a new commit or image digest) of all components. By default (when this is false) only newly added sources will be updated to avoid changes like updating the scale of a component from also updating the respective code.

Example request

{
  "spec": {
    "name": "web-app-01",
    "region": "nyc",
    "domains": [
      {
        "domain": "app.example.com",
        "type": "DEFAULT",
        "wildcard": true,
        "zone": "example.com",
        "minimum_tls_version": "1.3"
      }
    ],
    "services": [
      {
        "name": "api",
        "git": {
          "branch": "main",
          "repo_clone_url": "https://github.com/digitalocean/sample-golang.git"
        },
        "github": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "gitlab": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "bitbucket": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "image": {
          "registry": "registry.hub.docker.com",
          "registry_type": "DOCR",
          "registry_credentials": "my-dockerhub-username:dckr_pat_the_access_token",
          "repository": "origin/master",
          "tag": "latest",
          "digest": "sha256:795e91610e9cccb7bb80893fbabf9c808df7d52ae1f39cd1158618b4a33041ac",
          "deploy_on_push": {
            "enabled": true
          }
        },
        "dockerfile_path": "path/to/Dockerfile",
        "build_command": "npm run build",
        "run_command": "bin/api",
        "source_dir": "path/to/dir",
        "envs": [
          {
            "key": "BASE_URL",
            "scope": "BUILD_TIME",
            "type": "GENERAL",
            "value": "http://example.com"
          }
        ],
        "environment_slug": "node-js",
        "log_destinations": [
          {
            "name": "my_log_destination",
            "papertrail": {
              "endpoint": "https://mypapertrailendpoint.com"
            },
            "datadog": {
              "endpoint": "https://mydatadogendpoint.com",
              "api_key": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "logtail": {
              "token": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "open_search": {
              "endpoint": "https://example.com:9300",
              "basic_auth": {
                "user": "apps_user",
                "password": "password1"
              },
              "index_name": "logs",
              "cluster_name": "my-opensearch-cluster"
            }
          }
        ],
        "instance_count": 2,
        "instance_size_slug": "apps-s-1vcpu-0.5gb",
        "autoscaling": {
          "min_instance_count": 2,
          "max_instance_count": 3,
          "metrics": {
            "cpu": {
              "percent": 75
            }
          }
        },
        "cors": {
          "allow_origins": [
            {
              "exact": "https://www.example.com"
            },
            {
              "regex": "^.*example.com"
            }
          ],
          "allow_methods": [
            "GET",
            "OPTIONS",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ],
          "allow_headers": [
            "Content-Type",
            "X-Custom-Header"
          ],
          "expose_headers": [
            "Content-Encoding",
            "X-Custom-Header"
          ],
          "max_age": "5h30m"
        },
        "health_check": {
          "failure_threshold": 2,
          "port": 80,
          "http_path": "/health",
          "initial_delay_seconds": 30,
          "period_seconds": 60,
          "success_threshold": 3,
          "timeout_seconds": 45
        },
        "liveness_health_check": {
          "failure_threshold": 18,
          "port": 80,
          "http_path": "/health",
          "initial_delay_seconds": 30,
          "period_seconds": 10,
          "success_threshold": 1,
          "timeout_seconds": 1
        },
        "protocol": "HTTP",
        "http_port": 3000,
        "internal_ports": [
          80,
          443
        ],
        "routes": [
          {
            "path": "/api",
            "preserve_path_prefix": true
          }
        ],
        "termination": {
          "drain_seconds": 15,
          "grace_period_seconds": 120
        }
      }
    ],
    "static_sites": [
      {
        "name": "api",
        "git": {
          "branch": "main",
          "repo_clone_url": "https://github.com/digitalocean/sample-golang.git"
        },
        "github": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "gitlab": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "bitbucket": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "image": {
          "registry": "registry.hub.docker.com",
          "registry_type": "DOCR",
          "registry_credentials": "my-dockerhub-username:dckr_pat_the_access_token",
          "repository": "origin/master",
          "tag": "latest",
          "digest": "sha256:795e91610e9cccb7bb80893fbabf9c808df7d52ae1f39cd1158618b4a33041ac",
          "deploy_on_push": {
            "enabled": true
          }
        },
        "dockerfile_path": "path/to/Dockerfile",
        "build_command": "npm run build",
        "run_command": "bin/api",
        "source_dir": "path/to/dir",
        "envs": [
          {
            "key": "BASE_URL",
            "scope": "BUILD_TIME",
            "type": "GENERAL",
            "value": "http://example.com"
          }
        ],
        "environment_slug": "node-js",
        "log_destinations": [
          {
            "name": "my_log_destination",
            "papertrail": {
              "endpoint": "https://mypapertrailendpoint.com"
            },
            "datadog": {
              "endpoint": "https://mydatadogendpoint.com",
              "api_key": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "logtail": {
              "token": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "open_search": {
              "endpoint": "https://example.com:9300",
              "basic_auth": {
                "user": "apps_user",
                "password": "password1"
              },
              "index_name": "logs",
              "cluster_name": "my-opensearch-cluster"
            }
          }
        ],
        "index_document": "main.html",
        "error_document": "error.html",
        "catchall_document": "index.html",
        "output_dir": "dist/",
        "cors": {
          "allow_origins": [
            {
              "exact": "https://www.example.com"
            },
            {
              "regex": "^.*example.com"
            }
          ],
          "allow_methods": [
            "GET",
            "OPTIONS",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ],
          "allow_headers": [
            "Content-Type",
            "X-Custom-Header"
          ],
          "expose_headers": [
            "Content-Encoding",
            "X-Custom-Header"
          ],
          "max_age": "5h30m"
        },
        "routes": [
          {
            "path": "/api",
            "preserve_path_prefix": true
          }
        ]
      }
    ],
    "jobs": [
      {
        "name": "api",
        "git": {
          "branch": "main",
          "repo_clone_url": "https://github.com/digitalocean/sample-golang.git"
        },
        "github": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "gitlab": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "bitbucket": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "image": {
          "registry": "registry.hub.docker.com",
          "registry_type": "DOCR",
          "registry_credentials": "my-dockerhub-username:dckr_pat_the_access_token",
          "repository": "origin/master",
          "tag": "latest",
          "digest": "sha256:795e91610e9cccb7bb80893fbabf9c808df7d52ae1f39cd1158618b4a33041ac",
          "deploy_on_push": {
            "enabled": true
          }
        },
        "dockerfile_path": "path/to/Dockerfile",
        "build_command": "npm run build",
        "run_command": "bin/api",
        "source_dir": "path/to/dir",
        "envs": [
          {
            "key": "BASE_URL",
            "scope": "BUILD_TIME",
            "type": "GENERAL",
            "value": "http://example.com"
          }
        ],
        "environment_slug": "node-js",
        "log_destinations": [
          {
            "name": "my_log_destination",
            "papertrail": {
              "endpoint": "https://mypapertrailendpoint.com"
            },
            "datadog": {
              "endpoint": "https://mydatadogendpoint.com",
              "api_key": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "logtail": {
              "token": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "open_search": {
              "endpoint": "https://example.com:9300",
              "basic_auth": {
                "user": "apps_user",
                "password": "password1"
              },
              "index_name": "logs",
              "cluster_name": "my-opensearch-cluster"
            }
          }
        ],
        "instance_count": 2,
        "instance_size_slug": "apps-s-1vcpu-0.5gb",
        "autoscaling": {
          "min_instance_count": 2,
          "max_instance_count": 3,
          "metrics": {
            "cpu": {
              "percent": 75
            }
          }
        },
        "kind": "PRE_DEPLOY",
        "termination": {
          "grace_period_seconds": 120
        }
      }
    ],
    "workers": [
      {
        "name": "api",
        "git": {
          "branch": "main",
          "repo_clone_url": "https://github.com/digitalocean/sample-golang.git"
        },
        "github": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "gitlab": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "bitbucket": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "image": {
          "registry": "registry.hub.docker.com",
          "registry_type": "DOCR",
          "registry_credentials": "my-dockerhub-username:dckr_pat_the_access_token",
          "repository": "origin/master",
          "tag": "latest",
          "digest": "sha256:795e91610e9cccb7bb80893fbabf9c808df7d52ae1f39cd1158618b4a33041ac",
          "deploy_on_push": {
            "enabled": true
          }
        },
        "dockerfile_path": "path/to/Dockerfile",
        "build_command": "npm run build",
        "run_command": "bin/api",
        "source_dir": "path/to/dir",
        "envs": [
          {
            "key": "BASE_URL",
            "scope": "BUILD_TIME",
            "type": "GENERAL",
            "value": "http://example.com"
          }
        ],
        "environment_slug": "node-js",
        "log_destinations": [
          {
            "name": "my_log_destination",
            "papertrail": {
              "endpoint": "https://mypapertrailendpoint.com"
            },
            "datadog": {
              "endpoint": "https://mydatadogendpoint.com",
              "api_key": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "logtail": {
              "token": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "open_search": {
              "endpoint": "https://example.com:9300",
              "basic_auth": {
                "user": "apps_user",
                "password": "password1"
              },
              "index_name": "logs",
              "cluster_name": "my-opensearch-cluster"
            }
          }
        ],
        "instance_count": 2,
        "instance_size_slug": "apps-s-1vcpu-0.5gb",
        "autoscaling": {
          "min_instance_count": 2,
          "max_instance_count": 3,
          "metrics": {
            "cpu": {
              "percent": 75
            }
          }
        },
        "termination": {
          "grace_period_seconds": 120
        },
        "liveness_health_check": {
          "failure_threshold": 18,
          "port": 80,
          "http_path": "/health",
          "initial_delay_seconds": 30,
          "period_seconds": 10,
          "success_threshold": 1,
          "timeout_seconds": 1
        }
      }
    ],
    "functions": [
      {
        "cors": {
          "allow_origins": [
            {
              "exact": "https://www.example.com"
            },
            {
              "regex": "^.*example.com"
            }
          ],
          "allow_methods": [
            "GET",
            "OPTIONS",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ],
          "allow_headers": [
            "Content-Type",
            "X-Custom-Header"
          ],
          "expose_headers": [
            "Content-Encoding",
            "X-Custom-Header"
          ],
          "max_age": "5h30m"
        },
        "routes": [
          {
            "path": "/api",
            "preserve_path_prefix": true
          }
        ],
        "name": "api",
        "source_dir": "path/to/dir",
        "alerts": [
          {
            "rule": "CPU_UTILIZATION",
            "operator": "GREATER_THAN",
            "value": 2.32,
            "window": "FIVE_MINUTES"
          }
        ],
        "envs": [
          {
            "key": "BASE_URL",
            "scope": "BUILD_TIME",
            "type": "GENERAL",
            "value": "http://example.com"
          }
        ],
        "git": {
          "branch": "main",
          "repo_clone_url": "https://github.com/digitalocean/sample-golang.git"
        },
        "github": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "gitlab": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "bitbucket": {
          "branch": "main",
          "deploy_on_push": true,
          "repo": "digitalocean/sample-golang"
        },
        "log_destinations": [
          {
            "name": "my_log_destination",
            "papertrail": {
              "endpoint": "https://mypapertrailendpoint.com"
            },
            "datadog": {
              "endpoint": "https://mydatadogendpoint.com",
              "api_key": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "logtail": {
              "token": "abcdefghijklmnopqrstuvwxyz0123456789"
            },
            "open_search": {
              "endpoint": "https://example.com:9300",
              "basic_auth": {
                "user": "apps_user",
                "password": "password1"
              },
              "index_name": "logs",
              "cluster_name": "my-opensearch-cluster"
            }
          }
        ]
      }
    ],
    "databases": [
      {
        "cluster_name": "cluster_name",
        "db_name": "my_db",
        "db_user": "superuser",
        "engine": "PG",
        "name": "prod-db",
        "production": true,
        "version": "12"
      }
    ],
    "ingress": {
      "rules": [
        {
          "match": {
            "path": {
              "prefix": "/api"
            },
            "authority": {
              "exact": "example.com"
            }
          },
          "cors": {
            "allow_origins": [
              {
                "exact": "https://www.example.com"
              },
              {
                "regex": "^.*example.com"
              }
            ],
            "allow_methods": [
              "GET",
              "OPTIONS",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "allow_headers": [
              "Content-Type",
              "X-Custom-Header"
            ],
            "expose_headers": [
              "Content-Encoding",
              "X-Custom-Header"
            ],
            "max_age": "5h30m"
          },
          "component": {
            "name": "web",
            "preserve_path_prefix": "true",
            "rewrite": "/api/v1/"
          },
          "redirect": {
            "uri": "/about",
            "authority": "example.com",
            "port": 443,
            "scheme": "https",
            "redirect_code": 302
          }
        }
      ]
    },
    "egress": {
      "type": "AUTOASSIGN"
    },
    "maintenance": {
      "enabled": true,
      "archive": true,
      "offline_page_url": "https://example.com/offline.html"
    },
    "vpc": {
      "id": "c22d8f48-4bc4-49f5-8ca0-58e7164427ac",
      "egress_ips": [
        {
          "ip": "10.0.0.1"
        }
      ]
    }
  },
  "update_all_source_versions": true
}

Response

A JSON object of the updated app