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

# Update Setup

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



## OpenAPI

````yaml PATCH /v1/projects/{projectId}/setup
openapi: 3.1.0
info:
  title: Capy API
  version: 1.0.0
servers:
  - url: https://capy.ai/api
security:
  - bearerAuth: []
tags:
  - name: threads
  - name: sessions
  - name: tasks
  - name: projects
  - name: tags
  - name: models
  - name: usage
  - name: setup
  - name: snapshots
  - name: browser-snapshots
  - name: environment-variables
  - name: automations
paths:
  /v1/projects/{projectId}/setup:
    patch:
      tags:
        - setup
      summary: Update setup
      description: >-
        Save Setup for future project runs. The update becomes active
        immediately; secret and environment variable fields are not accepted.
      operationId: updateSetup
      parameters:
        - name: projectId
          in: path
          required: true
          description: Project ID.
          schema:
            type: string
          example: proj_123
        - name: replaceLegacyHooks
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Set to true to confirm that saving Setup replaces active
              deprecated .capy/settings.json hooks for future runs.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSetupBody'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSetupResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    UpdateSetupBody:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        vmSize:
          type: string
          enum:
            - small
            - medium
            - large
            - ultra
            - hyper
        repositories:
          type: array
          items:
            type: object
            properties:
              repository:
                type: string
              branch:
                type: string
              scripts:
                type: object
                properties:
                  initialize:
                    anyOf:
                      - type: string
                      - type: 'null'
                  updateAfterCheckout:
                    anyOf:
                      - type: string
                      - type: 'null'
                  startup:
                    anyOf:
                      - type: string
                      - type: 'null'
                required:
                  - initialize
                  - updateAfterCheckout
                  - startup
                additionalProperties: false
              timeouts:
                type: object
                properties:
                  initialize:
                    type: integer
                    minimum: 60
                    maximum: 3600
                  updateAfterCheckout:
                    type: integer
                    minimum: 60
                    maximum: 3600
                  startup:
                    type: integer
                    minimum: 60
                    maximum: 3600
                additionalProperties: false
              commands:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    command:
                      type: string
                  required:
                    - name
                    - command
                  additionalProperties: false
            required:
              - repository
              - branch
              - scripts
              - commands
            additionalProperties: false
        hooks:
          type: object
          properties:
            pre:
              type: object
              propertyNames:
                type: string
              additionalProperties:
                anyOf:
                  - type: array
                    items:
                      type: string
                  - type: object
                    properties:
                      commands:
                        type: array
                        items:
                          type: string
                        description: Shell commands to run
                      agents:
                        type: array
                        items:
                          type: string
                          enum:
                            - captain
                            - build
                            - review
                        description: >-
                          Which agent types this applies to. Omit to apply to
                          all agents (default: all)
                    required:
                      - commands
                    additionalProperties: false
              description: >-
                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:
              type: object
              propertyNames:
                type: string
              additionalProperties:
                anyOf:
                  - type: array
                    items:
                      type: string
                  - type: object
                    properties:
                      commands:
                        type: array
                        items:
                          type: string
                        description: Shell commands to run
                      agents:
                        type: array
                        items:
                          type: string
                          enum:
                            - captain
                            - build
                            - review
                        description: >-
                          Which agent types this applies to. Omit to apply to
                          all agents (default: all)
                    required:
                      - commands
                    additionalProperties: false
              description: >-
                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:
              type: object
              properties:
                maxOutputLength:
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
                  description: >-
                    Maximum characters of hook output to include in context
                    (default: 2000)
                truncateStrategy:
                  type: string
                  enum:
                    - head
                    - tail
                    - middle
                  description: >-
                    How to truncate output exceeding maxOutputLength: 'head'
                    keeps start, 'tail' keeps end, 'middle' keeps both ends
              additionalProperties: false
          additionalProperties: false
      required:
        - repositories
      additionalProperties: false
    UpdateSetupResponse:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        source:
          type: string
          enum:
            - legacy
            - setup
            - none
        legacyHooks:
          type: object
          properties:
            status:
              type: string
              enum:
                - active
                - ignored
                - none
            repositories:
              type: array
              items:
                type: string
            checkComplete:
              type: boolean
          required:
            - status
            - repositories
            - checkComplete
          additionalProperties: false
        setup:
          type: object
          properties:
            vmSize:
              type: string
              enum:
                - small
                - medium
                - large
                - ultra
                - hyper
            repositories:
              type: array
              items:
                type: object
                properties:
                  repository:
                    type: string
                  branch:
                    type: string
                  scripts:
                    type: object
                    properties:
                      initialize:
                        anyOf:
                          - type: string
                          - type: 'null'
                      updateAfterCheckout:
                        anyOf:
                          - type: string
                          - type: 'null'
                      startup:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - initialize
                      - updateAfterCheckout
                      - startup
                    additionalProperties: false
                  timeouts:
                    type: object
                    properties:
                      initialize:
                        type: integer
                        minimum: 60
                        maximum: 3600
                      updateAfterCheckout:
                        type: integer
                        minimum: 60
                        maximum: 3600
                      startup:
                        type: integer
                        minimum: 60
                        maximum: 3600
                    additionalProperties: false
                  commands:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        command:
                          type: string
                      required:
                        - name
                        - command
                      additionalProperties: false
                required:
                  - repository
                  - branch
                  - scripts
                  - commands
                additionalProperties: false
            hooks:
              type: object
              properties:
                pre:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    anyOf:
                      - type: array
                        items:
                          type: string
                      - type: object
                        properties:
                          commands:
                            type: array
                            items:
                              type: string
                            description: Shell commands to run
                          agents:
                            type: array
                            items:
                              type: string
                              enum:
                                - captain
                                - build
                                - review
                            description: >-
                              Which agent types this applies to. Omit to apply
                              to all agents (default: all)
                        required:
                          - commands
                        additionalProperties: false
                  description: >-
                    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:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    anyOf:
                      - type: array
                        items:
                          type: string
                      - type: object
                        properties:
                          commands:
                            type: array
                            items:
                              type: string
                            description: Shell commands to run
                          agents:
                            type: array
                            items:
                              type: string
                              enum:
                                - captain
                                - build
                                - review
                            description: >-
                              Which agent types this applies to. Omit to apply
                              to all agents (default: all)
                        required:
                          - commands
                        additionalProperties: false
                  description: >-
                    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:
                  type: object
                  properties:
                    maxOutputLength:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                      description: >-
                        Maximum characters of hook output to include in context
                        (default: 2000)
                    truncateStrategy:
                      type: string
                      enum:
                        - head
                        - tail
                        - middle
                      description: >-
                        How to truncate output exceeding maxOutputLength: 'head'
                        keeps start, 'tail' keeps end, 'middle' keeps both ends
                  additionalProperties: false
              additionalProperties: false
          required:
            - repositories
          additionalProperties: false
      required:
        - source
        - legacyHooks
        - setup
      additionalProperties: false
    ErrorResponse:
      $schema: https://json-schema.org/draft/2020-12/schema
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token (capy_xxxx). Generate at capy.ai/settings/tokens

````