Watches

Create watch

Create a new watch for a REST, OpenAPI, or MCP endpoint.

POST /api/watches Try in console →

Authorizations

Authorization
requiredstring

Bearer API key (dg_live_…) or use X-DriftGuard-Trial for trial session.

Body

application/json

url
requiredstring

Target URL to monitor — OpenAPI spec, API base, or MCP server.

label
string

Human-readable name shown in console and alerts.

watchType
string

rest, openapi, or mcp. Inferred when omitted.

Responses

201 — watch created. 422 — validation error or plan limit reached.

curl --request POST \
  --url https://driftguard.org/api/watches \
  --header 'Authorization: Bearer dg_live_…' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://api.stripe.com",
    "label": "Stripe API",
    "watchType": "openapi"
  }'
import requests

r = requests.post(
    "https://driftguard.org/api/watches",
    headers={"Authorization": "Bearer dg_live_…"},
    json={
        "url": "https://api.stripe.com",
        "label": "Stripe API",
        "watchType": "openapi",
    },
)
r.raise_for_status()
const res = await fetch("https://driftguard.org/api/watches", {
  method: "POST",
  headers: {
    Authorization: "Bearer dg_live_…",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://api.stripe.com",
    label: "Stripe API",
    watchType: "openapi",
  }),
});
{
  "id": "watch_abc123",
  "url": "https://api.stripe.com",
  "label": "Stripe API",
  "watchType": "openapi",
  "status": "active"
}
{
  "error": "plan_limit",
  "message": "Trial limited to one watch"
}