---
title: "Add a Rule"
method: POST
path: "/api/ab/rule"
tags: ["address book"]
---

# Add a Rule

`POST /api/ab/rule`

This function is an API endpoint that adds a new rule to a shared address book. It is tagged with "address book" for OpenAPI documentation.

## Parameters

- `request`: The request containing the details of the rule to be added.

## Returns

If successful, this function returns an `ActionResponse::Empty` indicating that the rule was successfully added. <br> If the system is in maintenance mode, this function returns a `status::Unauthorized` error.

## Errors

This function will return an error if the system is in maintenance mode.

## Request body

- AbRuleAddRequest
  - `guid` string, required
  - `user` string, nullable
  - `group` string, nullable
  - `rule` integer, required

## Response `200`

\
            # [200 OK](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200)  
            This response is given when the request is successful.  
            The body is empty if there is no error,  
            The body contains a json object with the error {"error":"Error message"}

## Other responses

- `401`
- `422` — # [422 Unprocessable Entity](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422) This response is given when you request body is not correctly formatted.

## Changes

- **2024-05-31** `63437444b266` — 1 info
  - endpoint added
- **2024-05-19** `fafd43b82c78` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/nesaku/apis/sctgdesk-api-server/changes/api/ab/rule/post.md)

---

[API](https://skmtc.dev/nesaku/apis/sctgdesk-api-server.md) · [All operations](https://skmtc.dev/nesaku/apis/sctgdesk-api-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nesaku/sctgdesk-api-server/revisions/b1c0e7a4434f/schema)
