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

# PATCH /admin/api/rules/{id}



## OpenAPI

````yaml /generated/openapi.json patch /admin/api/rules/{id}
openapi: 3.1.0
info:
  description: >-
    Forwarding, management, portal and OAuth APIs generated from Rust types.
    Input and output schemas preserve their respective Serde contracts.
    Streaming events and WebSocket messages are documented alongside HTTP
    payloads.
  title: GPROXY HTTP API
  version: 4.2.1
servers: []
security:
  - bearer: []
  - anthropicKey: []
  - googleKey: []
  - queryKey: []
paths:
  /admin/api/rules/{id}:
    patch:
      tags:
        - Management
      summary: PATCH /admin/api/rules/{id}
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - description: Administrative scope selected by the caller.
          in: header
          name: x-gproxy-admin-scope
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Input_RewriteRulePatch'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Output_RewriteRuleDto'
          description: Success
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Output_Envelope'
          description: Gateway error
      security:
        - consoleSession: []
        - bearer: []
        - anthropicKey: []
        - googleKey: []
components:
  schemas:
    Input_RewriteRulePatch:
      properties:
        action:
          default: null
          type:
            - string
            - 'null'
        enabled:
          default: null
          type:
            - boolean
            - 'null'
        filterBody:
          default: null
        filterEventPattern:
          default: null
          type:
            - string
            - 'null'
        filterHeader:
          default: null
        filterHeaderPattern:
          default: null
          type:
            - string
            - 'null'
        filterModelPattern:
          default: null
          type:
            - string
            - 'null'
        filterOperationKeys:
          default: null
        paths:
          default: null
        pattern:
          default: null
          type:
            - string
            - 'null'
        phase:
          default: null
          type:
            - string
            - 'null'
        replacement:
          default: null
          type:
            - string
            - 'null'
        sortOrder:
          default: null
          format: int64
          type:
            - integer
            - 'null'
        target:
          default: null
          type:
            - string
            - 'null'
        targetName:
          default: null
          type:
            - string
            - 'null'
      type: object
    Output_RewriteRuleDto:
      description: |-
        One ordered replacement. Every write compiles the rule with core's own
        compiler first, so a rule that would be skipped at assembly is refused
        here instead of silently doing nothing.
      properties:
        action:
          default: replace
          type: string
        createdAtMs:
          format: int64
          type: integer
        enabled:
          type: boolean
        filterBody:
          default: null
        filterEventPattern:
          type:
            - string
            - 'null'
        filterHeader:
          default: null
        filterHeaderPattern:
          type:
            - string
            - 'null'
        filterModelPattern:
          type:
            - string
            - 'null'
        filterOperationKeys:
          description: 'JSON array of `{"operation": …, "dialect": …}`.'
        id:
          type: string
        paths:
          description: JSON array of dot paths; body target only.
        pattern:
          type: string
        phase:
          description: '`request`, `response` or `both`.'
          type: string
        replacement:
          type: string
        ruleSetId:
          type: string
        sortOrder:
          format: int64
          type: integer
        target:
          description: '`body`, `header` or `query`.'
          type: string
        targetName:
          type:
            - string
            - 'null'
        updatedAtMs:
          format: int64
          type: integer
      required:
        - id
        - ruleSetId
        - phase
        - action
        - target
        - targetName
        - paths
        - pattern
        - replacement
        - filterOperationKeys
        - filterModelPattern
        - filterHeaderPattern
        - filterEventPattern
        - filterBody
        - filterHeader
        - sortOrder
        - enabled
        - createdAtMs
        - updatedAtMs
      type: object
    Output_Envelope:
      properties:
        error:
          $ref: '#/components/schemas/Output_EnvelopeBody'
      required:
        - error
      type: object
    Output_EnvelopeBody:
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
  securitySchemes:
    bearer:
      scheme: bearer
      type: http
    anthropicKey:
      in: header
      name: x-api-key
      type: apiKey
    googleKey:
      in: header
      name: x-goog-api-key
      type: apiKey
    queryKey:
      in: query
      name: key
      type: apiKey
    consoleSession:
      in: cookie
      name: gproxy_session
      type: apiKey

````

## Related topics

- [PATCH /admin/api/rule-sets/{id}](https://gproxy.leenhawk.com/api-reference/management/patch-adminapirule-sets.md)
- [POST /admin/api/rules/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapirulesbatch.md)
- [POST /admin/api/rule-sets/batch](https://gproxy.leenhawk.com/api-reference/management/post-adminapirule-setsbatch.md)
- [DELETE /admin/api/rules/{id}](https://gproxy.leenhawk.com/api-reference/management/delete-adminapirules.md)
- [PATCH /admin/api/operation-rules/{id}](https://gproxy.leenhawk.com/api-reference/management/patch-adminapioperation-rules.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.