---
title: "Put Db Rules"
method: PUT
path: "/api/payday/db-rules"
tags: ["Payday"]
---

# Put Db Rules

`PUT /api/payday/db-rules`

## Request

- Base URL: `https://api.earmarkiq.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.earmarkiq.app/api/payday/db-rules`
- Auth: HTTP bearer

Replace all payday rules for the user with the provided set.
This is a full overwrite — the mobile app sends the complete rule list.

EQ-72 ruling 4: with ?mode=propose a virtual-pot rule whose category has
no budget does not get one created here. It comes back as a
budget_proposal and the user confirms it (bulk-update). Without the mode
(an older client) the budget is auto-created as before, never at £0.
An existing budget's limit is never touched by this endpoint either way.

## Query parameters

- `mode` string, nullable: 'propose': budgets are proposed, never written (EQ-72)

## Request body

- SaveRulesRequest
  - `rules` PaydayRule[], required
    - `id` string, required
    - `type` string, required
    - `amount` number, required
    - `timing` string, required
    - `timing_label` string, required
    - `active` boolean, required
    - `description` string, nullable
    - `target_id` string, nullable
    - `target_label` string, nullable
    - `virtual_budget_category` string, nullable
    - `pot_category` string, nullable
    - `goal_id` string, nullable
    - `goal_name` string, nullable

## Response `200`

Successful Response

- DBRulesResponse
  - `rules` PaydayRule[], required
    - `id` string, required
    - `type` string, required
    - `amount` number, required
    - `timing` string, required
    - `timing_label` string, required
    - `active` boolean, required
    - `description` string, nullable
    - `target_id` string, nullable
    - `target_label` string, nullable
    - `virtual_budget_category` string, nullable
    - `pot_category` string, nullable
    - `goal_id` string, nullable
    - `goal_name` string, nullable
  - `total_allocated` number
  - `remaining_after_rules` number
  - `timeline` TimelineEvent[]
    - `order` integer, required
    - `day` integer, required
    - `label` string, required
    - `amount` number, required
    - `type` string, required
    - `icon` string, required
    - `color_key` string, required
  - `budget_proposals` BudgetProposal[]
    - `category` string, required
    - `proposed_limit` number, required
    - `current_limit` number, nullable
    - `source` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/earmarkiq/apis/earmark-api.md) · [All operations](https://skmtc.dev/earmarkiq/apis/earmark-api/llms.txt) · [OpenAPI document](https://skmtc.dev/earmarkiq/apis/earmark-api/revisions/4a2c41907105?raw)
