Skip to content

Breakpoints API

The Breakpoints API lets you define conditions under which live traffic is paused for inspection and modification. When a breakpoint is hit, the request or response is held until you resume it through the Web UI or via the Socket.IO breakpoint:resume event.

Endpoints Overview

MethodEndpointDescription
GET/api/breakpointsList all breakpoints
GET/api/breakpoints/enabledList enabled breakpoints only
GET/api/breakpoints/:idGet a specific breakpoint
POST/api/breakpointsCreate a new breakpoint
PUT/api/breakpoints/:idUpdate a breakpoint
PATCH/api/breakpoints/:id/toggleToggle breakpoint enabled/disabled
DELETE/api/breakpoints/:idDelete a breakpoint

List All Breakpoints

GET /api/breakpoints

Example Request

bash
curl http://localhost:8889/api/breakpoints

Response 200 OK

json
{
  "breakpoints": [
    {
      "id": "bp-uuid-1",
      "name": "Pause Login Requests",
      "enabled": true,
      "type": "request",
      "match": {
        "url": "*/api/auth/login",
        "method": "POST"
      },
      "conditions": [
        {
          "field": "header",
          "operator": "contains",
          "value": "Bearer",
          "headerName": "Authorization"
        }
      ],
      "conditionLogic": "and",
      "createdAt": 1709136000000
    }
  ]
}

List Enabled Breakpoints

GET /api/breakpoints/enabled

Example Request

bash
curl http://localhost:8889/api/breakpoints/enabled

Response 200 OK

json
{
  "breakpoints": [
    {
      "id": "bp-uuid-1",
      "name": "Pause Login Requests",
      "enabled": true,
      "..."
    }
  ]
}

Get Specific Breakpoint

GET /api/breakpoints/:id

Path Parameters

ParameterTypeDescription
idstringBreakpoint ID

Example Request

bash
curl http://localhost:8889/api/breakpoints/bp-uuid-1

Response 200 OK

Returns the full breakpoint object.

Error 404 Not Found

json
{
  "error": "Breakpoint not found"
}

Create a Breakpoint

POST /api/breakpoints

Request Body

json
{
  "name": "Pause API Responses",
  "enabled": true,
  "type": "response",
  "match": {
    "host": "api.example.com",
    "method": ["GET", "POST"]
  },
  "conditions": [
    {
      "field": "status",
      "operator": "greaterThan",
      "value": "399"
    }
  ],
  "conditionLogic": "and"
}
FieldTypeRequiredDescription
namestringYesHuman-readable breakpoint name
enabledbooleanNoDefault: true
typestringYesWhen to pause: request, response, or both
matchobjectYesURL/method matching criteria (same as Rules match object)
conditionsarrayNoAdditional conditions to evaluate (see Conditions)
conditionLogicstringNoHow to combine conditions: and (all must match) or or (any must match). Default: and

Example Request

bash
curl -X POST http://localhost:8889/api/breakpoints \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Intercept Error Responses",
    "enabled": true,
    "type": "response",
    "match": {
      "host": "api.example.com"
    },
    "conditions": [
      {
        "field": "status",
        "operator": "greaterThan",
        "value": "399"
      }
    ],
    "conditionLogic": "and"
  }'

Response 201 Created

json
{
  "id": "bp-uuid-2",
  "name": "Intercept Error Responses",
  "enabled": true,
  "type": "response",
  "match": {
    "host": "api.example.com"
  },
  "conditions": [
    {
      "field": "status",
      "operator": "greaterThan",
      "value": "399"
    }
  ],
  "conditionLogic": "and",
  "createdAt": 1709136000000
}

Update a Breakpoint

PUT /api/breakpoints/:id

Update an existing breakpoint. Only provided fields are updated.

Path Parameters

ParameterTypeDescription
idstringBreakpoint ID

Request Body

json
{
  "name": "Updated Breakpoint Name",
  "type": "both",
  "conditions": []
}

