---
title: "POST /projects/{project_id}/service-template/upgrade"
method: POST
path: "/projects/{project_id}/service-template/upgrade"
tags: ["Projects"]
---

# POST /projects/{project_id}/service-template/upgrade

`POST /projects/{project_id}/service-template/upgrade`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/service-template/upgrade`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- UpgradeServiceTemplateRequest
  - `environment_variables` EnvVarInput[]: Values for inputs introduced by the target release. Existing project values are preserved and cannot be overwritten through this endpoint.
    - `is_secret` boolean: Mark the variable as a secret. Secret values are encrypted at rest, masked in list responses, and revealable only through an audited, permission-checked endpoint. Defaults to `false`.
    - `name` string, required: Variable name
    - `value` string, required: Variable value
  - `target_version` string, required: Optimistic target selected from the preview. The server rejects a stale target if the catalog changes between preview and apply.

## Response `200`

Service template upgraded

- ProjectResponse
  - `ai_alert_summaries_enabled` boolean, nullable: Opt-in to AI summarization of metric alert notifications (NULL/false = off).
  - `ai_api_traffic_summary_enabled` boolean, nullable: Opt-in to AI summarization of API traffic analytics (NULL/false = off).
  - `allow_alternate_sources` boolean, nullable: Whether this project also accepts deployments from a source other than `source_type` — chiefly, whether a Git-backed project will take an uploaded source archive (`drop`). `null` or `false` means only the configured `source_type` (plus Docker images and static bundles, which every project accepts) may be deployed.
  - `attack_mode` boolean, required: Attack mode - when enabled, requires CAPTCHA verification for all project environments Kept for one release for consoles that predate Shield modes; it is true exactly when `shield_mode` is `attack`.
  - `created_at` string, date-time, required
  - `cross_project_trace_sharing` boolean, required: ADR-027 Phase 3 opt-out: when false, this project's traces are suppressed from cross-project discovery results. Default true (consistent with the OSS global-observability model where any OtelRead holder can query any project's telemetry).
  - `deployment_config` DeploymentConfig, required: Deployment configuration (resources, autoscaling, features)
    - `antiAffinity` boolean: Anti-affinity: spread replicas across different nodes. When enabled, the scheduler avoids placing two replicas of the same environment on the same node. If there are fewer eligible nodes than replicas, remaining replicas wrap around (best-effort spreading). Defaults to `true` — replicas spread by default.
    - `automaticDeploy` boolean, nullable: Enable automatic deployments on git push. `None` = inherit from project config; `Some(true/false)` = explicit override. Stored as JSONB so absent key → `None` (inherit), never silently defaults to false.
    - `buildLocation` 'control_plane' | 'node' | 'ci', nullable: Where a source deployment's image is built. The control plane is the default and the historical behaviour. `Node` moves the build — the most CPU- and memory-hungry step of a deployment — onto a worker node so it stops competing with the proxy, the database and running workloads on the control plane. A node labelled `temps.sh/role=builder` is preferred; otherwise the node the deployment is placed on builds it. `Node` is a preference, not a requirement: when no worker can take the build (none joined, none of the right architecture, or a multi-architecture build) the build runs on the control plane and the build log says why. A static site may build on a worker of any architecture, since its output is read from that node and never runs.
    - `containerExecEnabled` boolean: Enable container exec/shell access (disabled by default for security)
    - `cpuLimit` integer, nullable: CPU limit in microcores, where 1_000_000 = 1 full CPU core (e.g., 2_000_000 = 2 CPUs). NOT millicores. `None` = uncapped.
    - `cpuRequest` integer, nullable: CPU request in microcores, where 1_000_000 = 1 full CPU core (e.g., 100_000 = 0.1 CPU, 500_000 = 0.5 CPU, 2_000_000 = 2 CPUs). NOT millicores — the deployer formats this as `{n}u` and converts `n / 1_000_000` cores into Docker nano_cpus.
    - `crossArchitectureBuilds` boolean, nullable: Build one image per architecture the eligible nodes run. `None`/`false` (the default) builds exactly once, on the control plane's native platform — byte-for-byte the behaviour of a single-architecture cluster. When enabled and the nodes this deployment could land on span more than one architecture, the build job produces one image per architecture; the non-native ones go through the daemon's `platform` option, which requires QEMU binfmt handlers registered on the control plane. **Opt-in on purpose.** Cross-architecture builds are emulated and substantially slower, and deriving them from cluster topology would mean a single node joining silently changes build behaviour for every deployment in the cluster. It also keeps the decision on operator config rather than on a value each node reports about itself. `Option<bool>` so an environment inherits the project's setting (`None`) or overrides it, matching `automatic_deploy`.
    - `exposedPort` integer, nullable: Port exposed by the container If not specified, will be auto-detected from Docker image or default to 3000
    - `health` HealthCheckConfig, nullable: Health check configuration
      - `command` string[]: Argument vector executed directly inside the container (no implicit shell).
      - `interval` integer: Interval between health checks in seconds (default: 30)
      - `path` string: HTTP path for health checks
      - `retries` integer: Number of consecutive failures before marking unhealthy (default: 3)
      - `stable_for` integer: Continuous running window for a process probe, in seconds.
      - `status` integer: Expected HTTP status code (default: 200)
      - `timeout` integer: Timeout for health check requests in seconds (default: 5)
      - `type` string, nullable: Probe kind. Unset selects HTTP for a declared port, process otherwise.
    - `healthCheckTimeoutSeconds` integer, nullable: How long, in seconds, a new container may take to start and pass its readiness check before the deployment fails. Covers apps that boot slowly (migrations, JIT warm-up, large model loads). `None` = the platform default ([`DEFAULT_HEALTH_CHECK_TIMEOUT_SECONDS`]); valid overrides are [`MIN_HEALTH_CHECK_TIMEOUT_SECONDS`]..= [`MAX_HEALTH_CHECK_TIMEOUT_SECONDS`]. Environments inherit the project value and may override it.
    - `idleTimeoutSeconds` integer: Seconds of inactivity before containers are stopped in on-demand mode. Only used when `on_demand` is true. Min: 60, Max: 86400 (24h). Default: 300 (5 minutes).
    - `loadBalancing` LoadBalancingConfig, nullable
      - `healthCheck` ActiveHealthCheck
        - `enabled` boolean
        - `healthyThreshold` integer
        - `intervalSeconds` integer
        - `path` string, nullable: Origin-relative path; defaults to deployment readiness path, then `/`.
        - `timeoutSeconds` integer
        - `unhealthyThreshold` integer
      - `maxInFlightPerReplica` integer, nullable
      - `preferredNodeIds` integer[]: Ordered node preference; zero denotes the local control plane.
      - `strategy` 'round_robin' | 'preferred_nodes': Replica selection policy. Absent configuration preserves round robin.
    - `maxConcurrentConnections` integer, nullable: Override for the proxy's cap on concurrent in-flight requests to this project/environment's upstream, independent of the timeout overrides above. `None` = inherit the global `connection_limits.default_max_concurrent_connections`. `Some(0)` explicitly forces "unlimited" for this project/environment, overriding a nonzero global default. `Some(n)` for `n > 0` sets an explicit cap — there is no global ceiling clamp here (unlike the timeout settings): an operator who has explicitly set a per-project value has made a deliberate choice and the platform should respect it.
    - `memoryLimit` integer, nullable: Memory limit in megabytes. Three-state semantics: - `None` → inherit the parent layer (env inherits project, project inherits the seeded default); used by the settings UI's "Use default". - `Some(0)` → explicit **uncapped**: stop inheriting and run with no memory limit. This is the deliberate escape hatch for dedicated workloads, distinct from `None`. - `Some(n)` → hard cap of `n` MB. `merge`/resolution keep `Some(0)` as a present value (it wins precedence over a parent cap), and the deployer collapses it to "no limit" before talking to Docker.
    - `memoryRequest` integer, nullable: Memory request in megabytes (e.g., 128 = 128MB)
    - `onDemand` boolean: Enable on-demand mode (scale-to-zero). When enabled, containers are stopped after `idle_timeout_seconds` of no traffic and automatically started when a new request arrives.
    - `performanceMetricsEnabled` boolean: Enable performance metrics collection (speed insights)
    - `replicas` integer: Number of replicas/instances to run Defaults to 1 replica
    - `requestTimeoutSeconds` integer, nullable: Override for the proxy's upstream timeout on regular (non-streaming) HTTP requests to this project/environment, in seconds. `None` = inherit the global `request_timeouts.default_http_timeout_seconds` (which itself defaults to "no timeout"). `Some(0)` explicitly forces "no timeout" for this project/environment, overriding a nonzero global default. `Some(n)` for `n > 0` sets an explicit timeout, always clamped to the global hard ceiling (`request_timeouts.max_request_timeout_seconds`) at resolution time.
    - `security` SecurityConfig, nullable: Security configuration for projects and environments This configuration can be set at three levels: 1. Global (in settings table) - applies to all projects 2. Project level - overrides global settings for specific project 3. Environment level - overrides project settings for specific environment The inheritance chain: Environment > Project > Global
      - `attackMode` string, nullable: Attack mode configuration (future: "off", "challenge", "block") Placeholder for DDoS protection, bot detection, etc.
      - `challengeConfig` ChallengeConfig, nullable: Challenge configuration (future feature) For CAPTCHA, JS challenges, proof-of-work, etc.
        - `challengeType` string, required: Challenge type: "captcha", "js_challenge", "proof_of_work"
        - `difficulty` integer, required: Challenge difficulty level (1-10)
        - `protectedPaths` string[]: Paths that require challenges
      - `enabled` boolean, nullable: Enable/disable security features at this level If None, inherits from parent level
      - `geoRestrictions` GeoRestrictionsConfig, nullable: Geographic restrictions configuration (future feature)
        - `allowedCountries` string[]: Allow traffic only from specific countries
        - `blockedCountries` string[]: Block traffic from specific countries (ISO 3166-1 alpha-2 codes)
      - `headers` SecurityHeadersConfig, nullable: Security headers configuration (subset of global SecurityHeadersSettings)
        - `contentSecurityPolicy` string, nullable: Custom CSP (only used if preset is "custom")
        - `preset` string, nullable: Use a preset: "strict", "moderate", "permissive", "disabled", "custom"
        - `referrerPolicy` string, nullable: Referrer-Policy override
        - `strictTransportSecurity` string, nullable: HSTS override
        - `xFrameOptions` string, nullable: X-Frame-Options override
      - `passwordProtection` PasswordProtectionConfig, nullable: Password protection configuration When enabled, the proxy shows an HTML password form before allowing access. After the user enters the correct password, an HMAC-signed cookie is set so subsequent requests pass through without re-entering the password.
        - `enabled` boolean, required: Whether password protection is enabled
        - `passwordHash` string, required: The bcrypt-hashed password (never stored or returned in plaintext)
      - `rateLimiting` RateLimitConfig, nullable: Rate limiting configuration (subset of global RateLimitSettings)
        - `blacklistIps` string[]: Blacklist specific IPs for this project/environment
        - `maxRequestsPerHour` integer, nullable: Override rate limit per hour
        - `maxRequestsPerMinute` integer, nullable: Override rate limit per minute
        - `whitelistIps` string[]: Whitelist specific IPs for this project/environment
    - `sessionRecordingEnabled` boolean: Enable session recording for analytics
    - `sseIdleTimeoutSeconds` integer, nullable: Override for the proxy's idle timeout on Server-Sent Events streams to this project/environment, in seconds. `None` = inherit the global `request_timeouts.default_sse_idle_timeout_seconds`. `Some(0)` explicitly forces "no timeout". `Some(n)` for `n > 0` is clamped to the global hard ceiling at resolution time.
    - `stopTimeoutSeconds` integer, nullable: How long, in seconds, a superseded deployment's containers get to finish in-flight work after SIGTERM before they are killed, once a new deployment has gone live. Raise it for long requests (uploads, exports, streaming responses, WebSockets). An override is 1 to 3600 seconds. Absent on a project means the platform default of 10 seconds; absent on an environment means it inherits the project's value, else the platform default.
    - `targetLabels` unknown
    - `targetNodes` integer[], nullable: Optional list of node IDs to deploy to. When set, replicas are distributed only across these nodes (round-robin). When None, the scheduler distributes across all active nodes (or deploys locally if no nodes exist).
    - `wakeTimeoutSeconds` integer: Max seconds to wait for containers to start when waking from on-demand sleep. Requests return 503 if exceeded. Default: 30.
    - `websocketIdleTimeoutSeconds` integer, nullable: Override for the proxy's idle timeout on WebSocket connections to this project/environment, in seconds. `None` = inherit the global `request_timeouts.default_websocket_idle_timeout_seconds`. `Some(0)` explicitly forces "no timeout". `Some(n)` for `n > 0` is clamped to the global hard ceiling at resolution time.
  - `directory` string, required
  - `docker_socket` DockerSocketCapability, nullable: Where a project is granted host Docker access, published on the project response so the console can render a badge (granted) or an onboarding state (not granted) instead of the feature being invisible. Deliberately read-only. The grant is host policy; there is no write path, and an API that could set it would be one step from host root.
    - `granted` boolean, required: Whether any host grants this project `/var/run/docker.sock`.
    - `nodes` string[], required: Hosts that grant it: worker node names, plus `control-plane` when this control plane's own environment names the project. Empty when not granted.
    - `reason` string, nullable: Why it is not granted, when `granted` is false. Names the exact variable, value and processes, because the operator is debugging alone.
    - `setup_path` string, nullable: Console path that shows the hosts this could be set on.
  - `enable_preview_environments` boolean, required: Enable automatic preview environment creation for each branch
  - `error_source_context_enabled` boolean, required: Opt-in to native error-tracking source context (false = off). When on, Temps stores uploaded source files and shows source code in stack traces.
  - `error_source_root` string, nullable: Where auto-capture reads source from (relative to the checkout). Null = the deployment's Docker build context.
  - `git_provider_connection_id` integer, nullable
  - `git_provider_type` string, nullable: Git provider behind `git_provider_connection_id`: `github`, `github_app`, `gitlab`, `gitea`, `bitbucket` or `generic`. `null` when the project has no connection (public repository, Docker image or uploaded source). Clients must use this rather than guessing the host from `git_url`: a self-hosted GitLab/Gitea/Bitbucket instance can live on any domain, and a connected project may have no clone URL stored at all.
  - `git_url` string, nullable: Git clone URL for the repository (used for public repos without a provider connection)
  - `github_webhook_id` integer, nullable: GitHub repository webhook ID Temps registered on the connected repository. Only GitHub connections that are not a GitHub App (personal access token, OAuth) get one; App connections receive pushes through the App webhook. `null` when none is installed (another provider, a GitHub App connection, or registration failed / the hook was never created).
  - `gitlab_webhook_id` integer, nullable: GitLab webhook ID installed on the connected repository. `null` when no GitLab webhook is installed (not connected to GitLab, or webhook was removed / never created).
  - `hosting` 'hosted' | 'external', required: `hosted`: Temps builds and runs the app. `external`: the app runs elsewhere (Vercel, Netlify, a VPS) and only sends Temps its analytics, errors and traces; Temps never deploys it.
  - `id` integer, required
  - `image_retention_hours` integer, nullable: Hours to retain built Docker images before nightly cleanup. Null = use the system-wide default from settings.
  - `is_public_repo` boolean, required: Authoritative repository visibility. A missing connection alone does not imply that an incompletely configured repository is public.
  - `last_deployment` string, date-time, nullable
  - `log_ingest_kib_per_sec` integer, nullable: This project's container log ingestion budget in KiB/s. Absent = the platform default; 0 = unlimited.
  - `log_ingest_lines_per_sec` integer, nullable: This project's container log ingestion budget in lines/s. Absent = the platform default (Settings → Monitoring); 0 = unlimited.
  - `main_branch` string, required
  - `name` string, required
  - `preset` string, nullable
  - `preset_config` union: Union type for preset configurations Use the appropriate configuration type based on your preset
    - DockerfilePresetConfig: Configuration for Dockerfile preset
      - `command` string[], nullable: Override image CMD. On creation, omitted/null uses the image default. On partial project updates, omission preserves the stored override; send null to restore the image default.
      - `entrypoint` string[], nullable: Override image ENTRYPOINT. On creation, omitted/null inherits; [] clears it. On partial project updates, omission preserves the stored override; send null to restore the image default, or [] to clear the entrypoint.
      - `buildContext` string, nullable: Custom build context path (relative to repository root) If not specified, uses the project's directory setting
      - `dockerfilePath` string, nullable: Custom Dockerfile path (relative to build context) If not specified, defaults to "Dockerfile" in the build context
      - `imageRuntime` ImageRuntimeConfig, nullable: Editable runtime settings for a single-container image template. Multi-container service templates will use a separate container collection; keeping this shape explicitly singular prevents silently applying one image or command to an unrelated sidecar.
        - `command` string[], nullable: `None` explicitly means "use the image's default command". Keep the serialized `null` when a runtime snapshot exists so clients can distinguish that choice from an omitted runtime setting.
        - `healthCheckPath` string, nullable
        - `imageRef` string, required
      - `variant` 'file' | 'custom' | 'workflow-worker', nullable: Catalog variant persisted under the canonical Dockerfile preset. Existing rows predate this discriminator and therefore deserialize as [`DockerfileVariant::File`].
    - DockerComposePresetConfig: Configuration for Docker Compose
      - `composeOverride` string, nullable: User-provided docker-compose.override.yml content.
      - `composePath` string, nullable: Path to the Compose file relative to the project directory.
      - `publicPorts` ComposePublicPort[]: Compose service ports that should be publicly routed.
        - `healthCheckPath` string, nullable: Optional user override for the public health probe. When absent, Temps uses the path discovered from this service's Compose healthcheck.
        - `port` integer, required: Container port to expose (e.g. 8123)
        - `published` integer, nullable: Optional port published on the Docker host by Compose. The proxy uses this port when Temps runs on the host or reaches a remote node.
        - `service` string, required: Compose service name (e.g. "web", "clickhouse")
      - `relaxedCapabilityServices` string[]: Services granted the limited startup capability profile after explicit approval.
    - NixpacksPresetConfig: Configuration for Nixpacks provider selection and inline build plan
      - `nixpacksConfig` string, nullable: Optional inline nixpacks.toml contents.
      - `providers` NixpacksProvider[]: Ordered Nixpacks providers. Empty means repository config or auto-detect; include `...` to combine auto-detection with explicit providers.
    - StaticPresetConfig: Configuration for static site presets (Vite, Next.js, etc.)
      - `buildCommand` string, nullable: Custom build command (overrides preset default)
      - `buildContext` string, nullable: Custom build context path (relative to repository root) Useful for monorepo setups where the app is in a subdirectory
      - `installCommand` string, nullable: Custom install command (overrides auto-detected package manager)
      - `outputDir` string, nullable: Custom output directory (overrides preset default) Common values: "dist", "build", ".next", "out"
  - `preview_envs_idle_timeout_seconds` integer, required: Idle timeout (seconds) for on-demand preview environments.
  - `preview_envs_on_demand` boolean, required: When true, newly-created preview environments default to on-demand mode (containers stop after the configured idle timeout to save resources).
  - `preview_envs_wake_timeout_seconds` integer, required: Wake timeout (seconds) for on-demand preview environments.
  - `project_type` string, required: Product lifecycle classification. `service` projects are tied to a persisted, versioned template release; this is independent from the deployment transport in `source_type`.
  - `pull_only_root_directory` boolean, required: When true, deploy clones only `directory` via git sparse-checkout.
  - `reachability_warning` ReachabilityWarning, nullable: D5: a successful deploy nobody can open. Computed, never stored.
    - `environment` string, required: The environment's label, as visitors would see it in a hostname.
    - `environment_id` integer, required
    - `fixes` ReachabilityFix[], required: The fixes that fit this install, best first.
      - `command` string, nullable: The command to run, when that is the fix.
      - `connector_id` integer, nullable: For the tunnel fix: the connector that would carry it.
      - `hostname` string, nullable: For the tunnel fix: the hostname it would get.
      - `href` string, nullable: The console page that applies it.
      - `kind` 'tunnel_environment_hosts' | 'preview_domain' | 'custom_domain' | 'worker_ingress', required: One way to fix a [`ReachabilityWarning`], in the order D5 lists them.
      - `label` string, required: What the button and the log line say.
    - `headline` string, required: `Deployed, but nobody can reach <label> yet`.
    - `reason` string, required: Why, about the address visitors would try first.
  - `repo_name` string, nullable
  - `repo_owner` string, nullable
  - `serves_own_temps_api` boolean, required: When true, `/api/_temps*` and `/api/otel*` requests on this project's domains go to the project's app instead of this Temps instance's console. Only for an app that is itself a Temps console or API.
  - `service_template_image_url` string, nullable: Logo from the immutable service-template release applied to this project. Clients should prefer it over a deployed site's favicon.
  - `service_template_version` string, nullable: Exact service-template version currently applied to the project.
  - `shield_mode` 'off' | 'log' | 'selective' | 'attack', required: How Shield acts on verdicts in the project's environments (ADR 066 D1); an environment can set its own.
  - `slug` string, required
  - `source_type` 'external' | 'git' | 'docker_image' | 'static_files' | 'uploaded_source' | 'manual', required: Source type for deployments (git, docker_image, or static_files)
  - `template_slug` string, nullable: Bundled template slug that created this project. Clients use this to present template-specific runtime configuration instead of generic source-build controls.
  - `updated_at` string, date-time, required
  - `vulnerability_scanning_enabled` boolean, required: Opt-in Trivy vulnerability scanning of this project's deployed Docker images. Off by default — project owners explicitly enable it.

## Other responses

- `400`: Invalid or stale upgrade
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Project or template not found

## Changes

- **2026-11-26** `e1864d950604`: 3 breaking
  - the `created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
  - the `last_deployment` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `200`
  - the `updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `200`
- **2026-11-16** `424e15926bbe`: 1 info
  - added the optional property `deployment_config/loadBalancing` to the response with the `200` status
- **2026-11-15** `188ea295ffc6`: 1 warning
  - added the new `workflow-worker` enum value to the `preset_config/oneOf[#/components/schemas/PresetConfigSchema]/oneOf[#/components/schemas/DockerfilePresetConfig]/allOf[subschema #2]/variant/oneOf[#/components/schemas/DockerfileVariant]/` response property for the response status `200`
- **2026-11-15** `72c32d8dee65`: 1 info
  - removed the `workflow-worker` enum value from the `preset_config/oneOf[#/components/schemas/PresetConfigSchema]/oneOf[#/components/schemas/DockerfilePresetConfig]/allOf[subschema #2]/variant/oneOf[#/components/schemas/DockerfileVariant]/` response property for the response status `200`
- …earlier changes not shown

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/service-template/upgrade/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
