> ## 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 a Block

> Updates a Block or Page. Pages are supported only for SURVEY Studies, not IN_PRODUCT_SURVEY Studies. Replaces Block or Page skipLogic and displayLogic when those fields are sent. Omission preserves the stored group rules. A Page owns skip logic for its Questions, so Question skipLogic is rejected for Page members.



## OpenAPI

````yaml /reference/study-api-v2.json patch /v2/studies/{studyId}/blocks/{blockId}
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}/blocks/{blockId}:
    patch:
      tags:
        - Blocks
      summary: Update a Block
      description: >-
        Updates a Block or Page. Pages are supported only for SURVEY Studies,
        not IN_PRODUCT_SURVEY Studies. Replaces Block or Page skipLogic and
        displayLogic when those fields are sent. Omission preserves the stored
        group rules. A Page owns skip logic for its Questions, so Question
        skipLogic is rejected for Page members.
      operationId: updateBlock
      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
        - schema:
            type: string
            format: uuid
          required: true
          name: blockId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBlockInput'
      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: The Study or Block was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            The Study is not editable in its current status, or a conflicting
            update is already in progress.
          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:
    UpdateBlockInput:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 128
          description: >-
            Stable caller-defined name, unique among Blocks in the Study. Null
            clears it.
        label:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 500
          description: Display label for the Block. Null clears it.
        displayLogic:
          anyOf:
            - $ref: '#/components/schemas/DisplayLogic'
              title: Display logic
            - type: 'null'
              title: No display logic
          description: >-
            Block or Page display logic. Null clears it. Omission on update
            preserves the stored value. Question display logic stays on the
            Question.
        skipLogic:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/SkipLogicRule'
          maxItems: 20
          description: >-
            Block or Page skip logic. Null or an empty array clears it. Omission
            on update preserves the stored value. A Page owns skip logic for its
            Questions.
        randomizePosition:
          type: boolean
          description: >-
            Whether this Block moves inside its parent shuffle. Defaults to
            false. A subset requires every direct child to be randomized.
        subsetCount:
          type:
            - integer
            - 'null'
          minimum: 1
          description: >-
            How many eligible direct children to show each respondent. Null
            clears the subset. Omission on update preserves the stored value.
            Eligible children are the ones delivery can leave out: a prior skip
            destination, display logic, and either side of carry-forward stay in
            the survey and do not count. The value must be from 1 to one less
            than that eligible count. Setting it randomizes every direct child.
        position:
          type: object
          properties:
            placement:
              $ref: '#/components/schemas/QuestionPositionPlacement'
            anchor:
              $ref: '#/components/schemas/QuestionPositionAnchor'
          required:
            - placement
            - anchor
          additionalProperties: false
          description: >-
            Moves the Block before or after an anchor Question or Block. BEFORE
            a Block uses that Block's slot. AFTER a Block lands after its
            subtree.
        displayAsPage:
          type: boolean
      additionalProperties: false
      minProperties: 1
      description: >-
        Partial update for a Block or Page. Omitted fields preserve their
        current values.
    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.
    DisplayLogic:
      anyOf:
        - $ref: '#/components/schemas/LogicCondition'
          title: Condition
        - type: object
          properties:
            all:
              type: array
              items:
                $ref: '#/components/schemas/LogicExpression'
              minItems: 1
              maxItems: 20
          required:
            - all
          additionalProperties: false
          title: All of
        - type: object
          properties:
            any:
              type: array
              items:
                $ref: '#/components/schemas/LogicExpression'
              minItems: 1
              maxItems: 20
          required:
            - any
          additionalProperties: false
          title: Any of
      description: Typed display logic owned by a Question.
    SkipLogicRule:
      type: object
      properties:
        when:
          $ref: '#/components/schemas/LogicExpression'
        destination:
          $ref: '#/components/schemas/SkipDestination'
      required:
        - when
        - destination
      additionalProperties: false
      description: One skip rule with a typed condition and destination.
    QuestionPositionPlacement:
      type: string
      enum:
        - BEFORE
        - AFTER
      description: >-
        Where to place the resource relative to the anchor. BEFORE a Block uses
        that Block's slot. AFTER a Block lands after its subtree.
    QuestionPositionAnchor:
      anyOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: Public UUID of the anchor Question or Block.
          required:
            - id
          additionalProperties: false
          title: By ID
        - type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 128
              description: Name of the anchor Question or Block.
            type:
              type: string
              enum:
                - QUESTION
                - BLOCK
              description: >-
                Required with name. QUESTION looks up a Question. BLOCK looks up
                a Block.
          required:
            - name
            - type
          additionalProperties: false
          title: By name
      description: >-
        Exactly one of id or name for an existing Question or Block in the
        Study. A name includes type so lookup is only that Question or Block.
    LogicCondition:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/LogicConditionSource'
        operator:
          $ref: '#/components/schemas/LogicOperator'
        value:
          anyOf:
            - type: string
              title: Text
            - type: number
              title: Number
            - type: boolean
              title: Yes / no
            - type: array
              items:
                type: string
              title: List
      required:
        - source
        - operator
      additionalProperties: false
      description: >-
        A single typed condition. Operators that inspect answer state omit
        value; choice comparisons use immutable Option values.
      title: Condition
    LogicExpression:
      anyOf:
        - $ref: '#/components/schemas/LogicCondition'
          title: Condition
        - type: object
          properties:
            all:
              type: array
              items:
                $ref: '#/components/schemas/LogicExpression'
              minItems: 1
              maxItems: 20
          required:
            - all
          additionalProperties: false
          title: All of
        - type: object
          properties:
            any:
              type: array
              items:
                $ref: '#/components/schemas/LogicExpression'
              minItems: 1
              maxItems: 20
          required:
            - any
          additionalProperties: false
          title: Any of
      description: >-
        Nested display or skip conditions using all/any groups. Maximum depth is
        5; each group may contain at most 20 children.
    SkipDestination:
      oneOf:
        - $ref: '#/components/schemas/EndSkipDestination'
          title: End of study
        - $ref: '#/components/schemas/QuestionSkipDestination'
          title: Question
      discriminator:
        propertyName: type
        mapping:
          END: '#/components/schemas/EndSkipDestination'
          QUESTION: '#/components/schemas/QuestionSkipDestination'
      description: Public skip destination.
    LogicConditionSource:
      oneOf:
        - $ref: '#/components/schemas/QuestionResponseConditionSource'
          title: Question response
        - $ref: '#/components/schemas/AttributeConditionSource'
          title: Environment attribute
      discriminator:
        propertyName: type
        mapping:
          QUESTION_RESPONSE: '#/components/schemas/QuestionResponseConditionSource'
          ATTRIBUTE: '#/components/schemas/AttributeConditionSource'
      description: Typed source of a logic condition.
    LogicOperator:
      type: string
      enum:
        - EQUALS
        - NOT_EQUALS
        - GREATER_THAN
        - GREATER_THAN_OR_EQUAL
        - LESS_THAN
        - LESS_THAN_OR_EQUAL
        - IN
        - NOT_IN
        - INCLUDES_ALL
        - EXACTLY
        - CONTAINS
        - NOT_CONTAINS
        - STARTS_WITH
        - ENDS_WITH
        - ANSWERED
        - SKIPPED
        - PARTIALLY_ANSWERED
        - EXISTS
        - NOT_EXISTS
      description: >-
        Uppercase Public API operators. Study API selects the valid
        operator/value branch from the source type and referenced Question type.
    EndSkipDestination:
      type: object
      properties:
        type:
          type: string
          enum:
            - END
      required:
        - type
      additionalProperties: false
      description: Ends the Study.
      title: End of study
    QuestionSkipDestination:
      type: object
      properties:
        type:
          type: string
          enum:
            - QUESTION
        question:
          $ref: '#/components/schemas/ResourceRef'
      required:
        - type
        - question
      additionalProperties: false
      description: Skips to a Question.
      title: Question
    QuestionResponseConditionSource:
      type: object
      properties:
        type:
          type: string
          enum:
            - QUESTION_RESPONSE
        question:
          $ref: '#/components/schemas/ResourceRef'
      required:
        - type
        - question
      additionalProperties: false
      description: A condition sourced from an earlier Question response.
      title: Question response
    AttributeConditionSource:
      type: object
      properties:
        type:
          type: string
          enum:
            - ATTRIBUTE
        attribute:
          type: string
          minLength: 1
          maxLength: 128
      required:
        - type
        - attribute
      additionalProperties: false
      description: A condition sourced from an environment attribute definition.
      title: Environment attribute
    ResourceRef:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 1
          maxLength: 128
      additionalProperties: false
      description: A reference by canonical identifier, unique name, or both.
  securitySchemes:
    EnvironmentApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Use `API-Key YOUR_API_KEY`. The key selects the Production or
        Development environment.

````