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

# Change auto stop

> Change a starting or running instance's max runtime or idle stop. A key left out keeps its value; `null` turns it off. Max runtime counts from when the instance started running, and a change never stops it sooner than 2 minutes from now. `id` may be the instance id or its name if unique in the environment.



## OpenAPI

````yaml /api-reference/openapi.json patch /instances/{id}
openapi: 3.1.0
info:
  title: Runcrate API
  version: 1.0.0
  summary: OpenAI-compatible inference API + GPU infrastructure API.
  description: >-
    Runcrate exposes two API surfaces. The inference API at
    `https://api.runcrate.ai/v1` is OpenAI-compatible: it accepts the standard
    OpenAI SDK with the base URL changed. The infrastructure API at
    `https://www.runcrate.ai/api/v1` manages GPU instances, jobs, persistent
    volumes, environments, SSH keys, templates, and billing. Both share a single
    `rc_live_*` API key.


    Pricing is per-token, per-image, per-second, or per-minute on the inference
    API (varies by model; see https://www.runcrate.ai/api/models/catalog for
    live rates) and per-second on GPU rentals (see
    https://www.runcrate.ai/pricing for hourly rates per GPU class).


    All infrastructure API responses are wrapped in `{ "data": ... }`. List
    responses also include a `meta` object with pagination cursors. Error
    responses use `{ "error": { "code": "...", "message": "..." } }`.
  termsOfService: https://www.runcrate.ai/terms
  contact:
    name: Runcrate
    url: https://www.runcrate.ai/contact
  license:
    name: Proprietary
    url: https://www.runcrate.ai/terms
servers:
  - url: https://api.runcrate.ai/v1
    description: Inference API (OpenAI-compatible)
  - url: https://www.runcrate.ai/api/v1
    description: >-
      Infrastructure API (instances, jobs, storage, environments, ssh-keys,
      templates, billing)
security:
  - ApiKeyAuth: []
tags:
  - name: Chat
    description: OpenAI-compatible chat completions.
  - name: Images
    description: Text-to-image generation.
  - name: Videos
    description: Async text-to-video and image-to-video generation.
  - name: Audio
    description: Text-to-speech and speech-to-text.
  - name: Embeddings
    description: Vector embeddings for RAG and search.
  - name: Models
    description: Model catalog discovery.
  - name: Instances
    description: GPU instance lifecycle.
  - name: Jobs
    description: >-
      Run one command on its own GPU machine. The machine stops, and billing
      ends, when the command exits.
  - name: Schedules
    description: >-
      Start an instance or a job later: once at a set time, or on a repeating
      cron schedule in your timezone.
  - name: Storage
    description: Persistent volume management.
  - name: Environments
    description: Resource isolation containers within a workspace.
  - name: Secrets
    description: >-
      Names of the secrets an environment's machines get. Values are set in the
      dashboard and never returned.
  - name: SSH Keys
    description: SSH key management for instance access.
  - name: Templates
    description: Pre-built instance images and configurations.
  - name: Billing
    description: Credit balance, transactions, usage metrics.
paths:
  /instances/{id}:
    servers:
      - url: https://www.runcrate.ai/api/v1
    patch:
      tags:
        - Instances
      summary: Change auto stop
      description: >-
        Change a starting or running instance's max runtime or idle stop. A key
        left out keeps its value; `null` turns it off. Max runtime counts from
        when the instance started running, and a change never stops it sooner
        than 2 minutes from now. `id` may be the instance id or its name if
        unique in the environment.
      operationId: updateInstance
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                max_runtime_minutes:
                  type: integer
                  nullable: true
                  minimum: 5
                  maximum: 10080
                  description: >-
                    Total minutes the instance may run, from when it started.
                    `null` turns it off.
                idle_shutdown_minutes:
                  type: integer
                  nullable: true
                  minimum: 5
                  maximum: 1440
                  description: >-
                    Idle window in minutes. `null` turns it off. GPU instances
                    launched with idle stop support only.
      responses:
        '200':
          description: The instance with its new limits and `auto_stop_at`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Instance'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The instance is not starting or running (`NOT_RUNNING`), has no GPU
            (`IDLE_NEEDS_GPU`), was launched before idle stop existed
            (`IDLE_UNSUPPORTED`), or the name matches more than one instance
            (`CONFLICT`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    Instance:
      type: object
      required:
        - id
        - name
        - status
      properties:
        id:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - running
            - starting
            - deploying
            - error
            - terminated
          description: >-
            Public lifecycle status. `starting` covers initial provisioning
            queue; `deploying` is the active boot phase; `running` means
            SSH-reachable; `error` is unrecoverable failure; `terminated` is
            post-delete.
        gpu_type:
          type: string
          nullable: true
          description: GPU model id (e.g. `h100-sxm`).
        gpu_count:
          type: integer
          nullable: true
        cpu_cores:
          type: integer
          nullable: true
        memory:
          type: integer
          nullable: true
          description: GB
        storage:
          type: integer
          nullable: true
          description: GB
        region:
          type: string
          nullable: true
        ip:
          type: string
          nullable: true
          description: Public IP / SSH host once status=running.
        os_image:
          type: string
          nullable: true
        cost_per_hour:
          type: number
          nullable: true
        deployed_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
          nullable: true
        max_runtime_minutes:
          type: integer
          nullable: true
          description: The max runtime set at launch, in minutes. `null` means no limit.
        idle_shutdown_minutes:
          type: integer
          nullable: true
          description: The idle stop set at launch, in minutes. `null` means off.
        auto_stop_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the max runtime will terminate the instance. `null` until it is
            running, or with no limit.
        stop_reason:
          type: string
          nullable: true
          enum:
            - user
            - max_runtime
            - idle
            - budget
            - low_balance
            - failed
            - system
            - null
          description: >-
            Why the instance stopped. `null` while it runs. See the spend
            guardrails guide.
        firewall:
          $ref: '#/components/schemas/InstanceFirewall'
        links:
          type: array
          nullable: true
          description: >-
            On `GET /instances/{id}`. The instance's HTTPS links; null when they
            could not be read.
          items:
            $ref: '#/components/schemas/InstanceLink'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code (e.g. `validation_error`,
                `unauthorized`, `not_found`, `insufficient_credits`,
                `rate_limited`, `internal_error`).
            message:
              type: string
              description: Human-readable error message.
            details:
              type: object
              additionalProperties: true
              description: Optional structured error context.
    InstanceFirewall:
      type: object
      description: >-
        On `GET /instances/{id}`. The instance's firewall: whether it holds its
        environment's rules, and the rules.
      required:
        - status
        - error
        - rules
      properties:
        status:
          type: string
          enum:
            - unmanaged
            - pending
            - enforced
            - not_enforced
          description: >-
            `enforced`: the current rules are in place. `pending`: a change is
            on its way (about 30 s). `not_enforced`: the instance could not
            apply them (see `error`). `unmanaged`: started before the firewall
            existed; relaunch to bring it under the rules.
        error:
          type: string
          nullable: true
          description: Why the instance could not apply its rules, as it last reported.
        rules:
          type: array
          nullable: true
          description: The environment's firewall rules; null when they could not be read.
          items:
            type: object
            properties:
              protocol:
                type: string
                enum:
                  - tcp
                  - udp
              port_from:
                type: integer
              port_to:
                type: integer
              sources:
                type: array
                items:
                  type: string
    InstanceLink:
      type: object
      description: >-
        An HTTPS link: one port of the instance at its own address, for
        workspace members, anyone, or listed addresses.
      required:
        - id
        - port
        - access
        - sources
        - url
        - created_at
        - warning
      properties:
        id:
          type: string
          format: uuid
        port:
          type: integer
          minimum: 1
          maximum: 65535
        access:
          type: string
          enum:
            - workspace
            - public
            - ips
          description: >-
            `workspace`: signed-in members of the workspace, who open it from
            the dashboard. `public`: anyone with the URL. `ips`: only `sources`.
        sources:
          type: array
          items:
            type: string
          description: 'For `ips`: normalised CIDRs, IPv4 or IPv6. Empty otherwise.'
        url:
          type: string
          format: uri
          description: '`https://<port>-<instance>.runcrate.app`'
        created_at:
          type: string
          format: date-time
        warning:
          type: string
          nullable: true
          description: >-
            Set when the link's access is not the whole story: a firewall rule
            also opens its port on the instance's address to others, or the
            instance's firewall is not enforced.
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: Request shape or values failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Use a Runcrate API key with the `rc_live_*` prefix as the bearer token.
        Create one at https://www.runcrate.ai/dashboard/api-keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.