Today we're launching Mutation Rules v2, our biggest platform update since launch. This release makes Stage dramatically more powerful while also being easier to use.
What's New
JSON Path Expressions
You can now use JSON Path to surgically target specific fields in API responses:
{
"match": { "path": "/api/products/*" },
"action": {
"type": "patch",
"operations": [
{ "op": "replace", "path": "$.price.amount", "value": 0.01 },
{ "op": "add", "path": "$.flags", "value": ["test_mode"] }
]
}
}
Conditional Logic
Rules can now include conditions that evaluate request or response data:
{
"match": {
"path": "/api/users/*",
"conditions": [
{ "field": "$.role", "equals": "admin" }
]
},
"action": { "type": "latency", "ms": 5000 }
}
This is perfect for testing how your app handles slow responses for specific user types.
Visual Rule Builder
For teams who prefer a GUI, we've built a visual rule builder that generates JSON configuration automatically. No more hand-editing config files!
Response Templates
Create reusable response templates for common scenarios:
- Payment declined: Standard response for testing declined transactions
- Rate limited: 429 response with retry headers
- Service unavailable: 503 with maintenance message
Migration Guide
Existing rules continue to work without changes. If you want to take advantage of new features, check out our migration guide.
What's Next
We're already working on:
- Request mutation: Modify outgoing requests, not just responses
- Webhooks: Trigger actions when rules match
- Analytics: See which rules are being triggered and how often