Skip to content

Traffic API

The Traffic API provides endpoints for listing, searching, inspecting, deleting, and replaying captured HTTP/HTTPS traffic entries.

Endpoints Overview

MethodEndpointDescription
GET/api/trafficList traffic entries with filtering
GET/api/traffic/searchGlobal search across sessions
GET/api/traffic/stats/:sessionIdGet session statistics
GET/api/traffic/:idGet a specific traffic entry
DELETE/api/traffic/:idDelete a specific entry
DELETE/api/traffic/session/:sessionIdClear all traffic in a session
POST/api/traffic/:id/replayReplay a captured request
POST/api/traffic/replayExecute a custom request

List Traffic Entries

GET /api/traffic

Retrieve traffic entries with optional filtering, sorting, and pagination.

Query Parameters

ParameterTypeDefaultDescription
sessionIdstring-Filter by session ID
limitnumber1000Maximum entries to return
offsetnumber0Number of entries to skip
searchstring-Search in URL, host, and path
methodsstring-Comma-separated list of HTTP methods (e.g., GET,POST)
statusCodesstring-Comma-separated status codes (e.g., 200,404,500)
hostsstring-Comma-separated hostnames
sortFieldstring-Sort field: timestamp, duration, size, status, host, method
sortDirectionstringdescSort direction: asc or desc

Example Request

bash
curl "http://localhost:8889/api/traffic?sessionId=abc123&limit=50&methods=GET,POST&search=api"

Response 200 OK

json
{
  "entries": [
    {
      "id": "entry-uuid-1",
      "sessionId": "session-uuid",
      "timestamp": 1709136000000,
      "method": "GET",
      "url": "https://api.example.com/users",
      "protocol": "https",
      "host": "api.example.com",
      "path": "/users",
      "requestHeaders": {
        "accept": "application/json",
        "user-agent": "Mozilla/5.0"
      },
      "requestBody": null,
      "requestBodySize": 0,
      "status": 200,
      "statusText": "OK",
      "responseHeaders": {
        "content-type": "application/json",
        "content-length": "1234"
      },
      "responseBody": "eyJkYXRhIjpbXX0=",
      "responseBodySize": 1234,
      "duration": 145,
      "remoteAddress": "93.184.216.34",
      "tlsVersion": "TLSv1.3",
      "error": null,
      "isComplete": true,
      "isMocked": false,
      "isBreakpointed": false,
      "isTruncated": false
    }
  ],
  "count": 1
}

Body Encoding

The requestBody and responseBody fields are base64-encoded in JSON responses. Decode them to get the original content. A null value indicates no body was present.


GET /api/traffic/search

Search across all sessions with advanced filtering options.

Query Parameters

ParameterTypeDefaultDescription
qstringrequiredSearch query string
searchInstringurl,headers,bodyComma-separated search targets: url, headers, body
methodsstring-Comma-separated HTTP methods to filter
statusCodesstring-Comma-separated status codes to filter
limitnumber50Maximum results to return
offsetnumber0Number of results to skip

Example Request

bash
curl "http://localhost:8889/api/traffic/search?q=authentication&searchIn=url,headers&limit=20"

Response 200 OK

json
{
  "entries": [
    {
      "id": "entry-uuid-1",
      "sessionId": "session-uuid",
      "method": "POST",
      "url": "https://api.example.com/authentication/login",
      "status": 200,
      "..."
    }
  ],
  "total": 5,
  "sessionNames": {
    "session-uuid": "My Session"
  }
}

Error 400 Bad Request

json
{
  "error": "Search query is required"
}

Get Traffic Entry

GET /api/traffic/:id

Retrieve a single traffic entry with full details including request and response bodies.

Path Parameters

ParameterTypeDescription
idstringTraffic entry ID

Example Request

bash
curl http://localhost:8889/api/traffic/entry-uuid-1

Response 200 OK

json
{
  "id": "entry-uuid-1",
  "sessionId": "session-uuid",
  "timestamp": 1709136000000,
  "method": "POST",
  "url": "https://api.example.com/users",
  "protocol": "https",
  "host": "api.example.com",
  "path": "/users",
  "requestHeaders": {
    "content-type": "application/json",
    "authorization": "Bearer token123"
  },
  "requestBody": "eyJuYW1lIjoiSm9obiJ9",
  "requestBodySize": 15,
  "status": 201,
  "statusText": "Created",
  "responseHeaders": {
    "content-type": "application/json",
    "location": "/users/42"
  },
  "responseBody": "eyJpZCI6NDIsIm5hbWUiOiJKb2huIn0=",
  "responseBodySize": 24,
  "duration": 230,
  "remoteAddress": "93.184.216.34",
  "tlsVersion": "TLSv1.3",
  "error": null,
  "isComplete": true,
  "isMocked": false,
  "isBreakpointed": false,
  "isTruncated": false
}

Error 404 Not Found

json
{
  "error": "Traffic entry not found"
}

Get Session Statistics

GET /api/traffic/stats/:sessionId

Retrieve aggregate statistics for a capture session.

Path Parameters

ParameterTypeDescription
sessionIdstringSession ID

Example Request

