---
title: "Save Payday Rules"
method: POST
path: "/api/payday/rules/{user_id}"
tags: ["Payday"]
---

# Save Payday Rules

`POST /api/payday/rules/{user_id}`

## 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/rules/{user_id}`
- Auth: HTTP bearer

Save/update automation rules and return an updated timeline.
Rules are passed from the mobile app (stored in AsyncStorage).
The backend computes the timeline and remaining amounts.

## Path parameters

- `user_id` string, uuid, required

## 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

- SaveRulesResponse
  - `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, required
  - `remaining_after_rules` number, required
  - `timeline` TimelineEvent[], required
    - `order` integer, required
    - `day` integer, required
    - `label` string, required
    - `amount` number, required
    - `type` string, required
    - `icon` string, required
    - `color_key` 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)
