> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instacloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update service

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

Apply several service settings at once (compute and managed databases): rename, always-on, resource ceiling and data volume size. The whole patch is validated before anything applies, and every machine-facing change lands as one reconfigure per machine (one restart, not one per field).



## OpenAPI

````yaml /openapi/project.json patch /projects/{projectId}/services/{serviceId}
openapi: 3.1.0
info:
  title: InstaCloud API — Project level
  version: 0.1.0
  description: >-
    Endpoints under `/projects/{projectId}`: branches, services, deploys,
    secrets, databases, storage, cron, observability, governance. Callable with
    any token whose binding covers the project.


    Generated from the platform's own OpenAPI document
    (https://api.instacloud.com/openapi.json); see the [API
    overview](/reference/api/overview) for authentication and token scopes.
servers:
  - url: https://api.instacloud.com
    description: InstaCloud
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Projects inside an organization.
  - name: Branches
    description: >-
      Branch environments of a project: isolated database, storage and compute
      per branch.
  - name: Services
    description: 'Services on a branch: compute, postgres, storage and managed databases.'
  - name: Deploy
    description: Deploy an image or a source to a compute service.
  - name: Compute
    description: Build output of a compute service.
  - name: Secrets
    description: User secrets, service credentials and how they bind into compute env.
  - name: Database
    description: Postgres databases, extensions, credentials and ad-hoc SQL.
  - name: Storage
    description: Objects in a storage service.
  - name: Backups
    description: Database backups and restores.
  - name: Cron
    description: Scheduled HTTP calls against a service or an external URL.
  - name: Observability
    description: Logs, metrics, deploy events and database insight.
  - name: Governance
    description: Per-project agent policy and the approval queue.
  - name: Audit
    description: The project's event timeline, including agent-ingested events.
  - name: Domains
    description: >-
      Domains bought through InstaCloud, bring-your-own zones and their DNS
      records.
  - name: Billing
    description: Usage, cycles, invoices and credits.
  - name: Templates
    description: Deploy a template into a project.
