Skip to content

Annotations API

The Annotations API allows you to attach notes, color labels, and tags to individual traffic entries. Annotations help you mark interesting requests, flag issues, and organize your analysis.

Endpoints Overview

MethodEndpointDescription
GET/api/annotationsList all annotations
GET/api/annotations/:trafficIdGet annotations for a traffic entry
POST/api/annotationsCreate an annotation
PUT/api/annotations/:idUpdate an annotation
DELETE/api/annotations/:idDelete an annotation

List All Annotations

GET /api/annotations

Retrieve all annotations across all traffic entries.

Example Request

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

Response 200 OK

json
{
  "annotations": [
    {
      "id": "ann-uuid-1",
      "trafficId": "traffic-uuid-1",
      "content": "This request returns stale data - investigate caching",
      "color": "red",
      "tags": ["bug", "caching"],
      "createdAt": 1709136000000,
      "updatedAt": 1709136000000
    },
    {
      "id": "ann-uuid-2",
      "trafficId": "traffic-uuid-2",
      "content": "Successful login flow",
      "color": "green",
      "tags": ["auth", "working"],
      "createdAt": 1709136100000,
      "updatedAt": 1709136100000
    }
  ]
}

Get Annotations for Traffic Entry

GET /api/annotations/:trafficId

Retrieve all annotations attached to a specific traffic entry.

Path Parameters

ParameterTypeDescription
trafficIdstringTraffic entry ID

Example Request

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

Response 200 OK

json
{
  "annotations": [
    {
      "id": "ann-uuid-1",
      "trafficId": "traffic-uuid-1",
      "content": "This request returns stale data - investigate caching",
      "color": "red",
      "tags": ["bug", "caching"],
      "createdAt": 1709136000000,
      "updatedAt": 1709136000000
    }
  ]
}

Create an Annotation

POST /api/annotations

Create a new annotation attached to a traffic entry.

Request Body

json
{
  "trafficId": "traffic-uuid-1",
  "content": "Slow response - possible database query issue",
  "color": "yellow",
  "tags": ["performance", "database"]
}
FieldTypeRequiredDescription
trafficIdstringYesTraffic entry ID to annotate
contentstringYesAnnotation text content
colorstringNoColor label (see available colors). Default varies.
tagsstring[]NoArray of tag strings for categorization

Example Request

bash
curl -X POST http://localhost:8889/api/annotations \
  -H "Content-Type: application/json" \
  -d '{
    "trafficId": "traffic-uuid-1",
    "content": "Returns 401 when token expires - need refresh logic",
    "color": "red",
    "tags": ["auth", "bug", "token-refresh"]
  }'

Response 201 Created

json
{
  "id": "ann-uuid-3",
  "trafficId": "traffic-uuid-1",
  "content": "Returns 401 when token expires - need refresh logic",
  "color": "red",
  "tags": ["auth", "bug", "token-refresh"],
  "createdAt": 1709136200000,
  "updatedAt": 1709136200000
}

Error 400 Bad Request

json
{
  "error": "trafficId is required"
}
json
{
  "error": "content is required"
}

Update an Annotation

PUT /api/annotations/:id

Update an existing annotation. Only provided fields are changed.

Path Parameters

ParameterTypeDescription
idstringAnnotation ID

Request Body

json
{
  "content": "Updated analysis text",
  "color": "green",
  "tags": ["resolved", "verified"]
}
FieldTypeRequiredDescription
contentstringNoUpdated annotation text
colorstringNoUpdated color label
tagsstring[]NoUpdated tags array

Example Request

bash
curl -X PUT http://localhost:8889/api/annotations/ann-uuid-1 \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Fixed - caching issue resolved with Cache-Control headers",
    "color": "green",
    "tags": ["resolved", "caching"]
  }'

Response 200 OK

Returns the updated annotation object.

Error 404 Not Found

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

Delete an Annotation

DELETE /api/annotations/:id

Path Parameters

ParameterTypeDescription
idstringAnnotation ID

Example Request

bash
curl -X DELETE http://localhost:8889/api/annotations/ann-uuid-1

Response 200 OK

json
{
  "success": true
}

Error 404 Not Found

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

Available Colors

Annotations support the following color labels for visual categorization:

ColorTypical Usage
grayGeneral notes, informational
redBugs, errors, critical issues
orangeWarnings, attention needed
yellowPerformance concerns, investigation needed
greenWorking correctly, verified, resolved
blueInformational, reference points
purpleSpecial cases, custom behavior

Annotation Schema

Full Annotation Schema
FieldTypeDescription
idstringUnique annotation identifier
trafficIdstringID of the traffic entry this annotation is attached to
contentstringAnnotation text content
colorstringColor label: gray, red, orange, yellow, green, blue, or purple
tagsstring[]Array of tag strings for categorization
createdAtnumberUnix timestamp in milliseconds
updatedAtnumberUnix timestamp in milliseconds

Example: Bug Investigation Workflow

Annotate requests during debugging
bash
# Mark a suspicious request
curl -X POST http://localhost:8889/api/annotations \
  -H "Content-Type: application/json" \
  -d '{
    "trafficId": "traffic-uuid-1",
    "content": "Returns 500 intermittently - race condition?",
    "color": "red",
    "tags": ["bug", "intermittent", "500-error"]
  }'

# Mark the successful case for comparison
curl -X POST http://localhost:8889/api/annotations \
  -H "Content-Type: application/json" \
  -d '{
    "trafficId": "traffic-uuid-2",
    "content": "Same endpoint works when called 100ms later",
    "color": "green",
    "tags": ["reference", "working"]
  }'

# After fixing, update the annotation
curl -X PUT http://localhost:8889/api/annotations/ann-uuid-1 \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Fixed: race condition in database transaction - added mutex",
    "color": "green",
    "tags": ["resolved", "race-condition"]
  }'