Example Request

bash
curl -X PUT http://localhost:8889/api/breakpoints/bp-uuid-1 \
  -H "Content-Type: application/json" \
  -d '{"name": "Renamed Breakpoint", "type": "both"}'

Response 200 OK

Returns the updated breakpoint object.

Error 404 Not Found

json
{
  "error": "Breakpoint not found"
}

Toggle Breakpoint

PATCH /api/breakpoints/:id/toggle

Toggle a breakpoint between enabled and disabled.

Path Parameters

ParameterTypeDescription
idstringBreakpoint ID

Example Request

bash
curl -X PATCH http://localhost:8889/api/breakpoints/bp-uuid-1/toggle

Response 200 OK

Returns the updated breakpoint object with the toggled enabled value.

Error 404 Not Found

json
{
  "error": "Breakpoint not found"
}

Delete a Breakpoint

DELETE /api/breakpoints/:id

Path Parameters

ParameterTypeDescription
idstringBreakpoint ID

Example Request

bash
curl -X DELETE http://localhost:8889/api/breakpoints/bp-uuid-1

Response 200 OK

json
{
  "success": true
}

Error 404 Not Found

json
{
  "error": "Breakpoint not found"
}

Breakpoint Types

TypeDescription
requestPauses the outgoing request before it is sent to the server. You can inspect and modify the request method, URL, headers, and body.
responsePauses the incoming response before it is returned to the client. You can inspect and modify the status code, headers, and body.
bothPauses on both the request and the response phases.

Conditions

Conditions provide fine-grained control over when a breakpoint triggers. Each condition evaluates a specific field using an operator.

Condition Object

json
{
  "field": "status",
  "operator": "greaterThan",
  "value": "499",
  "headerName": "Content-Type"
}
FieldTypeDescription
fieldstringThe field to evaluate
operatorstringThe comparison operator
valuestringThe value to compare against
headerNamestringHeader name (only when field is header)

Available Fields

FieldDescriptionExample Values
statusHTTP response status code"404", "500"
urlFull request URL"https://api.example.com"
methodHTTP method"POST", "DELETE"
headerSpecific header value (requires headerName)"application/json"
requestBodyRequest body content"password"
responseBodyResponse body content"error"
durationRequest duration in milliseconds"5000"
hostRequest hostname"api.example.com"

Available Operators

OperatorDescription
equalsExact match
containsSubstring match
startsWithStarts with the value
endsWithEnds with the value
matchesRegular expression match
greaterThanNumeric greater than
lessThanNumeric less than

Condition Logic

When multiple conditions are specified, the conditionLogic field determines how they are combined:

  • and (default): All conditions must be true for the breakpoint to trigger.
  • or: Any single condition being true triggers the breakpoint.

How Breakpoints Work

Breakpoint Flow

  1. A request/response matches the breakpoint's match criteria
  2. Additional conditions are evaluated (if any)
  3. If all criteria are met, a breakpoint:hit Socket.IO event is emitted
  4. The request/response is held in memory
  5. The user inspects and optionally modifies the data in the Web UI
  6. The user resumes via the UI or sends a breakpoint:resume Socket.IO event
  7. The modified request/response continues its journey

Timeout Behavior

Breakpoints have a configurable timeout (default: 30 seconds). If a breakpoint is not resumed within this period, the request is automatically forwarded without modifications. Configure the timeout via the breakpointTimeout setting.


Example: Intercept and Inspect Failed API Calls

bash
# Create a breakpoint that pauses on any 5xx error response
curl -X POST http://localhost:8889/api/breakpoints \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Server Errors",
    "enabled": true,
    "type": "response",
    "match": {
      "host": "api.example.com"
    },
    "conditions": [
      {
        "field": "status",
        "operator": "greaterThan",
        "value": "499"
      },
      {
        "field": "status",
        "operator": "lessThan",
        "value": "600"
      }
    ],
    "conditionLogic": "and"
  }'