Koredeza Strata

API ยท preview

API reference

JSON over HTTPS. Preview, subject to change.

Preview, subject to change. Base URL https://api.koredeza.ca/v1. Design partners are told before any breaking change.

Authentication

Send your key as a bearer token. Keys belong to one organisation and carry scopes.

curl -s https://api.koredeza.ca/v1/watches \
  -H "Authorization: Bearer ks_test_9d41...redacted"
Scopes
ScopeGrants
sites:readRead sites, watches and passes
sites:writeCreate and change sites and watches
detections:readList detections and metrics
detections:reviewRecord decisions
hooks:adminManage webhook endpoints and secrets

Rate limits

Responses carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix time). Over the limit you receive 429 and a Retry-After header.

Errors

Errors
HTTPtypeWhen
400bad_requestBody is not valid JSON or a field is missing
401auth_requiredNo key, or the key is revoked
403scope_missingKey lacks the scope this endpoint needs
404no_such_objectUnknown ID in your organisation
409pass_in_progressThat pass is already being processed
422geometry_rejectedPolygon invalid or larger than your plan allows
429slow_downRate limit reached
503temporarily_unavailableRetry with backoff
{
  "type": "geometry_rejected",
  "detail": "Ring 0 crosses itself between vertices 8 and 9.",
  "trace": "tr_5LQ0A2"
}

POST/watches

Create a watch for a site. Needs sites:write.

{
  "site_id": "site_P7c",
  "sensors": ["sentinel-2-l2a", "landsat-c2-l2"],
  "cadence": "every_usable_pass",
  "categories": ["earthwork", "structure", "paving", "clearing", "water"]
}

201 Created

{
  "id": "wch_31Fa",
  "site_id": "site_P7c",
  "state": "active",
  "reference_pass": "pas_s2_20260311",
  "created": "2026-11-26T05:40:12Z"
}

GET/detections

List detections. Needs detections:read. Pagination uses page_after.

Query parameters
QueryMeaning
site_idOnly this site
stateopen, approved or rejected
categoryOne of the watch categories
seen_afterISO 8601 date
min_haSmallest area
page_size1 to 100, default 25
page_afterCursor from the last page
GET /v1/detections?site_id=site_P7c&state=approved&page_size=1
{
  "items": [
    {
      "id": "det_8Hq2",
      "site_id": "site_P7c",
      "category": "earthwork",
      "area_ha": 9.6,
      "confidence": 0.92,
      "first_seen": "2026-06-18",
      "state": "approved",
      "geometry": {"type": "Polygon", "coordinates": [[[77.402, 12.611], [77.419, 12.607], [77.420, 12.603], [77.402, 12.611]]]}
    }
  ],
  "page_after": "pa_MTI",
  "more": true
}

POST/detections/{id}/decision

Record a reviewer decision. Needs detections:review.

{
  "verdict": "approved",
  "category": "earthwork",
  "comment": "Matches the October progress report."
}
{
  "detection_id": "det_8Hq2",
  "state": "approved",
  "decided_at": "2026-11-26T06:02:44Z"
}

GET/sites/{id}/metrics

Summary for a site and period. Needs detections:read.

GET /v1/sites/site_P7c/metrics?from=2026-06-01&to=2026-11-30
{
  "site_id": "site_P7c",
  "passes": {"total": 31, "usable": 17, "mean_visible": 0.63},
  "detections": {"open": 2, "approved": 6, "rejected": 4},
  "approved_ha": {"earthwork": 9.6, "structure": 1.1, "paving": 0.0},
  "head_version": "shift-head-site_P7c-v4"
}

All values in these examples are synthetic.

Webhooks

Register an HTTPS endpoint. Each event is a JSON POST.

pass.failed

{
  "event": "evt_0Zk7",
  "type": "pass.failed",
  "at": "2026-11-26T04:11:09Z",
  "data": {"watch_id": "wch_31Fa", "pass_id": "pas_s2_20261124", "reason": "visible_below_floor", "visible": 0.06}
}

model.drift_detected

{
  "event": "evt_0Zk8",
  "type": "model.drift_detected",
  "at": "2026-11-26T04:15:51Z",
  "data": {"site_id": "site_P7c", "head_version": "shift-head-site_P7c-v4", "signal": "reject_share_28d", "value": 0.38, "limit": 0.2}
}

Signature check

Every request has X-Koredeza-Timestamp and X-Koredeza-Signature. The signature is the hex HMAC-SHA256 of timestamp + "." + raw body using your endpoint secret. Compare in constant time and reject timestamps more than 300 seconds old.

const crypto = require("crypto");

function verified(rawBody, ts, sig, secret) {
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const mac = crypto.createHmac("sha256", secret).update(ts + "." + rawBody).digest("hex");
  return mac.length === sig.length && crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(sig));
}

Delivery and retries

Return any 2xx within 10 seconds. Failed deliveries are retried up to 7 times over about 24 hours with growing gaps. Events can arrive more than once; de-duplicate on event.