---
title: "Update Page Theme"
method: PUT
path: "/api/mdm/update_page_theme"
tags: ["MDM"]
---

# Update Page Theme

`PUT /api/mdm/update_page_theme`

**Function**: `update_page_theme`

**Type**: API Endpoint (PUT)

**Purpose**:
This endpoint is used to update the page theme to light or dark, or to update the default firm.

**URL**:
`PUT /api/mdm/update_page_theme`

**Request Parameters**:
- `flag` (str): The flag to indicate whether to update the page theme or default firm.
- `data` (PageOrFirm): The data to be updated.
- `Customer_Key` (Header, required): A base64 encoded string containing `lscode` and `firmcode`.
- `User_Code` (Header, required): A base64 encoded string containing the user code.
- `db` (Session): The database session.
- `current_user` (str): The current user performing the operation, obtained via dependency injection.

**Process**:
1. Validates the customer key.
2. Checks if the flag is 0 or 1.
3. If flag is 0, updates the page theme to light or dark based on the request body.
4. If flag is 1, updates the default firm to the firm that is given in request body.
5. Commits the transaction and returns a response detailing the status of the operations.

**Response**:
- A JSON object containing a status message and details of each column operation performed.
- Indicates success or failure for each step, including any errors encountered.

**Exceptions**:
- Handles exceptions related to database operations and invalid customer key formats, providing appropriate error messages.

## Query parameters

- `flag` string, required

## Headers

- `Customer-Key` string, required
- `User-Code` string, required

## Request body

- PageOrFirm
  - `theme` string, nullable
  - `firm` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) · [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/leapsurgebi/leapsurgeapi/revisions/5a6b1464bfeb/schema)
