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

# Update Study settings or lifecycle status

> A settings PATCH may include `name` and/or `responseSettings`. Sampling and recontact settings apply only to IN_PRODUCT_SURVEY Studies; SURVEY Studies reject them. A lifecycle PATCH must contain only `status`.



## OpenAPI

````yaml /reference/study-api-v2.json patch /v2/studies/{studyId}
openapi: 3.1.0
info:
  title: Sprig Public API V2 — Studies
  version: 1.0.0
  description: >-
    Programmatically create and manage Sprig Studies (surveys), their Questions,
    Blocks, invitations, and translations.
  contact:
    name: Support
    email: support@sprig.com
servers:
  - url: https://api.sprig.com
security: []
tags:
  - name: Studies
    description: The root resource for a programmatically managed survey.
  - name: Questions
    description: Questions, with their nested options, owned by a Study.
  - name: Blocks
    description: >-
      Blocks and Pages; Pages are not supported for IN_PRODUCT_SURVEY Studies.
      Group skip and display logic live on the Block. Question logic is member
      display, plus skip logic only outside a Page.
  - name: Invitations
    description: >-
      Invitation codes for SURVEY Studies; invitations are not supported for
      IN_PRODUCT_SURVEY Studies.
  - name: Translations
    description: >-
      Per-locale translated content for a Study, and the asynchronous jobs that
      generate it. Job cancellation is best-effort and does not roll back
      committed output.
  - name: Attributes
    description: Custom Attribute definitions available in the environment.
  - name: Targeting
    description: Event triggers and audience conditions for IN_PRODUCT_SURVEY Studies.
  - name: Events
    description: Existing tracked and page-URL Events available for Study targeting.
paths:
  /v2/studies/{studyId}:
    patch:
      tags:
        - Studies
      summary: Update Study settings or lifecycle status
      description: >-
        A settings PATCH may include `name` and/or `responseSettings`. Sampling
        and recontact settings apply only to IN_PRODUCT_SURVEY Studies; SURVEY
        Studies reject them. A lifecycle PATCH must contain only `status`.
      operationId: updateStudy
      parameters:
        - name: If-Match
          in: header
          required: true
          description: >-
            Quoted Study version last read from ETag or Study.version. Required
            on mutating Study writes.
          schema:
            type: string
            example: '"126300"'
        - schema:
            type: string
            format: uuid
          required: true
          name: studyId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateStudyRequest'
      responses:
        '204':
          description: No Content
          headers:
            ETag:
              description: >-
                Quoted Study version validator matching Study.version, for
                example "126300".
              schema:
                type: string
                example: '"126300"'
        '400':
          description: >-
            The request is invalid, including a malformed or unquoted `If-Match`
            header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            The environment API key is missing or invalid, cannot access this
            resource, or the Study API is not available for the account.
        '404':
          description: Study not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            The Study is not editable in its current status, or the requested
            lifecycle transition is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '412':
          description: >-
            The `If-Match` version is stale. Read the resource again and retry
            with its current ETag.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: The request is well-formed but fails a business-rule validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '428':
          description: >-
            The `If-Match` header is missing. Read the resource first and send
            its ETag with the write.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - EnvironmentApiKey: []
