CortexVigil API Reference

Quickstart

This guide gets you from zero to your first authenticated API call in under five minutes.

1. Get a Key

Follow Authentication → Where to Create a Key. Use a cvk_test_ key against staging while integrating.

Base URLs:

2. List Cameras (curl)

curl -sS \
  -H "X-API-Key: cvk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Accept: application/json" \
  "https://staging-api.cortexvigil.com/api/v1/cameras"

Expected response:

{
  "cameras": [
    {
      "id": "8c7e1234-...",
      "name": "Entrance",
      "status": "online",
      "site_id": "..."
    }
  ]
}

The site_id filter is applied automatically based on the API key — you will only see cameras for the site the key is bound to.

3. List Cameras (JavaScript / fetch)

const API_BASE = "https://staging-api.cortexvigil.com/api/v1";
const API_KEY = process.env.CORTEXVIGIL_API_KEY; // cvk_test_...

async function listCameras() {
  const res = await fetch(`${API_BASE}/cameras`, {
    headers: {
      "X-API-Key": API_KEY,
      "Accept": "application/json",
    },
  });
  if (!res.ok) {
    throw new Error(`API error ${res.status}: ${await res.text()}`);
  }
  return res.json();
}

listCameras().then((data) => console.log(data));

4. List Events for a Camera

curl -sS \
  -H "X-API-Key: cvk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  "https://staging-api.cortexvigil.com/api/v1/events?camera_id=8c7e1234-...&limit=50"

Requires the read:events scope.

5. Handle Errors

Always check the HTTP status. See Errors for the full taxonomy. The most common cases:

Next Steps