PlateOCR API 문서

AI 기반 한국 차량 번호판 인식 REST API

목차

Base URL: https://plateocr.co.kr

인터랙티브 API 레퍼런스

브라우저에서 API 키를 넣고 바로 호출(Try it out)해볼 수 있습니다. OpenAPI 스펙도 내려받을 수 있습니다.

API 레퍼런스 열기 openapi.json

1. 인증

모든 API 요청에는 Authorization 헤더에 API 키를 Bearer 형식으로 포함합니다.

API 키 발급

웹사이트에 로그인한 뒤 마이페이지 → API 키에서 새 키 발급을 누르면 pk_live_… 형식의 키가 발급됩니다.

키는 발급 시 한 번만 표시되므로 안전한 곳에 보관하세요. (서버에는 해시만 저장되어 다시 확인할 수 없습니다.) 분실 시 기존 키를 삭제하고 새로 발급하면 됩니다. 키는 계정당 최대 10개까지 발급할 수 있습니다.

사용 방법

발급받은 키를 모든 API 요청의 Authorization 헤더에 포함합니다.

Authorization: Bearer pk_live_xxxxxxxxxxxxxxxxxxxxxxxx

보안 권장

키는 서버 환경변수 등 안전한 곳에 두고, 프런트엔드 코드·공개 저장소에 노출하지 마세요. 유출이 의심되면 마이페이지에서 즉시 삭제(폐기)할 수 있습니다.

2. 번호판 인식

POST /api/recognize

차량 이미지를 업로드하면 번호판을 자동 검출하고 텍스트를 인식합니다.

Request

파라미터타입필수설명
imageFile필수차량 이미지 (JPG, PNG, BMP, 최대 10MB)

curl 예시

curl -X POST https://plateocr.co.kr/api/recognize \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "image=@car_photo.jpg"

Python (requests)

import requests API_KEY = "pk_live_xxxxxxxxxxxxxxxxxxxxxxxx" with open("car_photo.jpg", "rb") as f: res = requests.post( "https://plateocr.co.kr/api/recognize", headers={"Authorization": f"Bearer {API_KEY}"}, files={"image": f}, timeout=30, ) data = res.json() for p in data.get("plates", []): print(p["text"], p["confidence"], p["bbox"])

JavaScript (Node.js)

import fs from "fs"; const API_KEY = "pk_live_xxxxxxxxxxxxxxxxxxxxxxxx"; const form = new FormData(); form.append("image", new Blob([fs.readFileSync("car_photo.jpg")]), "car_photo.jpg"); const res = await fetch("https://plateocr.co.kr/api/recognize", { method: "POST", headers: { Authorization: `Bearer ${API_KEY}` }, body: form, }); const data = await res.json(); console.log(data.plates);

Response (성공)

{ "success": true, "count": 1, "plates": [ { "text": "12가3456", "confidence": 0.9812, "method": "original", "bbox": [245, 380, 520, 440], "det_confidence": 0.9234, "format_valid": true } ], "quota_remaining": 9987 }

응답 필드

필드타입설명
successboolean요청 성공 여부
countinteger검출된 번호판 수
plates[].textstring인식된 번호판 텍스트
plates[].confidencefloatOCR 신뢰도 (0~1)
plates[].methodstring인식 방법 (original/blend/otsu). 형식 보정으로 고른 후보는 끝에 +format (예: otsu+format)
plates[].bboxarray번호판 위치 [x1, y1, x2, y2]
plates[].det_confidencefloat검출 신뢰도 (0~1)
plates[].format_validboolean한국 번호판 형식(12가3456 · 123가4567 · 서울12가3456 등) 일치 여부. false 면 글자를 빠뜨렸거나 특수 번호판일 수 있으니 사람 확인을 권장합니다.
quota_remaininginteger잔여 이용 건수

3. 번호판 OCR (크롭 이미지)

POST /api/recognize_plate

이미 크롭된 번호판 이미지에서 텍스트만 인식합니다. (YOLO 검출 단계 생략)

curl 예시

curl -X POST https://plateocr.co.kr/api/recognize_plate \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "image=@plate_cropped.jpg"

