Skip to content
Connect an agent
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-rules

TL;DR

QuestionAnswer
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

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.

Request body

The body has the type StyleRulesBody.

FieldTypeRequiredDescription
textstringyesThe 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

StatusMeaningBody
200The saved rules.OrgStyleRules
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403The 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
404No such organisation, or the caller is not a member of it.ErrorResponse
422The rules are not valid (style_rules.invalid, with every problem in details).ErrorResponse
429Too many requests.ErrorResponse
503Organisations are not set up on this server.ErrorResponse

Response body

A 200 answer has the type OrgStyleRules.

FieldTypeRequiredDescription
rulesStyleRules | nullyesThe saved rules as the engine read them (the format of docs/architecture/repository-settings.md), or null when none are saved.
textstring | nullyesThe saved rules as the person wrote them, or null.
activebooleanyesTrue when rules are saved and the owner's plan includes saved style rules, so CI that reads them applies them.
canEditbooleanyesTrue when the caller's role may save and remove the rules.
plan"free" | "pro" | "enterprise"yesThe organisation's plan, which is its owner's.
updatedAtinteger | nullyesWhen the rules were last saved, in milliseconds since the epoch, or null.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools