Skip to main content

Bulk replace all rules

PUT 

/v2/endpoints/:endpoint/rules

Atomically replaces all existing rules with a new set of rules. This is a destructive operation that completely overwrites the current rule configuration.

Purpose:

  • Sync rules from version control or external systems
  • Restore rules from backup
  • Deploy rule configurations across multiple environments
  • Perform bulk rule updates without individual API calls

How It Works:

  1. Atomic Replacement: All existing rules are deleted and replaced in a single transaction
  2. Rule Order Preservation: Rules are stored and executed in the order provided in the array
  3. Validation: All rules are validated before replacement (if any rule is invalid, the entire operation fails)

Validation Rules:

  • Each rule must have valid enabled, conditions, and action fields
  • Conditions array must contain 1-5 items
  • All condition types must be valid (path, header, body, etc.)
  • Action type must be one of: mock, weighted, callout, crud, grpc
  • For weighted actions, response weights must sum to exactly 100

Limitations:

  • Maximum rules per endpoint: 500
  • Request body size limit: 1MB

Use Cases:

  • CI/CD Integration: Deploy rules as part of automated pipelines
  • Environment Sync: Copy production rules to staging/dev environments
  • Backup/Restore: Periodically backup rules and restore when needed
  • Bulk Updates: Modify multiple rules offline and push all changes at once

Response: Returns the count of replaced rules on success.

Request

Responses

Rules replaced