paths:
  /projects/{projectId}/services/{serviceId}:
    patch:
      tags:
        - Services
      summary: Update service
      description: >-
        **Token scope:** `account` · `org` · `project` — read-only tokens
        refused (not a GET).


        Apply several service settings at once (compute and managed databases):
        rename, always-on, resource ceiling and data volume size. The whole
        patch is validated before anything applies, and every machine-facing
        change lands as one reconfigure per machine (one restart, not one per
        field).
      operationId: updateService
      parameters:
        - schema:
            format: uuid
            type: string
          in: path
          name: projectId
          required: true
        - schema:
            format: uuid
            type: string
          in: path
          name: serviceId
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  maxLength: 256
                  description: >-
                    new service name (lower-kebab, max 39); applied last so the
                    other fields in this request still address the service by
                    its current name
                  type: string
                alwaysOn:
                  description: >-
                    true = machines never autostop (the platform default for new
                    compute services); false = scale-to-zero
                  type: boolean
                memoryMb:
                  description: >-
                    memory ceiling in MB — a multiple of 256, within the
                    per-vCPU band
                  type: integer
                cpu:
                  description: >-
                    vCPU ceiling; requires memoryMb, derived from it when
                    omitted
                  type: integer
                startCommand:
                  maxLength: 8192
                  description: >-
                    Compute runtime startup override via sh -c, including
                    source-built images; overrides the built image CMD on next
                    deploy or restart. Empty resets to image default. Persisted
                    as readable service settings; use secrets for credentials.
                  type: string
                volumeMountPath:
                  description: >-
                    Compute only: container mount path chosen on attachment;
                    defaults to /data. Requires volumeGib only when attaching.
                    Existing path changes are staged until the next deploy.
                  type: string
                volumeGib:
                  description: >-
                    the persistent volume size in whole Gi — attaches when none
                    exists, grows an existing one (never shrinks)
                  type: integer
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  service:
                    $ref: '#/components/schemas/Service'
                  applied:
                    type: array
                    items:
                      description: >-
                        the fields that actually changed: name, alwaysOn,
                        limits, volume, volumeMountPath, startCommand
                      type: string
                  limits:
                    type: object
                    properties:
                      cpu:
                        type: integer
                      memoryMb:
                        type: integer
                    required:
                      - cpu
                      - memoryMb
                  cap:
                    type: object
                    properties:
                      cpu:
                        type: integer
                      memoryMb:
                        type: integer
                      volumeGib:
                        type: integer
                    required:
                      - cpu
                      - memoryMb
                      - volumeGib
                  volume:
                    type: object
                    properties:
                      sizeGib:
                        type: integer
                      mountPath:
                        type: string
                      id:
                        anyOf:
                          - type: string
                          - type: 'null'
                      appliedMountPath:
                        anyOf:
                          - type: string
                          - type: 'null'
                      pending:
                        type: boolean
                    required:
                      - sizeGib
                      - mountPath
                  volumeAttached:
                    description: >-
                      true when this patch attached the volume (it mounts on the
                      next deploy)
                    type: boolean
                required:
                  - applied
        '202':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovalRequired'
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Service:
      description: >-
        A project-level service (postgres | storage | compute | redis | mysql |
        mongodb).
      type: object
      properties:
        id:
          format: uuid
          type: string
        project_id:
          format: uuid
          type: string
        type:
          type: string
          enum:
            - postgres
            - storage
            - compute
            - redis
            - mysql
            - mongodb
        name:
          type: string
        spec:
          description: >-
            compute: {cpu_kind,cpus,memory_mb}; postgres: sized by its instance
            ceiling (cpuMilli/memoryMib)
          type: object
          additionalProperties: true
        machine_count:
          description: compute only
          type: integer
        desired_state:
          description: compute only — developer-set lifecycle intent
          type: string
          enum:
            - running
            - stopped
            - suspended
        always_on:
          description: >-
            compute only — true (the platform default for new compute services):
            machines never scale to zero; false: idle machines suspend and wake
            on request. Billing is actual usage either way.
          type: boolean
        websocket:
          description: >-
            compute only — the app speaks WebSocket, so its machines carry
            connections-based concurrency and a 512 MB guest floor. Re-asserted
            by any redeploy given no flag, including restart. null: never
            recorded.
          type:
            - boolean
            - 'null'
        region:
          type:
            - string
            - 'null'
        domain:
          description: default access domain (postgres/compute)
          type:
            - string
            - 'null'
        public:
          description: storage only — bucket(s) served with anonymous public-read
          type: boolean
        image:
          description: compute only — container image currently run
          type:
            - string
            - 'null'
        port:
          description: >-
            compute/managed database — compute image port, or the private
            database TCP port
          type:
            - integer
            - 'null'
        start_command:
          description: >-
            Runtime startup override via sh -c; null uses the built image
            default. Stored as readable service settings.
          type:
            - string
            - 'null'
        volume_applied_mount_path:
          description: >-
            Last successfully confirmed Compute mount path; null means unknown,
            not proof of a changed path.
          type:
            - string
            - 'null'
        volume_mount_path:
          description: >-
            Compute volume mount path; null or omitted means /data for legacy
            volumes. Changes apply on deployment.
          type:
            - string
            - 'null'
        volume_gib:
          description: >-
            compute/managed database — size (whole Gi) of the persistent data
            volume; null = no volume. Compute can attach/grow via PUT
            .../volume; managed databases are platform-managed in v1
          type:
            - integer
            - 'null'
        pg_version:
          description: >-
            postgres only — the Postgres MAJOR version the service runs (e.g.
            16), known before the instance is ever connected to or woken. Pick
            client tooling (pg_dump/pg_restore/psql) of the same major. null:
            never recorded (a legacy row). The exact server_version of a RUNNING
            instance is on GET .../database/metrics
          type:
            - integer
            - 'null'
        template_deployment_id:
          format: uuid
          description: >-
            the template deployment that created this service (survives branch
            clones); null for services created directly
          type:
            - string
            - 'null'
        template_modified:
          description: >-
            true once the service was reconfigured away from its
            template-deployed spec
          type: boolean
        template_code:
          description: >-
            the template this service was deployed from; null for services
            created directly, and for one whose deployment record has been
            pruned
          type:
            - string
            - 'null'
        template_logo_url:
          description: >-
            the template's mark, absolute and pinned to the commit that
            published it; null when the template is not in the registry (or
            carries no logo). Joined live rather than stored, because a
            republish moves it
          type:
            - string
            - 'null'
        source:
          $ref: '#/components/schemas/ServiceSourceSummary'
        status:
          type: string
          enum:
            - creating
            - active
            - error
            - deleting
            - deleted
        created_at:
          format: date-time
          type: string
    ApprovalRequired:
      type: object
      properties:
        status:
          type: string
          enum:
            - approval_required
        approvalId:
          format: uuid
          type: string
        action:
          description: the gated action, or a comma-joined compound set — prefer `actions`
          type: string
        actions:
          description: every capability this approval covers
          type: array
          items:
            type: string
        message:
          type: string
        url:
          description: the console page where a project admin reviews this request
          type: string
        nextActions:
          type: array
          items:
            $ref: '#/components/schemas/NextAction'
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    ServiceSourceSummary:
      description: >-
        compute only — where the running image comes from: an image somebody
        deployed (type=image) or a connected repository (type=github). Full
        resource: GET /projects/{id}/services/{serviceId}/source
      type: object
      properties:
        type:
          type: string
          enum:
            - image
            - github
        owner:
          type: string
        repo:
          type: string
        branch:
          description: the repo branch this service tracks
          type: string
        auto_deploy:
          description: a push to `branch` rebuilds and redeploys the service
          type: boolean
      required:
        - type
    NextAction:
      type: object
      properties:
        op:
          description: >-
            Neutral logical action id, e.g. "service.add" — NOT an operationId
            or a CLI/MCP tool name; each client maps it to its own surface.
          type: string
        reason:
          description: Natural-language, human/LLM-facing "why do this now".
          type: string
        args:
          description: >-
            Suggested, flat named arguments; "<placeholder>"s where a value is
            unknown.
          type: object
          additionalProperties: true
        gated:
          description: True if the action passes a governance gate.
          type: boolean
      required:
        - op
        - reason
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Session access JWT or an API token (`insta_<prefix>_<secret>`).

````