Response

{ "success": true, "text": "12가3456", "confidence": 0.9923, "method": "original", "quota_remaining": 9986 }

4. 사용량 조회

GET /api/usage

curl 예시

curl https://plateocr.co.kr/api/usage \ -H "Authorization: Bearer YOUR_API_KEY"

Response

{ "success": true, "subscriptions": [ { "id": 1, "plan_name": "스탠다드", "quota_remaining": 99850, "started_at": "2026-03-29T10:00:00Z", "expires_at": "2026-04-28T10:00:00Z", "status": "active" } ], "stats": { "total_calls": 150, "success_calls": 142 } }

5. 서버 상태

GET /api/health

인증 불필요. 서버 및 AI 엔진 상태를 확인합니다.

Response

{ "web_server": "ok", "ai_engine": "ok", "database": "ok" }

6. 고급 기능

이미지 URL 입력

파일 업로드 대신 image_url로 원격 이미지를 인식할 수 있습니다. (/api/recognize, /api/recognize_plate)

curl -X POST https://plateocr.co.kr/api/recognize \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"image_url":"https://example.com/car.jpg"}'

사설/내부 IP 주소는 차단되며, 리다이렉트는 허용되지 않습니다.

크롭된 번호판 이미지 받기

쿼리 ?crop=1을 추가하면 각 번호판 영역을 잘라낸 이미지가 plates[].crop에 base64 data URL로 포함됩니다.

curl -X POST "https://plateocr.co.kr/api/recognize?crop=1" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "image=@car_photo.jpg"

배치 인식 (여러 장)

POST /api/recognize/batch — 최대 10장. 파일 images(복수) 또는 JSON image_urls 배열. 이미지 1장당 1건 차감됩니다.

curl -X POST https://plateocr.co.kr/api/recognize/batch \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "[email protected]" -F "[email protected]" { "success": true, "count": 2, "results": [ { "index": 0, "filename": "car1.jpg", "success": true, "count": 1, "plates": [ ... ] }, { "index": 1, "filename": "car2.jpg", "success": true, "count": 1, "plates": [ ... ] } ], "quota_remaining": 499998 }

웹훅 (실시간 이벤트 콜백)

마이페이지 → 웹훅에서 URL을 등록하면, 아래 이벤트가 발생할 때마다 해당 URL로 POST 전송합니다. 본문은 { "event": "...", "data": {...} } 형태이며, 헤더 X-PlateOCR-Event로도 이벤트 종류를 받을 수 있습니다.

이벤트발생 시점data 주요 필드
recognize이미지 인식 완료plates, count …
recognize.batch배치 인식 완료results[]
quota잔여 인식 80% 사용·소진remaining, total, used_pct, exhausted

주차·출입 운영 이벤트(입·출차·보안·정산)는 PlateOCR Park에서 다룹니다. 출입 API는 park API 안내, 웹훅 이벤트는 park 웹훅 안내를 보세요.

전송 실패 시 0초·5초·30초 간격으로 최대 3회 재시도하며, 4xx 영구오류(408·429 제외)는 즉시 중단합니다. 전송 이력은 마이페이지에서 확인할 수 있습니다.

요청 헤더 X-PlateOCR-Signature는 본문(raw body)을 등록 시 발급된 secret으로 HMAC-SHA256 서명한 값입니다. 아래처럼 검증하세요.

# Python (Flask 예시) import hmac, hashlib def verify(raw_body: bytes, signature: str, secret: str) -> bool: mac = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(mac, signature)

7. 오류 코드

HTTP 코드의미설명
400Bad Request이미지 미첨부 또는 잘못된 형식
401Unauthorized인증 토큰 없음 또는 만료
403Forbidden이용 건수 소진 또는 만료 (추가 이용은 상담 문의)
500Server Error서버 내부 오류
503Service UnavailableAI 엔진 미실행

오류 응답 형식

{ "success": false, "error": "사용 가능한 인식 건수가 없습니다. 추가 이용은 문의하기(/contact.html?type=pricing)로 상담을 요청해 주세요.", "quota_remaining": 0 }