---
title: "API 퀵스타트"
description: "curl로 해 보는 첫 API v1 호출 — 카메라 목록 보기, 스냅샷 저장, 알림 일괄 확인 처리, 클립 내보내기와 다운로드, 공개 링크로 공유하기."
url: https://vigiora.com/ko/docs/developers/api-quickstart
updated: 2026-11-25T11:49:35.000Z
---

# API 퀵스타트

> curl로 해 보는 첫 API v1 호출 — 카메라 목록 보기, 스냅샷 저장, 알림 일괄 확인 처리, 클립 내보내기와 다운로드, 공개 링크로 공유하기.

이 페이지는 `curl`로 자주 쓰는 작업을 하나씩 따라 해 봅니다. `yourname.vigiora.com`을 내 사이트 주소(로컬 네트워크에서는 `http://<server-ip>:8080`)로, 키를 내 키로 바꾸세요. 응답에서 필드를 골라내는 데 `jq`를 사용합니다.

## 1. 키 받기

이 예제에 필요한 스코프를 가진 키를 만듭니다. 로그인해 세션 토큰을 받은 뒤, 그 토큰으로 키를 만듭니다.

```bash
BASE="https://yourname.vigiora.com"

TOKEN=$(curl -s -X POST "$BASE/api/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"username":"automation","password":"example-password"}' | jq -r .access_token)

curl -s -X POST "$BASE/api/v1/api-keys" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Quickstart","scopes":["cameras:read","alerts:write","recordings:write","clips:share"],"expires_in_days":30}' \
  | jq -r .key
```

마지막 명령이 키를 출력합니다. 예: `vgk_xxxxxxxx_xxxxxxxxxxxxxxxx`. 키는 한 번만 표시됩니다. 다음 단계를 위해 변수에 담아 두세요.

```bash
KEY="vgk_xxxxxxxx_xxxxxxxxxxxxxxxx"
```

확인해 봅니다.

```bash
curl -s "$BASE/api/v1/me" -H "Authorization: Bearer $KEY"
```

각 스코프가 무엇을 허용하는지는 [인증과 스코프](https://vigiora.com/docs/developers/api-authentication)를 참고하세요. 앱의 **Settings** → **People and access** → **API keys**에서 만든 키도 작동하지만, `clips:share`는 없습니다.

## 2. 카메라 목록 보기

```bash
curl -s "$BASE/api/v1/cameras" -H "Authorization: Bearer $KEY" \
  | jq '.data[] | {id, name, status, ai_enabled}'
```

```json
{ "id": 3, "name": "Front door", "status": "online", "ai_enabled": true }
{ "id": 4, "name": "Parking", "status": "offline", "ai_enabled": false }
```

키의 사용자가 볼 수 있는 카메라만 나열됩니다. `?enabled=true`나 `?site_id=2`를 붙여 필터링합니다. 목록은 페이지 단위로 옵니다. [페이지네이션](https://vigiora.com/docs/developers/api-conventions#pagination)을 참고하세요.

## 3. 스냅샷 저장

```bash
curl -s "$BASE/api/v1/cameras/3/snapshot" -H "Authorization: Bearer $KEY" -o front-door.jpg
```

현재 JPEG를 받습니다. 카메라가 지금 당장 스냅샷을 만들 수 없으면 최대 1시간 전의 프레임이 제공될 수 있으며, 그 경과 시간(초)이 `Age` 헤더에 담깁니다. 그것도 없으면 응답은 `503 snapshot_unavailable`입니다.

## 4. 알림 일괄 확인 처리

한 카메라의 확인되지 않은 알림을 나열합니다.

```bash
curl -s "$BASE/api/v1/alerts?camera_id=3&is_alert=true&acknowledged=false" \
  -H "Authorization: Bearer $KEY" | jq '.data[] | {id, label, detected_at}'
```

그중 일부를 id로 확인 처리합니다(한 번에 최대 500개).

```bash
curl -s -X POST "$BASE/api/v1/alerts/actions/acknowledge" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: ack-2026-10-30-1" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1201,1202,1203]}'
```

```json
{ "acknowledged_count": 3, "not_found_ids": [], "forbidden_ids": [] }
```

또는 특정 시점 이전의 모든 알림을, 원하면 한 카메라에 한정해 확인 처리합니다.

```bash
curl -s -X POST "$BASE/api/v1/alerts/actions/acknowledge" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"before":"2026-10-30T12:00:00Z","camera_id":3}'
```

내가 볼 수 없는 id는 `not_found_ids`로, 내게 **operator** 권한이 없는 카메라의 id는 `forbidden_ids`로 돌아옵니다.

## 5. 클립 내보내기와 다운로드

한 카메라의 녹화 중 최대 30분을 하나의 MP4로 요청합니다. 응답은 내보내기 작업 정보와 함께 `202`입니다.

```bash
CLIP=$(curl -s -X POST "$BASE/api/v1/clips" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: clip-front-door-1400" \
  -H "Content-Type: application/json" \
  -d '{"camera_id":3,"from":"2026-10-30T14:00:00Z","to":"2026-10-30T14:05:00Z"}' | jq -r .id)
```

준비될 때까지 기다립니다.

```bash
until [ "$(curl -s "$BASE/api/v1/clips/$CLIP" -H "Authorization: Bearer $KEY" | jq -r .status)" != "running" ]; do
  sleep 2
done
```

`status`는 `ready` 또는 `failed`(이유는 `error`에)로 끝납니다. 그런 다음 다운로드 URL을 받습니다. 이 URL은 자격 증명 없이 60초 동안 한 번만 작동합니다.

```bash
URL=$(curl -s -X POST "$BASE/api/v1/clips/$CLIP/actions/create-download-url" \
  -H "Authorization: Bearer $KEY" | jq -r .url)
curl -s "$BASE$URL" -o clip.mp4
```

준비된 클립은 24시간 동안 보관되며, 공유 링크가 살아 있는 동안에는 더 오래 보관됩니다. `GET /api/v1/clips`로 내 클립을 나열할 수 있습니다.

## 6. 공개 링크로 클립 공유

링크가 있는 사람은 누구나 로그인 없이 클립을 볼 수 있습니다. `clips:share` 스코프가 필요합니다.

```bash
curl -s -X POST "$BASE/api/v1/clips/$CLIP/shares" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"expires_in":"24h"}' | jq '{id, url, expires_at}'
```

```json
{ "id": 42, "url": "https://yourname.vigiora.com/s/xxxxxxxxxxxxxxxx", "expires_at": "2026-10-31T14:06:00Z" }
```

`expires_in`은 `1h`, `24h`(기본값) 또는 `7d`이며, 링크는 클립보다 7일 넘게 오래 살아남지 않습니다. URL은 **여기서만** 반환됩니다. 키로 만든 링크는 그 키가 취소되거나 만료되면 함께 끝납니다. 더 일찍 취소하려면 다음을 실행합니다.

```bash
curl -s -X DELETE "$BASE/api/v1/clips/$CLIP/shares/42" -H "Authorization: Bearer $KEY"
```

## 다음 단계

- [규칙](https://vigiora.com/docs/developers/api-conventions): 오류, `Idempotency-Key`를 사용한 재시도, 요청 한도.
- [API 레퍼런스](https://vigiora.com/docs/developers/api-reference): 모든 작업과 그 매개변수, 응답.
- [공유 링크](https://vigiora.com/docs/using/share-links): 앱에서의 같은 링크.

---

Source: https://vigiora.com/ko/docs/developers/api-quickstart · Last updated 25 Nov 2026, 11:49 UTC
