routers
Manage routers that map router_id samples to one or more breakers (fan-in/fan-out).
GET
/v1/projects/:project_id/routers
List all routers for a project
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Responses
200
List of routers with breaker counts
routersExample
Request
curl https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
{
"routers": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "api-gateway",
"mode": "static",
"enabled": true,
"created_by": "user",
"breaker_count": 3,
"inserted_at": "2024-01-15T10:30:00Z"
}
]
}
GET
/v1/projects/:project_id/routers/:router_id
Retrieve a router with linked breakers
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
router_id |
path | uuid | Yes | Router ID |
Responses
200
Router details with linked breakers
router
404
Router not found
Example
Request
curl https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers/ROUTER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
{
"router": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "api-gateway",
"mode": "static",
"enabled": true,
"created_by": "user",
"inserted_at": "2024-01-15T10:30:00Z",
"breakers": [
{"id": "660e8400-e29b-41d4-a716-446655440001", "name": "API Latency P95"}
]
}
}
POST
/v1/projects/:project_id/routers
Create a new router
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
Request Body
breaker_ids
mode
name
Responses
201
Router created
router
404
Project or breaker not found
422
Validation failed
Example
Request
curl -X POST https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "api-gateway",
"breaker_ids": ["660e8400-e29b-41d4-a716-446655440001", "660e8400-e29b-41d4-a716-446655440002"]
}'
Response
{
"router": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "api-gateway",
"mode": "static",
"enabled": true,
"created_by": "user",
"inserted_at": "2024-01-15T10:30:00Z",
"breakers": [
{"id": "660e8400-e29b-41d4-a716-446655440001", "name": "API Latency P95"},
{"id": "660e8400-e29b-41d4-a716-446655440002", "name": "API Error Rate"}
]
}
}
PATCH
/v1/projects/:project_id/routers/:router_id
Update router properties
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
router_id |
path | uuid | Yes | Router ID |
Request Body
enabled
mode
name
Responses
200
Router updated
router
404
Router not found
422
Validation failed
Example
Request
curl -X PATCH https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers/ROUTER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "primary-api-gateway", "enabled": false}'
Response
{
"router": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "primary-api-gateway",
"mode": "static",
"enabled": false,
"created_by": "user",
"inserted_at": "2024-01-15T10:30:00Z"
}
}
DELETE
/v1/projects/:project_id/routers/:router_id
Delete a router (must unlink breakers first)
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
router_id |
path | uuid | Yes | Router ID |
Responses
204
Router deleted
404
Router not found
409
Router has linked breakers (unlink them first)
Example
Request
curl -X DELETE https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers/ROUTER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
(empty body, 204 No Content)
POST
/v1/projects/:project_id/routers/:router_id/breakers
Link breakers to a router
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
router_id |
path | uuid | Yes | Router ID |
Request Body
breaker_ids
*
Responses
200
Breakers linked
router
404
Router or breaker not found
422
Validation failed
Example
Request
curl -X POST https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers/ROUTER_ID/breakers \
-H "Authorization: Bearer YOUR_USER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"breaker_ids": ["660e8400-e29b-41d4-a716-446655440003", "660e8400-e29b-41d4-a716-446655440004"]}'
Response
{
"router": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "api-gateway",
"breakers": [
{"id": "660e8400-e29b-41d4-a716-446655440003", "name": "Checkout Errors"},
{"id": "660e8400-e29b-41d4-a716-446655440004", "name": "Payment Latency"}
]
}
}
DELETE
/v1/projects/:project_id/routers/:router_id/breakers/:breaker_id
Unlink a breaker from a router
Auth:
User API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
project_id |
path | uuid | Yes | Project ID |
router_id |
path | uuid | Yes | Router ID |
breaker_id |
path | uuid | Yes | Breaker ID to unlink |
Responses
204
Breaker unlinked
404
Router or breaker not found
Example
Request
curl -X DELETE https://api.tripswitch.dev/v1/projects/PROJECT_ID/routers/ROUTER_ID/breakers/BREAKER_ID \
-H "Authorization: Bearer YOUR_USER_API_KEY"
Response
(empty body, 204 No Content)