Coverage Extractor API
Extract insurance coverage data from Turkish kasko policy PDFs.
Submit a base64-encoded PDF and receive structured coverage (teminat) data.
GET
/health
Returns the health status of all connected services (PostgreSQL, Redis, RabbitMQ).
No authentication requiredCurl
curl -s https://your-host/health
Responses
200
503
{
"status": "ok",
"services": {
"postgres": "ok",
"redis": "ok",
"rabbitmq": "ok"
}
}
{
"status": "degraded",
"services": {
"postgres": "ok",
"redis": "error",
"rabbitmq": "ok"
}
}
POST
/quotes
Submit a base64-encoded kasko PDF for coverage extraction. Returns a quote ID for polling. If the same PDF was previously submitted, returns the existing quote. Failed quotes are automatically re-queued.
🔒 X-API-Key requiredRequest Body
| Field | Type | Description | |
|---|---|---|---|
| string | required | Base64-encoded PDF file content |
Curl
curl -X POST https://your-host/quotes \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{"pdf": "JVBERi0xLjQK..."}'
Responses
202
200
401
422
// New PDF submitted, queued for processing { "quote_id": "000692b176a108daf60fd6f55100d26f...", "status": "queued", "result": null }
// Same PDF previously submitted, returns existing { "quote_id": "000692b176a108daf60fd6f55100d26f...", "status": "completed", "result": { ... } }
{
"error": "API key is required",
"message": "Please provide X-API-Key header"
}
{
"detail": [
{
"type": "missing",
"loc": ["body", "pdf"],
"msg": "Field required"
}
]
}
GET
/quotes/{quote_id}
Retrieve the status and result of a submitted quote. Results are cached in Redis for 24 hours.
Poll this endpoint until status is completed or failed.
Path Parameters
| Parameter | Type | Description | |
|---|---|---|---|
| quote_id | string | required | SHA-256 hash returned from POST /quotes |
Curl
curl -s https://your-host/quotes/000692b176a108daf60fd6f55100d26f... \ -H "X-API-Key: your-api-key"
Status Flow
queued → processing → completed ↘ failed
Responses
200
200 ⏳
401
404
// Completed — full result with teminat data { "quote_id": "000692b176a108daf60fd6f55100d26f...", "status": "completed", "result": { "imm_limit": "5000000", "ikame_arac": "15 GÜN C (YILDA 2 KEZ)", "cam_kirilmasi": "DAHİL", "servis_muafiyeti": "%25" } }
// Still processing — poll again in a few seconds { "quote_id": "000692b176a108daf60fd6f55100d26f...", "status": "processing", "result": null }
{
"error": "Invalid API key",
"message": "Authentication failed"
}
{
"detail": "Quote not found"
}