Organisations
Save an organisation's style rules
Saves the rules file as JSON text, for CI to read with an organisation key.
PUT
/orgs/{org}/style-rulesTL;DR
| Question | Answer |
|---|---|
| What does it do? | Save an organisation's style rules. |
| What does it take? | A JSON body of type StyleRulesBody. |
| What does it return? | Status 200 with a body of type 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.
| 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 |
| 400 | The body is not valid. | ErrorResponse |
| 401 | Not signed in. | 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 |
| 404 | No such organisation, or the caller is not a member of it. | ErrorResponse |
| 422 | The rules are not valid (style_rules.invalid, with every problem in details). | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 503 | Organisations are not set up on this server. | ErrorResponse |
Response body
A 200 answer has the type 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 | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |