# API Integration

> Integrate with TraceKit using the REST API. Register services, send OTLP traces and metrics, manage health checks, and configure webhooks.

- Canonical: https://tracekit.dev/docs/integration/api

# TraceKit API Integration

Use the TraceKit API for partner installers, framework integrations, custom setup flows, health checks, webhooks, and CLI-style automation.

TraceKit currently ingests OTLP traces and metrics. It does not expose a generic log ingestion endpoint. Dynamic logs are SDK-managed runtime capture points, documented under [Code Monitoring](/docs/code-monitoring).

## Base URL

```text
https://app.tracekit.dev
```

## Authentication

Most endpoints require an API key:

```bash
curl https://app.tracekit.dev/v1/integrate/status \
  -H "X-API-Key: ctxio_your_key"
```

Browser-safe public keys are supported only on endpoints that validate allowed origins.

## Registration Flow

```text
POST /v1/integrate/register
POST /v1/integrate/verify
GET  /v1/integrate/status
```

The register/verify flow creates or finds the account, verifies email, provisions a service and API key, and returns dashboard details.

## Telemetry

```text
POST /v1/traces
POST /v1/metrics
```

These endpoints accept OpenTelemetry Protocol payloads and validate API keys inside the handler.

## Dynamic Logs

Dynamic logs use SDK snapshot endpoints:

```text
GET  /sdk/snapshots/active/:service
GET  /sdk/snapshots/stream/:service
POST /sdk/snapshots/capture
POST /sdk/snapshots/auto-register
POST /sdk/snapshots/check-in
```

Use official SDKs for these endpoints when possible. They capture bounded runtime snapshots without adding permanent log statements or redeploying.

For authenticated server goals, see [Track goals](/docs/analytics/goals).

## Health Checks

```text
POST /v1/health/heartbeat
POST /api/health-checks
GET  /api/health-checks
```

Use heartbeats for push-based checks and `/api/health-checks` for managed pull checks.

## Alerts, Services, Traces, And Copilot

```text
GET /v1/traces
GET /v1/traces/stream
GET /v1/traces/:id

GET /v1/services
GET /v1/services/:name/detail
GET /v1/services/:name/errors

GET    /v1/alert-rules
POST   /v1/alert-rules
DELETE /v1/alert-rules/:id
POST   /v1/alert-rules/:id/toggle
GET    /v1/alert-rules/:id/history

GET  /v1/triage-inbox
POST /v1/triage-inbox/:id/acknowledge
POST /v1/triage-inbox/:id/investigate
POST /v1/triage-inbox/:id/resolve
POST /v1/triage-inbox/:id/snooze

POST /v1/copilot/ask
POST /v1/copilot/conversations
POST /v1/copilot/conversations/:id/messages
```

## Webhooks And Widgets

```text
POST   /v1/webhooks
GET    /v1/webhooks
GET    /v1/webhooks/:id
PUT    /v1/webhooks/:id
DELETE /v1/webhooks/:id

GET /v1/widgets/services/:name/badge
GET /v1/widgets/services/:name/metrics
GET /v1/widgets/alerts/summary
GET /v1/widgets/overview
```

## Source Maps And Session Replay

```text
POST   /api/sourcemaps
DELETE /api/sourcemaps
POST   /api/replays/:session_id/chunks
```

Source map upload/delete requires a non-public API key. Replay upload can use browser-safe public keys with origin validation.

## MCP

TraceKit exposes a remote MCP server at:

```text
https://app.tracekit.dev/mcp
```

Use MCP when an AI assistant needs production context from traces, services, metrics, alerts, anomalies, snapshots, LLM calls, and RCA.
