> ## Documentation Index
> Fetch the complete documentation index at: https://developer.dittowords.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create style guide rules

> Creates one or more rules in a style guide section. Look up the style guide's developer ID and section IDs via GET /styleguides. Use the {name, description, examples, tags, enabled} shape for a section whose kind is 'rules', or the {term, disallowed, description, tags, enabled} shape for a section whose kind is 'wordlist' — the shape must match the target section's kind. The operation is all-or-nothing: if any rule is invalid, none are created.



## OpenAPI

````yaml openapi.json post /styleguides/rules
openapi: 3.0.0
info:
  version: 1.0.0
  title: Ditto API
  description: Programmatically read and write data in your Ditto workspace.
servers:
  - url: https://api.dittowords.com/v2
security: []
paths:
  /styleguides/rules:
    post:
      tags:
        - Style guides
      summary: Create style guide rules
      description: >-
        Creates one or more rules in a style guide section. Look up the style
        guide's developer ID and section IDs via GET /styleguides. Use the
        {name, description, examples, tags, enabled} shape for a section whose
        kind is 'rules', or the {term, disallowed, description, tags, enabled}
        shape for a section whose kind is 'wordlist' — the shape must match the
        target section's kind. The operation is all-or-nothing: if any rule is
        invalid, none are created.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                styleguideId:
                  type: string
                  minLength: 1
                  description: Developer ID of the style guide to attach the rules to.
                sectionId:
                  type: string
                  minLength: 1
                  description: >-
                    ID of the section within the style guide to attach the rules
                    to.
                rules:
                  anyOf:
                    - type: array
                      items:
                        type: object
                        properties:
                          description:
                            type: string
                            description: >-
                              What the rule or entry represents. Defaults to an
                              empty string.
                          tags:
                            type: array
                            items:
                              type: string
                            description: >-
                              Tags scoping the rule or entry to specific text
                              surfaces; empty means it applies everywhere.
                          enabled:
                            type: boolean
                            description: Whether the rule is enabled. Defaults to true.
                          name:
                            type: string
                            minLength: 1
                            description: The rule's name. (rules sections)
                          examples:
                            type: array
                            items:
                              type: object
                              properties:
                                from:
                                  type: string
                                  description: Text that violates the rule.
                                to:
                                  type: string
                                  description: Corrected version of the text.
                              required:
                                - from
                                - to
                            description: >-
                              Before/after examples illustrating the rule.
                              Defaults to an empty array.
                        required:
                          - name
                        additionalProperties: false
                      minItems: 1
                    - type: array
                      items:
                        type: object
                        properties:
                          description:
                            type: string
                            description: >-
                              What the rule or entry represents. Defaults to an
                              empty string.
                          tags:
                            type: array
                            items:
                              type: string
                            description: >-
                              Tags scoping the rule or entry to specific text
                              surfaces; empty means it applies everywhere.
                          enabled:
                            type: boolean
                            description: Whether the rule is enabled. Defaults to true.
                          term:
                            type: string
                            minLength: 1
                            description: >-
                              The preferred term this entry governs. (wordlist
                              sections)
                          disallowed:
                            type: array
                            items:
                              type: string
                            description: >-
                              Disallowed words or phrases that should be
                              replaced with the term. Defaults to an empty
                              array.
                        required:
                          - term
                        additionalProperties: false
                      minItems: 1
                  description: >-
                    The rules to create — every item must use the same shape:
                    {name, description, examples, tags, enabled} for a 'rules'
                    section, or {term, disallowed, description, tags, enabled}
                    for a 'wordlist' section. The shape must also match the
                    target section's kind.
              required:
                - styleguideId
                - sectionId
                - rules
              example:
                styleguideId: acme-inc
                sectionId: foundations
                rules:
                  - name: Be concise
                    description: Remove filler words so text is easy to scan.
                    examples:
                      - from: Please click the button below
                        to: Click below
                    tags: []
            examples:
              create_style_rules:
                summary: Create rules in a 'rules' section
                value:
                  styleguideId: acme-inc
                  sectionId: foundations
                  rules:
                    - name: Be concise
                      description: Remove filler words so text is easy to scan.
                      examples:
                        - from: Please click the button below
                          to: Click below
                    - name: Use sentence case for headings
                      enabled: false
              create_wordlist_entries:
                summary: Create entries in a 'wordlist' section
                value:
                  styleguideId: acme-inc
                  sectionId: word-list
                  rules:
                    - term: AI agent
                      disallowed:
                        - bot
                        - chatbot
                      description: Use 'AI agent' instead of 'bot'.
      responses:
        '200':
          description: Returns the Developer IDs of the created rules, in request order
          content:
            application/json:
              schema:
                type: object
                properties:
                  ids:
                    type: array
                    items:
                      type: string
                    description: Developer IDs of the created rules, in request order.
                required:
                  - ids
                example:
                  ids:
                    - be-concise
        '400':
          description: >-
            Returned when the request body fails validation. Common causes
            include: an empty rules array, a rule missing its required field
            ('name' for a 'rules' section, 'term' for a 'wordlist' section), or
            a rule shape that doesn't match the target section's kind.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the validation failure
                required:
                  - message
              example:
                message: >-
                  Section 'word-list' is a wordlist; each entry must provide
                  'term' (and optional 'disallowed').
        '404':
          description: >-
            Returned when the style guide developer ID or section ID does not
            exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the validation failure
                required:
                  - message
              example:
                message: Style guide with developer ID 'acme-inc' not found
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````