공개 API 시작하기

아워데 주최자 기능을 API로 사용하는 방법을 안내해요. 이벤트 생성, 사진·영상 업로드, 상태 조회, 공유링크, 플랜 확인이 가능해요.

1. API 키 발급

로그인 후 개발자 페이지에서 키를 발급하세요. 발급 시 원문은 1회만 표시돼요: /dashboard/developer

2. 첫 이벤트 만들기

발급한 키로 이벤트를 생성해요. 응답의 shareLink를 참여자에게 전달하면 돼요:

curl -X POST https://iwasthere.pics/api/public/v1/events \
  -H "Authorization: Bearer iwt_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"My Event"}'

응답 예시:

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "shareLink": "https://iwasthere.pics/e/abc123",
  "quota": { "events": { "used": 1, "limit": 3 } }
}

3. 사진 업로드

photos/presign으로 업로드 URL을 받고 S3에 올린 뒤 photos/complete를 호출하면 인덱싱이 시작돼요. 진행 상태는 photos 목록의 indexingStatus로 확인해요.

전체 워크플로우 (복사해서 실행)

이벤트 생성부터 사진 업로드·인덱싱 확인까지 한 번에 실행하는 예시예요. jq가 필요해요.

KEY="iwt_YOUR_KEY"; BASE="https://iwasthere.pics/api/public/v1"

# 1) 이벤트 생성 → id, shareLink 획득
EV=$(curl -s -X POST "$BASE/events" -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"name":"My Event"}')
EVENT_ID=$(echo "$EV" | jq -r .id)

# 2) 사진별 업로드 URL 발급
PRE=$(curl -s -X POST "$BASE/events/$EVENT_ID/photos/presign" -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"files":[{"name":"IMG_0001.jpg","size":3145728,"type":"image/jpeg"}]}')
URL=$(echo "$PRE" | jq -r '.uploads[0].url')
PHOTO_ID=$(echo "$PRE" | jq -r '.uploads[0].photoId')
S3KEY=$(echo "$PRE" | jq -r '.uploads[0].s3Key')

# 3) 원본을 S3에 직접 PUT (인증 헤더 불필요, Content-Type 일치)
curl -s -X PUT "$URL" -H "Content-Type: image/jpeg" --data-binary @IMG_0001.jpg

# 4) 완료 처리 → 썸네일·얼굴 인덱싱 트리거
curl -s -X POST "$BASE/events/$EVENT_ID/photos/complete" -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d "{\"uploaded\":[{\"photoId\":\"$PHOTO_ID\",\"s3Key\":\"$S3KEY\",\"fileSize\":3145728}]}"

# 5) indexingStatus 가 모두 done 이 될 때까지 폴링
curl -s "$BASE/events/$EVENT_ID/photos" -H "Authorization: Bearer $KEY" | jq '.photos[].indexingStatus'

# 6) shareLink 를 참여자에게 전달

플랜 한도 처리

한도를 초과하면 403 응답에 upgrade 필드(message, url)가 포함돼요. 이 안내를 사용자에게 그대로 전달하세요.

{
  "error": "PHOTO_LIMIT_EXCEEDED", "current": 50, "limit": 50,
  "upgrade": {
    "message": "The free plan allows up to 50 photos per event. Pro allows up to 500.",
    "url": "https://iwasthere.pics/dashboard/plan"
  }
}

얼굴검색은 제공하지 않아요

참여자 얼굴검색은 공개 API로 제공되지 않아요(영구 비공개). 라이브니스 미검증 상태에서 타인 얼굴 사진으로 무단 검색하는 악용을 막기 위해서예요.