breakers
Configure circuit breakers for a project. Breakers evaluate metric rules and trigger actions as they trip and recover.
GET
/v1/projects/:project_id/breakers
List all breakers for a project
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Responses
200
List of breakers
breakerscounthashupdated_at
Headers:
ETag: Weak ETag for conditional requests
304
Not modified (ETag match)
Example
Request
curl https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
{
"breakers": [
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "API Latency",
"metric": "api.latency_ms",
"kind": "p95",
"op": "gt",
"threshold": 500,
"window_ms": 60000,
"min_state_duration_ms": 60000,
"cooldown_ms": 300000,
"router_id": "550e8400-e29b-41d4-a716-446655440000"
}
],
"hash": "abc123",
"updated_at": "2024-01-15T10:30:00",
"count": 1
}
GET
/v1/projects/:project_id/breakers/:breaker_id
Get a single breaker
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
breaker_id |
path | uuid | Yes | Breaker ID |
Responses
200
Breaker details
breakerrouter_id
404
Breaker not found
Example
Request
curl https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers/BREAKER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
{
"breaker": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "API Latency",
"metric": "api.latency_ms",
"kind": "p95",
"op": "gt",
"threshold": 500,
"window_ms": 60000,
"min_state_duration_ms": 60000,
"cooldown_ms": 0
},
"router_id": "550e8400-e29b-41d4-a716-446655440000"
}
POST
/v1/projects/:project_id/breakers
Create a single breaker
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Request Body
kind
*
metric
*
op
*
threshold
*
actions
cooldown_ms
eval_interval_ms
half_open_backoff_cap_ms
half_open_backoff_enabled
half_open_confirmation_ms
half_open_indeterminate_policy
id
kind_params
min_count
min_state_duration_ms
name
window_ms
Responses
201
Breaker created
breakerrouter_id
409
Breaker with this ID already exists
422
Validation failed
Example
Request
curl -X POST https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "API Latency",
"metric": "api.latency_ms",
"kind": "p95",
"op": "gt",
"threshold": 500,
"window_ms": 60000
}'
Response
{
"breaker": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "API Latency",
"metric": "api.latency_ms",
"kind": "p95",
"op": "gt",
"threshold": 500,
"window_ms": 60000,
"min_state_duration_ms": 60000,
"cooldown_ms": 0
},
"router_id": "550e8400-e29b-41d4-a716-446655440000"
}
PATCH
/v1/projects/:project_id/breakers/:breaker_id
Update a breaker
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
breaker_id |
path | uuid | Yes | Breaker ID |
Request Body
actions
cooldown_ms
eval_interval_ms
half_open_backoff_cap_ms
half_open_backoff_enabled
half_open_confirmation_ms
half_open_indeterminate_policy
kind
kind_params
metric
min_count
min_state_duration_ms
name
op
threshold
window_ms
Responses
200
Breaker updated
breaker
404
Breaker not found
422
Validation failed
Example
Request
curl -X PATCH https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers/BREAKER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"threshold": 750}'
Response
{
"breaker": {
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "API Latency",
"metric": "api.latency_ms",
"kind": "p95",
"op": "gt",
"threshold": 750,
"window_ms": 60000
}
}
PUT
/v1/projects/:project_id/breakers
Replace all breakers (bulk sync)
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Request Body
breakers
*
Responses
200
Breakers replaced
changedcountduration_mshash
409
Guardrail blocked destructive change
412
Precondition failed (If-Match header mismatch)
422
Validation failed
Example
Request
curl -X PUT https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"breakers": [
{"name": "API Latency", "metric": "api.latency_ms", "kind": "p95", "op": "gt", "threshold": 500}
]
}'
Response
{
"changed": true,
"count": 1,
"hash": "abc123",
"duration_ms": 45
}
DELETE
/v1/projects/:project_id/breakers/:breaker_id
Delete a breaker
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
breaker_id |
path | uuid | Yes | Breaker ID |
Responses
204
Breaker deleted
404
Breaker not found
Example
Request
curl -X DELETE https://api.tripswitch.dev/v1/projects/PROJECT_ID/breakers/BREAKER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
(empty body, 204 No Content)