components:
  schemas:
    UpdateStudyRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
        appearance:
          $ref: '#/components/schemas/StudyAppearanceUpdate'
        responseSettings:
          $ref: '#/components/schemas/StudyResponseSettingsPatch'
        status:
          type: string
          enum:
            - IN_PROGRESS
            - PAUSED
            - COMPLETED
            - ARCHIVED
      additionalProperties: false
      description: >-
        Updates Study settings or performs one lifecycle transition. Settings
        and status cannot be changed together.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: A machine-readable error code (e.g. STUDY_NOT_FOUND).
        message:
          type: string
          description: A human-readable description of the error.
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              path:
                type: string
              message:
                type: string
              resource:
                type: object
                properties:
                  type:
                    type: string
                  id:
                    type: string
                required:
                  - type
                  - id
                description: >-
                  The other resource this issue points at, when the issue is not
                  about the request itself.
            required:
              - code
              - message
          description: >-
            Per-field validation issues, present when the request itself was
            malformed.
      required:
        - code
        - message
      description: Error response returned by the Public API V2.
    StudyAppearanceUpdate:
      type: object
      properties:
        layout:
          $ref: '#/components/schemas/StudyAppearanceLayout'
        showBranding:
          type: boolean
          description: Whether Sprig and product branding are shown. Defaults to true.
        replayDurationSeconds:
          type:
            - integer
            - 'null'
          exclusiveMinimum: 0
          description: >-
            Replay duration in seconds. Null disables replay. Web supports at
            most 300 seconds, or 180 seconds for BEFORE_AND_AFTER. Mobile
            supports at most 180 seconds.
        replayDurationType:
          type:
            - string
            - 'null'
          enum:
            - BEFORE
            - AFTER
            - BEFORE_AND_AFTER
            - null
          description: >-
            Replay direction. Web defaults to BEFORE; Mobile supports and
            defaults to AFTER.
        endCard:
          $ref: '#/components/schemas/StudyEndCardUpdate'
        mobileLinkBehavior:
          type: string
          enum:
            - IN_APP
            - EXTERNAL
          description: Mobile-only link behavior. Web and SURVEY Studies reject this field.
      additionalProperties: false
      minProperties: 1
      description: A partial appearance update for an in-product Study.
    StudyResponseSettingsPatch:
      type: object
      properties:
        completion:
          $ref: '#/components/schemas/StudyCompletion'
        requireIdentifiedRespondent:
          type: boolean
        allowBackwardNavigation:
          type: boolean
        retake:
          $ref: '#/components/schemas/StudyRetakePatch'
        sampling:
          $ref: '#/components/schemas/StudySampling'
        recontact:
          $ref: '#/components/schemas/StudyRecontactSettingsInput'
      additionalProperties: false
      minProperties: 1
      description: >-
        Partial response-setting update. Omitted fields preserve their current
        values.
    StudyAppearanceLayout:
      type: string
      enum:
        - FIXED
        - CONVERSATIONAL
      description: The respondent layout used by an in-product Study.
    StudyEndCardUpdate:
      type: object
      properties:
        enabled:
          type: boolean
        headline:
          type: string
          maxLength: 500
        subheader:
          type:
            - string
            - 'null'
          maxLength: 500
      additionalProperties: false
      minProperties: 1
      description: >-
        A partial update to the first Question-owned thank-you card. Custom copy
        requires an existing Question.
    StudyCompletion:
      oneOf:
        - type: object
          properties:
            mode:
              type: string
              enum:
                - FIXED
            responseLimit:
              type: integer
              minimum: 1
              description: >-
                Total responses after which the Study completes. In-product
                FIXED Studies also use Sprig's non-configurable daily delivery
                cap of 500.
          required:
            - mode
            - responseLimit
          additionalProperties: false
          title: Response limit
        - type: object
          properties:
            mode:
              type: string
              enum:
                - UNTIL_DATE
            closeAt:
              type: string
              format: date-time
          required:
            - mode
            - closeAt
          additionalProperties: false
          title: End date
        - type: object
          properties:
            mode:
              type: string
              enum:
                - ONGOING
          required:
            - mode
          additionalProperties: false
          title: Ongoing
      description: Controls when response collection ends.
    StudyRetakePatch:
      type: object
      properties:
        invitationMode:
          type: string
          enum:
            - GENERATED
            - PROVIDED
            - IDENTIFIED
          description: >-
            How respondents are told apart. `GENERATED` uses invitations created
            with the invitations endpoint, `PROVIDED` uses your own values in
            the `iid` query parameter, and `IDENTIFIED` uses the `user_id` query
            parameter.
        responseLimit:
          type: string
          enum:
            - PER_INVITATION
            - UNLIMITED
          description: >-
            `PER_INVITATION` accepts one response per invitation. `UNLIMITED`
            accepts any number.
        resume:
          type: object
          properties:
            enabled:
              type: boolean
              description: >-
                Whether a respondent who leaves mid-survey can return with the
                same link and continue where they left off. Requires
                `responseLimit` `PER_INVITATION`.
            windowDays:
              type: integer
              minimum: 1
              maximum: 31
              description: >-
                How many days a respondent has to come back and finish an
                incomplete response.
          additionalProperties: false
      additionalProperties: false
      minProperties: 1
      description: >-
        Omitted fields keep their current value. Retake settings can only change
        before the Study launches.
    StudySampling:
      oneOf:
        - type: object
          properties:
            mode:
              type: string
              enum:
                - PERCENTAGE
            percentage:
              type: number
              exclusiveMinimum: 0
              maximum: 100
              description: Percentage of eligible users who may receive the Study.
          required:
            - mode
            - percentage
          additionalProperties: false
          title: Percentage of eligible users
        - type: object
          properties:
            mode:
              type: string
              enum:
                - DAILY_SEND_CAP
            dailySendCap:
              type: integer
              minimum: 1
              description: Maximum Study sends per day.
          required:
            - mode
            - dailySendCap
          additionalProperties: false
          title: Daily send cap
      description: >-
        How an ongoing IN_PRODUCT_SURVEY Study limits delivery: a percentage of
        eligible users or a daily send cap. Omission for an ONGOING Study
        defaults to 7 percent.
    StudyRecontactSettingsInput:
      type: object
      properties:
        retakeSurvey:
          type: boolean
          description: Whether the same respondent can take the Study more than once.
        resurveyWindowSeconds:
          type:
            - number
            - 'null'
          minimum: 0
          description: >-
            Per-Study recontact window in seconds. Null uses the product-level
            default.
      additionalProperties: false
      minProperties: 1
      description: >-
        A partial update to an IN_PRODUCT_SURVEY Study recontact policy. Omitted
        settings default to no retakes and the product-level recontact window.
  securitySchemes:
    EnvironmentApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Use `API-Key YOUR_API_KEY`. The key selects the Production or
        Development environment.

````