API Reference

API Endpoints

Complete reference for all tracer API endpoints.

API Endpoints

Complete reference for the tracer REST API.

Base URL: https://api.tracer/v1

Monitors

List Monitors

GET /monitors

Query Parameters:

ParameterTypeDescription
typestringFilter by type: url, api, tcp, dns, heartbeat
statusstringFilter by status: active, paused
pagenumberPage number (default: 1)
per_pagenumberItems per page (default: 20, max: 100)

Example:

curl -X GET "https://api.tracer/v1/monitors?type=url&status=active" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response:

{
  "success": true,
  "data": [
    {
      "id": "mon_abc123",
      "name": "Production API",
      "type": "url",
      "url": "https://api.example.com/health",
      "interval": 60,
      "status": "active",
      "locations": ["us-east", "eu-west"],
      "created_at": "2024-01-15T10:00:00Z"
    }
  ],
  "meta": {
    "total": 15,
    "page": 1,
    "per_page": 20
  }
}

Create Monitor

POST /monitors

Request Body (URL Monitor):

{
  "name": "Production API",
  "type": "url",
  "url": "https://api.example.com/health",
  "method": "GET",
  "interval": 60,
  "timeout": 30,
  "locations": ["us-east", "eu-west"],
  "headers": {
    "Authorization": "Bearer token"
  },
  "assertions": [
    {
      "type": "status_code",
      "operator": "equals",
      "value": 200
    }
  ]
}

Request Body (TCP Monitor):

{
  "name": "Database Check",
  "type": "tcp",
  "host": "db.example.com",
  "port": 5432,
  "interval": 60,
  "timeout": 10,
  "locations": ["us-east"],
  "tls": {
    "enabled": false
  }
}

Get Monitor

GET /monitors/:id

Response:

{
  "success": true,
  "data": {
    "id": "mon_abc123",
    "name": "Production API",
    "type": "url",
    "url": "https://api.example.com/health",
    "interval": 60,
    "status": "active",
    "last_run": {
      "id": "run_xyz789",
      "status": "success",
      "duration_ms": 245,
      "completed_at": "2024-01-15T10:30:00Z"
    },
    "stats": {
      "uptime_24h": 99.9,
      "avg_response_ms": 230
    }
  }
}

Update Monitor

PUT /monitors/:id

Request Body:

{
  "name": "Updated Name",
  "interval": 120,
  "status": "paused"
}

Delete Monitor

DELETE /monitors/:id

Response:

{
  "success": true,
  "data": {
    "id": "mon_abc123",
    "deleted": true
  }
}

Trigger Run

POST /monitors/:id/run

Response:

{
  "success": true,
  "data": {
    "run_id": "run_xyz789",
    "status": "queued",
    "locations": ["us-east", "eu-west"]
  }
}

Get Monitor Runs

GET /monitors/:id/runs

Query Parameters:

ParameterTypeDescription
statusstringFilter: success, failed
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)
locationstringFilter by location

Journeys

List Journeys

GET /journeys

Create Journey

POST /journeys

Request Body:

{
  "name": "Login Flow",
  "description": "Tests the user login process",
  "interval": 300,
  "timeout": 60,
  "locations": ["us-east"],
  "steps": [
    {
      "type": "goto",
      "url": "https://app.example.com/login"
    },
    {
      "type": "fill",
      "selector": "#email",
      "value": "[email protected]"
    },
    {
      "type": "fill",
      "selector": "#password",
      "value": "{{PASSWORD}}"
    },
    {
      "type": "click",
      "selector": "button[type='submit']"
    },
    {
      "type": "expect_visible",
      "selector": ".dashboard"
    }
  ],
  "variables": {
    "PASSWORD": "test123"
  }
}

Get Journey

GET /journeys/:id

Update Journey

PUT /journeys/:id

Delete Journey

DELETE /journeys/:id

Trigger Journey Run

POST /journeys/:id/run

Get Journey Runs

GET /journeys/:id/runs

Run Journeys by Tag

POST /journeys/run-tag/:tag

Run all journeys with a specific tag (useful for CI/CD):

curl -X POST "https://api.tracer/v1/journeys/run-tag/smoke" \
  -H "Authorization: Bearer YOUR_API_KEY"

Runs

Get Run Details

GET /runs/:id

Response:

{
  "success": true,
  "data": {
    "id": "run_xyz789",
    "monitor_id": "mon_abc123",
    "status": "success",
    "location": "us-east",
    "started_at": "2024-01-15T10:30:00Z",
    "completed_at": "2024-01-15T10:30:01Z",
    "duration_ms": 245,
    "metrics": {
      "dns_ms": 15,
      "connect_ms": 45,
      "tls_ms": 80,
      "ttfb_ms": 190,
      "download_ms": 55
    },
    "assertions": [
      {
        "type": "status_code",
        "expected": 200,
        "actual": 200,
        "passed": true
      }
    ]
  }
}

Get Run Steps (Journeys)

GET /runs/:id/steps

Get Run Artifacts

GET /runs/:id/artifacts

Returns URLs to download screenshots and traces.

Alerts

List Alerts

GET /alerts

Query Parameters:

ParameterTypeDescription
statusstringtriggered, acknowledged, resolved
severitystringcritical, high, medium, low

Get Alert

GET /alerts/:id

Acknowledge Alert

POST /alerts/:id/acknowledge

Request Body:

{
  "note": "Looking into this issue"
}

Resolve Alert

POST /alerts/:id/resolve

Request Body:

{
  "note": "Fixed by deploying v2.1.0"
}

Alert Channels

List Channels

GET /alert-channels

Create Channel

POST /alert-channels

Slack Channel:

{
  "name": "Ops Alerts",
  "type": "slack",
  "config": {
    "webhook_url": "https://hooks.slack.com/..."
  }
}

Email Channel:

{
  "name": "Email Alerts",
  "type": "email",
  "config": {
    "recipients": ["[email protected]"]
  }
}

Webhook Channel:

{
  "name": "PagerDuty",
  "type": "webhook",
  "config": {
    "url": "https://events.pagerduty.com/...",
    "headers": {
      "Authorization": "Token ..."
    }
  }
}

Alert Rules

List Rules

GET /alert-rules

Create Rule

POST /alert-rules

Request Body:

{
  "name": "Critical Failures",
  "type": "consecutive_failures",
  "threshold": 3,
  "severity": "critical",
  "channels": ["chan_abc123"],
  "apply_to": {
    "monitors": ["mon_xyz789"],
    "tags": ["production"]
  }
}

Organization

Get Organization

GET /organization

List Members

GET /organization/members

Invite Member

POST /organization/invite

Request Body:

{
  "email": "[email protected]",
  "role": "member"
}

Remove Member

DELETE /organization/members/:id

Usage & Billing

Get Current Usage

GET /billing/usage

Response:

{
  "success": true,
  "data": {
    "period": {
      "start": "2024-01-01T00:00:00Z",
      "end": "2024-01-31T23:59:59Z"
    },
    "usage": {
      "monitors": {
        "used": 15,
        "limit": 20
      },
      "browser_runs": {
        "used": 650,
        "limit": 1000
      },
      "api_runs": {
        "used": 2100,
        "limit": 5000
      }
    }
  }
}

Get Plans

GET /billing/plans

Webhooks

Test Webhook

POST /webhooks/:id/test

Sends a test event to your webhook endpoint.

All timestamps are in UTC and use ISO 8601 format.