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

# Batch update widget layout

> Atomically update the grid position and dimensions of multiple widgets on a single page. This is the preferred endpoint for drag-and-drop layout changes as it applies all moves in a single database transaction, preventing intermediate states where widgets overlap. Only widgets belonging to the specified page may be included.



## OpenAPI

````yaml https://api.surnex.io/openapi.json patch /v1/projects/{project_id}/reports/{report_id}/pages/{page_id}/widgets/layout
openapi: 3.1.0
info:
  title: Surnex API
  description: |-
    Surnex SEO Platform API — api.surnex.io

    Provides the complete backend for the Surnex SEO dashboard including:
    - Multi-tenant organization management
    - Project tracking (domains)
    - Keyword rank tracking (Phase 1+)
    - Backlink analysis (Phase 3+)
    - Site auditing (Phase 4+)
    - Stripe billing integration
    - MCP endpoint for AI agents at /mcp
  version: 0.1.0
servers: []
security: []
paths:
  /v1/projects/{project_id}/reports/{report_id}/pages/{page_id}/widgets/layout:
    patch:
      tags:
        - Reports
      summary: Batch update widget layout
      description: >-
        Atomically update the grid position and dimensions of multiple widgets
        on a single page. This is the preferred endpoint for drag-and-drop
        layout changes as it applies all moves in a single database transaction,
        preventing intermediate states where widgets overlap. Only widgets
        belonging to the specified page may be included.
      operationId: >-
        batch_update_layout_v1_projects__project_id__reports__report_id__pages__page_id__widgets_layout_patch
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Project Id
        - name: report_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Report Id
        - name: page_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Page Id
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WidgetLayoutBatchUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIResponse_list_ReportWidgetResponse__'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WidgetLayoutBatchUpdate:
      properties:
        layouts:
          items:
            $ref: '#/components/schemas/WidgetLayoutItem'
          type: array
          title: Layouts
          description: List of widget layout items to apply in a single transaction.
      type: object
      required:
        - layouts
      title: WidgetLayoutBatchUpdate
      description: >-
        Request body for atomically updating the layout of multiple widgets at
        once.
    APIResponse_list_ReportWidgetResponse__:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          anyOf:
            - items:
                $ref: '#/components/schemas/ReportWidgetResponse'
              type: array
            - type: 'null'
          title: Data
      type: object
      title: APIResponse[list[ReportWidgetResponse]]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WidgetLayoutItem:
      properties:
        widget_id:
          type: string
          format: uuid
          title: Widget Id
          description: UUID of the widget to reposition.
        position_x:
          type: integer
          title: Position X
          description: New horizontal grid position (column index, 0-based).
        position_y:
          type: integer
          title: Position Y
          description: New vertical grid position (row index, 0-based).
        width:
          type: integer
          title: Width
          description: New widget width in grid columns.
          default: 1
        height:
          type: integer
          title: Height
          description: New widget height in grid rows.
          default: 1
      type: object
      required:
        - widget_id
        - position_x
        - position_y
      title: WidgetLayoutItem
      description: >-
        A single widget's grid position and dimensions for a batch layout
        update.
    ReportWidgetResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        widget_type:
          type: string
          title: Widget Type
        data_source:
          anyOf:
            - type: string
            - type: 'null'
          title: Data Source
        title:
          type: string
          title: Title
        config:
          additionalProperties: true
          type: object
          title: Config
        position_x:
          type: integer
          title: Position X
        position_y:
          type: integer
          title: Position Y
        width:
          type: integer
          title: Width
        height:
          type: integer
          title: Height
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - widget_type
        - title
        - config
        - position_x
        - position_y
        - width
        - height
        - created_at
      title: ReportWidgetResponse
      description: A single report widget as returned by the API.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````