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

# Update a block

> Update a block config or repoint its source table or view.



## OpenAPI

````yaml https://api.useinvent.com/openapi.json patch /orgs/{org_id}/pages/{page_ref}/blocks/{block_id}
openapi: 3.1.0
info:
  version: 1.0.0
  title: Invent API
servers:
  - url: https://api.useinvent.com
security:
  - bearerAuth: []
paths:
  /orgs/{org_id}/pages/{page_ref}/blocks/{block_id}:
    patch:
      tags:
        - Orgs Pages
      summary: Update a block
      description: Update a block config or repoint its source table or view.
      parameters:
        - schema:
            type: string
          required: true
          description: Org ID
          name: org_id
          in: path
        - schema:
            type: string
          required: true
          description: Page slug or encoded page id
          name: page_ref
          in: path
        - schema:
            type: string
          required: true
          description: Block ID
          name: block_id
          in: path
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePageBlockSchema'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UpdatePageBlockSchema'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageBlockSchema'
components:
  schemas:
    UpdatePageBlockSchema:
      type: object
      properties:
        config:
          $ref: '#/components/schemas/PageBlockConfigSchema'
        table_id:
          type:
            - string
            - 'null'
        view_id:
          type:
            - string
            - 'null'
    PageBlockSchema:
      type: object
      properties:
        id:
          type: string
          example: block_5Fb7…
        page_id:
          type: string
          example: page_5Fb7…
        type:
          $ref: '#/components/schemas/PageBlockTypeSchema'
        config:
          $ref: '#/components/schemas/PageBlockConfigSchema'
        table_id:
          type:
            - string
            - 'null'
          description: Source table for data blocks. Null when the table was deleted.
        view_id:
          type:
            - string
            - 'null'
          description: Embedded view for table blocks. Null when the view was deleted.
        position:
          type: string
          description: Fractional order within the page.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - page_id
        - type
        - config
        - table_id
        - view_id
        - position
        - created_at
        - updated_at
    PageBlockConfigSchema:
      type: object
      properties:
        shared:
          $ref: '#/components/schemas/PageBlockSharedConfigSchema'
        heading:
          $ref: '#/components/schemas/PageBlockHeadingConfigSchema'
        text:
          $ref: '#/components/schemas/PageBlockTextConfigSchema'
        stat:
          $ref: '#/components/schemas/PageBlockStatConfigSchema'
        chart:
          $ref: '#/components/schemas/PageBlockChartConfigSchema'
        table:
          $ref: '#/components/schemas/PageBlockTableConfigSchema'
        pages:
          $ref: '#/components/schemas/PageBlockPagesConfigSchema'
    PageBlockTypeSchema:
      type: string
      enum:
        - heading
        - text
        - stat
        - chart
        - table
        - pages
    PageBlockSharedConfigSchema:
      type: object
      properties:
        size:
          $ref: '#/components/schemas/PageBlockSizeSchema'
    PageBlockHeadingConfigSchema:
      type: object
      properties:
        text:
          type: string
          maxLength: 255
        level:
          anyOf:
            - type: number
              enum:
                - 1
            - type: number
              enum:
                - 2
    PageBlockTextConfigSchema:
      type: object
      properties:
        markdown:
          type: string
          maxLength: 30000
    PageBlockStatConfigSchema:
      type: object
      properties:
        label:
          type: string
          maxLength: 128
        metric:
          $ref: '#/components/schemas/TableAggregateMetricSchema'
        window:
          $ref: '#/components/schemas/TableAggregateWindowSchema'
        filter:
          $ref: '#/components/schemas/FilterSchema'
        format:
          $ref: '#/components/schemas/PageBlockStatFormatSchema'
        compare:
          type: string
          enum:
            - previous_period
    PageBlockChartConfigSchema:
      type: object
      properties:
        label:
          type: string
          maxLength: 128
        kind:
          $ref: '#/components/schemas/PageBlockChartKindSchema'
        metric:
          $ref: '#/components/schemas/TableAggregateMetricSchema'
        group_by:
          $ref: '#/components/schemas/TableAggregateGroupBySchema'
        window:
          $ref: '#/components/schemas/TableAggregateWindowSchema'
        filter:
          $ref: '#/components/schemas/FilterSchema'
        limit:
          type: integer
          minimum: 1
          maximum: 50
    PageBlockTableConfigSchema:
      type: object
      properties:
        limit:
          type: integer
          minimum: 1
          maximum: 50
    PageBlockPagesConfigSchema:
      type: object
      properties:
        page_ids:
          type: array
          items:
            type: string
          maxItems: 50
        style:
          $ref: '#/components/schemas/PageBlockPagesStyleSchema'
    PageBlockSizeSchema:
      type: string
      enum:
        - sm
        - md
        - lg
        - full
    TableAggregateMetricSchema:
      type: object
      properties:
        aggregation:
          $ref: '#/components/schemas/TableAggregationSchema'
        field_key:
          type: string
          minLength: 1
          maxLength: 64
      required:
        - aggregation
    TableAggregateWindowSchema:
      type: object
      properties:
        field_key:
          type: string
          minLength: 1
          maxLength: 64
        last:
          $ref: '#/components/schemas/TableAggregateWindowLastSchema'
      required:
        - field_key
        - last
    FilterSchema:
      anyOf:
        - $ref: '#/components/schemas/FilterRuleSchema'
        - $ref: '#/components/schemas/FilterGroupSchema'
    PageBlockStatFormatSchema:
      type: string
      enum:
        - number
        - currency
        - percent
    PageBlockChartKindSchema:
      type: string
      enum:
        - bar
        - line
        - area
        - donut
    TableAggregateGroupBySchema:
      type: object
      properties:
        field_key:
          type: string
          minLength: 1
          maxLength: 64
        bucket:
          $ref: '#/components/schemas/TableAggregateDateBucketSchema'
      required:
        - field_key
    PageBlockPagesStyleSchema:
      type: string
      enum:
        - cards
        - list
    TableAggregationSchema:
      type: string
      enum:
        - count
        - sum
        - avg
        - min
        - max
    TableAggregateWindowLastSchema:
      type: string
      enum:
        - 7d
        - 30d
        - 90d
        - 365d
    FilterRuleSchema:
      type: object
      properties:
        type:
          type: string
          enum:
            - rule
        key:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[a-z][a-z0-9_]{0,63}$
        operator:
          $ref: '#/components/schemas/FilterOperatorSchema'
        value: {}
      required:
        - type
        - key
        - operator
    FilterGroupSchema:
      type: object
      properties:
        type:
          type: string
          enum:
            - group
        combinator:
          $ref: '#/components/schemas/FilterCombinatorSchema'
        children:
          type: array
          items:
            $ref: '#/components/schemas/FilterSchema'
      required:
        - type
        - combinator
        - children
    TableAggregateDateBucketSchema:
      type: string
      enum:
        - day
        - week
        - month
    FilterOperatorSchema:
      type: string
      enum:
        - contains
        - not_contains
        - eq
        - neq
        - gt
        - lt
        - gte
        - lte
        - before
        - after
        - on_or_before
        - on_or_after
        - in
        - not_in
        - is_empty
        - is_not_empty
    FilterCombinatorSchema:
      type: string
      enum:
        - and
        - or
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer token authentication using your API key

````