bash
curl http://localhost:8889/api/traffic/stats/session-uuid

Response 200 OK

json
{
  "totalRequests": 142,
  "completedRequests": 140,
  "failedRequests": 2,
  "totalBytes": 2457600,
  "avgDuration": 185.5
}
Response Field Descriptions
FieldTypeDescription
totalRequestsnumberTotal number of requests captured
completedRequestsnumberRequests that received a response
failedRequestsnumberRequests that resulted in errors
totalBytesnumberTotal size of all request and response bodies in bytes
avgDurationnumberAverage request duration in milliseconds

Delete Traffic Entry

DELETE /api/traffic/:id

Delete a single traffic entry.

Path Parameters

ParameterTypeDescription
idstringTraffic entry ID

Example Request

bash
curl -X DELETE http://localhost:8889/api/traffic/entry-uuid-1

Response 200 OK

json
{
  "success": true
}

Error 404 Not Found

json
{
  "error": "Traffic entry not found"
}

Clear Session Traffic

DELETE /api/traffic/session/:sessionId

Delete all traffic entries for a given session.

Path Parameters

ParameterTypeDescription
sessionIdstringSession ID

Example Request

bash
curl -X DELETE http://localhost:8889/api/traffic/session/session-uuid

Response 200 OK

json
{
  "success": true
}

Irreversible

This operation permanently deletes all traffic data for the session. It cannot be undone.


Replay a Captured Request

POST /api/traffic/:id/replay

Re-send a previously captured request, optionally with modifications. The response includes the new result and a comparison with the original.

Path Parameters

ParameterTypeDescription
idstringTraffic entry ID to replay

Request Body (optional modifications)

json
{
  "method": "POST",
  "url": "https://api.example.com/users/updated",
  "headers": {
    "Authorization": "Bearer new-token"
  },
  "body": "{\"name\": \"Updated\"}"
}

All fields are optional. Omitted fields retain their original values from the captured request.

Example Request

bash
curl -X POST http://localhost:8889/api/traffic/entry-uuid-1/replay \
  -H "Content-Type: application/json" \
  -d '{"headers": {"Authorization": "Bearer new-token"}}'

Response 200 OK

json
{
  "result": {
    "status": 200,
    "statusText": "OK",
    "headers": {
      "content-type": "application/json"
    },
    "body": "eyJzdWNjZXNzIjp0cnVlfQ==",
    "duration": 198
  },
  "comparison": {
    "statusChanged": false,
    "headersChanged": true,
    "bodyChanged": true
  },
  "originalId": "entry-uuid-1"
}

Error 404 Not Found

json
{
  "error": "Traffic entry not found"
}

Execute Custom Request

POST /api/traffic/replay

Send a custom HTTP request through the proxy and receive the response. This does not require an existing traffic entry.

Request Body

json
{
  "method": "GET",
  "url": "https://api.example.com/health",
  "headers": {
    "Accept": "application/json"
  },
  "body": null,
  "timeout": 30000
}
FieldTypeRequiredDescription
methodstringYesHTTP method (GET, POST, PUT, DELETE, etc.)
urlstringYesFull URL to send the request to
headersobjectNoKey-value pairs of request headers
bodystringNoRequest body content
timeoutnumberNoRequest timeout in milliseconds

Example Request

bash
curl -X POST http://localhost:8889/api/traffic/replay \
  -H "Content-Type: application/json" \
  -d '{
    "method": "POST",
    "url": "https://httpbin.org/post",
    "headers": {"Content-Type": "application/json"},
    "body": "{\"key\": \"value\"}"
  }'

Response 200 OK

json
{
  "status": 200,
  "statusText": "OK",
  "headers": {
    "content-type": "application/json",
    "content-length": "512"
  },
  "body": "eyJhcmdzIjp7fSwiZGF0YSI6IntcImtleVwiOiBcInZhbHVlXCJ9In0=",
  "duration": 342
}

Error 400 Bad Request

json
{
  "error": "Method and URL are required"
}

Traffic Entry Schema

Full TrafficEntry Schema
FieldTypeDescription
idstringUnique identifier
sessionIdstringParent session ID
timestampnumberUnix timestamp in milliseconds
methodstringHTTP method (GET, POST, PUT, etc.)
urlstringFull request URL
protocolstringProtocol: http, https, ws, or wss
hoststringRequest hostname
pathstringURL path
requestHeadersobjectRequest headers as key-value pairs
requestBodystring|nullBase64-encoded request body
requestBodySizenumberRequest body size in bytes
statusnumber|nullHTTP response status code
statusTextstring|nullHTTP response status text
responseHeadersobject|nullResponse headers as key-value pairs
responseBodystring|nullBase64-encoded response body
responseBodySizenumber|nullResponse body size in bytes
durationnumber|nullRequest duration in milliseconds
remoteAddressstring|nullServer IP address
tlsVersionstring|nullTLS version used (e.g., TLSv1.3)
errorstring|nullError message if request failed
isCompletebooleanWhether the response has been fully received
isMockedbooleanWhether the response was generated by a mock rule
isBreakpointedbooleanWhether the request was paused by a breakpoint
isTruncatedbooleanWhether the body was truncated due to size limits