# Save an organisation's style rules

> Page: https://docs.plotwork.dev/api/put-orgs-org-style-rules. Index of every page: https://docs.plotwork.dev/llms.txt

Saves the rules file as JSON text, for CI to read with an organisation key.

`PUT /orgs/{org}/style-rules`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Save an organisation's style rules. |
| What does it take? | A JSON body of type [`StyleRulesBody`](https://docs.plotwork.dev/api/schemas.md#stylerulesbody). |
| What does it return? | Status 200 with a body of type [`OrgStyleRules`](https://docs.plotwork.dev/api/schemas.md#orgstylerules). |
| What can go wrong? | `400` the body is not valid; `401` not signed in; `403` the caller's role may not (orgs.forbidden), the owner's plan does not include saved style rules (plan.style_rules_not_included), or the request came from an origin that may not make changes; `404` no such organisation, or the caller is not a member of it; `422` the rules are not valid (style_rules.invalid, with every problem in details); `429` too many requests; `503` organisations are not set up on this server. Every failure uses the one error envelope. |

## What it does

Saves the rules file as JSON text, for CI to read with an organisation key. The owner and admins may, on a plan with saved style rules. 422 style_rules.invalid carries every problem with its line, column and hint.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |

## Request body

The body has the type [`StyleRulesBody`](https://docs.plotwork.dev/api/schemas.md#stylerulesbody).

| Field | Type | Required | Description |
|---|---|---|---|
| `text` | `string` | yes | The rules file as JSON text, at most 32768 characters. The style rules guide lists its fields. at least 1 character; at most 32768 characters. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The saved rules. | [`OrgStyleRules`](https://docs.plotwork.dev/api/schemas.md#orgstylerules) |
| 400 | The body is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | The caller's role may not (orgs.forbidden), the owner's plan does not include saved style rules (plan.style_rules_not_included), or the request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation, or the caller is not a member of it. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 422 | The rules are not valid (style_rules.invalid, with every problem in details). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Organisations are not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`OrgStyleRules`](https://docs.plotwork.dev/api/schemas.md#orgstylerules).

| Field | Type | Required | Description |
|---|---|---|---|
| `rules` | `StyleRules \| null` | yes | The saved rules as the engine read them (the format of docs/architecture/repository-settings.md), or null when none are saved. |
| `text` | `string \| null` | yes | The saved rules as the person wrote them, or null. |
| `active` | `boolean` | yes | True when rules are saved and the owner's plan includes saved style rules, so CI that reads them applies them. |
| `canEdit` | `boolean` | yes | True when the caller's role may save and remove the rules. |
| `plan` | `"free" \| "pro" \| "enterprise"` | yes | The organisation's plan, which is its owner's. |
| `updatedAt` | `integer \| null` | yes | When the rules were last saved, in milliseconds since the epoch, or null. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
