---
title: "Update setup"
method: PATCH
path: "/v1/projects/{projectId}/setup"
tags: ["setup"]
---

# Update setup

`PATCH /v1/projects/{projectId}/setup`

Save Setup for future project runs. The update becomes active immediately; secret and environment variable fields are not accepted.

## Path parameters

- `projectId` string, required

## Query parameters

- `replaceLegacyHooks` boolean — Set to true to confirm that saving Setup replaces active deprecated .capy/settings.json hooks for future runs.

## Request body

- UpdateSetupBody
  - `vmSize` 'small' | 'medium' | 'large' | 'ultra' | 'hyper'
  - `repositories` object[], required
    - `repository` string, required
    - `branch` string, required
    - `scripts` object, required
      - `initialize` string, nullable, required
      - `updateAfterCheckout` string, nullable, required
      - `startup` string, nullable, required
    - `timeouts` object
      - `initialize` integer
      - `updateAfterCheckout` integer
      - `startup` integer
    - `commands` object[], required
      - `name` string, required
      - `command` string, required
  - `hooks` object
    - `pre` object — Commands to run BEFORE a tool executes. Keys are tool names (bash_run, edit, write, etc.), values are arrays of shell commands or objects with commands and agents filter
    - `post` object — Commands to run AFTER a tool executes. Keys are tool names, values are arrays of shell commands or objects with commands and agents filter. Can use ${variable} interpolation from tool args/results
    - `context` object
      - `maxOutputLength` integer — Maximum characters of hook output to include in context (default: 2000)
      - `truncateStrategy` 'head' | 'tail' | 'middle' — How to truncate output exceeding maxOutputLength: 'head' keeps start, 'tail' keeps end, 'middle' keeps both ends

## Response `200`

Success

- UpdateSetupResponse
  - `source` 'legacy' | 'setup' | 'none', required
  - `legacyHooks` object, required
    - `status` 'active' | 'ignored' | 'none', required
    - `repositories` string[], required
    - `checkComplete` boolean, required
  - `setup` object, required
    - `vmSize` 'small' | 'medium' | 'large' | 'ultra' | 'hyper'
    - `repositories` object[], required
      - `repository` string, required
      - `branch` string, required
      - `scripts` object, required
        - `initialize` string, nullable, required
        - `updateAfterCheckout` string, nullable, required
        - `startup` string, nullable, required
      - `timeouts` object
        - `initialize` integer
        - `updateAfterCheckout` integer
        - `startup` integer
      - `commands` object[], required
        - `name` string, required
        - `command` string, required
    - `hooks` object
      - `pre` object — Commands to run BEFORE a tool executes. Keys are tool names (bash_run, edit, write, etc.), values are arrays of shell commands or objects with commands and agents filter
      - `post` object — Commands to run AFTER a tool executes. Keys are tool names, values are arrays of shell commands or objects with commands and agents filter. Can use ${variable} interpolation from tool args/results
      - `context` object
        - `maxOutputLength` integer — Maximum characters of hook output to include in context (default: 2000)
        - `truncateStrategy` 'head' | 'tail' | 'middle' — How to truncate output exceeding maxOutputLength: 'head' keeps start, 'tail' keeps end, 'middle' keeps both ends

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not found
- `422` — Validation error
- `500` — Internal error

---

[API](https://skmtc.dev/capy/apis/capy-api.md) · [All operations](https://skmtc.dev/capy/apis/capy-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/capy/capy-api/revisions/c9ea28cb32b6/schema)
