Forgejo API
POST/admin/quota/rules

Create a new quota rule

Creates a new quota rule from its limit, name, and affected subjects. Provide the rule definition in the request body so the new rule can be returned and subsequently assigned to quota groups.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 body fields

Definition of the quota rule to create.

limitintegeroptional
The limit set by the rule
namestringoptional
Name of the rule to create
subjectsarray<string>optional
The subjects affected by the rule

5 status codes
201Returns the created quota rule, including its limit, name, and affected subjects.
limitintegeroptional
The limit set by the rule
namestringoptional
Name of the rule (only shown to admins)
subjectsarray<string>optional
Subjects the rule affects
400Returned when the quota rule definition is malformed.
messagestringoptional
urlstringoptional
403Returned when the authenticated user is not permitted to create quota rules.
messagestringoptional
urlstringoptional
409Returned when creating the quota rule conflicts with an existing rule.
messagestringoptional
urlstringoptional
422Returned when a quota rule field fails input validation.
messagestringoptional
urlstringoptional

Error handling

A 400 is returned when the quota rule definition is malformed. A 403 is returned when the authenticated user lacks permission to create rules, and a 409 indicates a conflict with an existing rule. A 422 is returned when the submitted rule values fail validation.