---
title: "Reorder Views"
method: PATCH
path: "/api/v1/project/{project_id}/views/reorder"
tags: ["project"]
---

# Reorder Views

`PATCH /api/v1/project/{project_id}/views/reorder`

Reorder a project's views to match the supplied id order.

Declared *before* the ``/{view_id}`` PATCH route: FastAPI matches routes in
declaration order, so the literal ``reorder`` segment must register first or
``{view_id}`` would capture it (``view_id="reorder"``).

Args:
    project_id: UUID of the project (validated to be owned by current user)
    request: The full ordered list of view ids
    view_service: View service for business logic

Returns:
    Response with success status and the views in their new order

Raises:
    HTTPException: 404 if project not found or user doesn't own it,
        400 if ``view_ids`` isn't a permutation of the project's views.

## Request body

- ViewsReorderRequest — Request model for reordering a project's views. Attributes: view_ids: The full ordered list of view ids; must be an exact permutation of the project's current view ids.
  - `view_ids` string[], required

## Response `200`

Successful Response

- ViewsReorderResponse — Response model for reordering a project's views. Attributes: success: Boolean indicating if the reorder was successful views: The views in their new order
  - `success` boolean, required
  - `views` ViewModelOutput[], required
    - `id` string, required
    - `name` string, required
    - `description` string, nullable
    - `layerFilters` object
    - `mapFilters` MapFilterModel — Model for a map filter (spatial filter)
      - `geometries` object[], required
      - `type` 'intersects', required
    - `layerColumnVisibility` object
    - `layerColumnOrder` object
    - `layerColumnPinned` object
    - `layerColumnSort` object
    - `layerColumnWidths` object
    - `layerGroupByColumn` object
    - `layerVisibility` object, nullable
    - `layerViz` object, nullable
    - `basemap` string, nullable
    - `currentLayerId` string, nullable
    - `isEditable` boolean, nullable
    - `showFavoritesOnly` boolean
    - `version` integer

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/maia-analytics/apis/maia-api.md) · [All operations](https://skmtc.dev/maia-analytics/apis/maia-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/maia-analytics/maia-api/revisions/0c94a4b5a00e/schema)
