오류 및 요청 제한
오류 형식
모든 API 오류는 다음 구조의 JSON을 반환해요.
{
"error": "Short error description",
"detail": "Extended description (optional)"
}
일부 엔드포인트는 Django REST Framework의 기본 형식에 따라 다음과 같이 응답하기도 해요.
{
"detail": "Error message"
}
대부분의 오류 응답에는 correlation_id도 포함돼요. X-Correlation-ID 응답 헤더와 동일한 ID예요. 지원팀에 문의할 때 이 ID를 함께 알려 주세요. 아래 예시에서는 생략했어요.
HTTP 상태 코드
| 상태 | 의미 | 발생 상황 |
|---|---|---|
| 200 | 성공 | 요청 성공 |
| 400 | 잘못된 요청 | 매개변수가 누락되었거나 유효하지 않음 |
| 401 | 인증되지 않음 | 인증 토큰이 누락되었거나, 유효하지 않거나, 폐기 또는 만료됨 |
| 403 | 접근 금지 | 토큰에 필요한 권한 범위 또는 워크스페이스 접근 권한이 없거나, 요금제에 API가 포함되지 않음(api_plan_required) |
| 404 | 찾을 수 없음 | 리소스가 존재하지 않거나 워크스페이스에 동기화된 데이터가 없음 |
| 405 | 허용되지 않는 메서드 | 엔드포인트에 맞지 않는 HTTP 메서드 사용 |
| 422 | 처리할 수 없는 엔터티 | 요청 본문 유효성 검사 실패 |
| 429 | 너무 많은 요청 | 요청 제한 초과 |
| 500 | 내부 서버 오류 | 예기치 않은 서버 오류 발생 |
| 503 | 서비스 이용 불가 | Elasticsearch 또는 기타 의존 서비스 중단 |
요청 제한
V1 API (서비스 토큰)
| 구분 | 제한 | 적용 범위 |
|---|---|---|
| 단기 집중 요청 | 10초당 20회 요청 | 토큰별 |
| 시간 구간 | 15분당 600회 요청 | 토큰별 |
사용자 API (JWT)
| 구분 | 제한 | 적용 범위 |
|---|---|---|
| 인증된 사용자 | 분당 100회 요청 | 사용자별 |
| 익명 사용자 | 분당 20회 요청 | IP별 |
요청 제한 헤더
요청 제한이 적용되면 응답에 다음 항목이 포함돼요.
HTTP/1.1 429 Too Many Requests
Retry-After: 30
요청 제한 처리: Retry-After에 지정된 시간(초)만큼 기다린 후 다시 시도하세요. 429 응답이 반복되면 지수 백오프를 적용하세요.
일반적인 오류 상황
인증 오류
// Missing Authorization header
{"detail": "Authentication credentials were not provided."}
// Invalid or expired JWT
{"detail": "Given token not valid for any token type", "code": "token_not_valid"}
// Service token not found (wrong or mistyped key)
{"detail": "Invalid service token."}
// Revoked service token
{"detail": "Service token is revoked."}
// Expired service token
{"detail": "Service token has expired."}
이 경우에는 모두 401을 반환해요. 다만, API가 포함되지 않은 요금제에서 유효한 서비스 토큰을 사용하면 api_plan_required 코드와 함께 403을 반환해요. 아래 내용을 참고하세요.
권한 오류
// Token missing the endpoint's scope
{"detail": "Token does not have the required scope."}
// workspace_id missing or not in the token's allowed list
{"detail": "Token does not have access to this workspace."}
// Plan doesn't include the API (Free, Plus)
{
"error": "API for AI agents is part of the Pro and Max plans. This account does not have an active Pro or Max plan. Upgrade at https://ivgraph.com/billing/ and your API keys will work right away.",
"code": "api_plan_required",
"upgrade_url": "https://ivgraph.com/billing/"
}
API는 Pro 및 Max 요금제에 포함되며, US$1.99 Pro 주간 이용권에도 포함돼요. Free와 Plus에서는 서비스 토큰을 사용하는 모든 요청과 토큰 생성 요청에 이 403을 반환해요. 토큰은 삭제되지 않고 일시 중지돼요. 계정이 Pro 또는 Max 요금제로 전환되는 즉시 다시 사용할 수 있어요.
유효성 검사 오류
// Missing required parameter
{"error": "Query parameter \"q\" is required."}
// Invalid UUID format
{"error": "Invalid node_id format."}
// Query too long (V1 API)
{"error": "Query too long (max 256 characters)."}
// Disallowed characters in query
{"error": "Query contains disallowed characters."}
리소스 오류
// Workspace not synced
{"error": "No synced data found for this workspace."}
// Node not found
{"error": "Node not found."}
// Elasticsearch unavailable
{"error": "Search service unavailable"}