{"components":{"headers":{"ETag":{"description":"Otisk odpovědi pro If-None-Match","schema":{"type":"string"}},"RateLimitLimit":{"description":"Limit požadavků na endpoint a okno pro tento API klíč","schema":{"type":"integer"}},"RateLimitRemaining":{"description":"Zbývající požadavky v aktuálním okně","schema":{"type":"integer"}},"RateLimitReset":{"description":"Unix timestamp, kdy okno skončí a počítadlo se vynuluje","schema":{"type":"integer"}}},"responses":{"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Neplatný, deaktivovaný nebo vypršelý API klíč"},"NotModified":{"description":"Data se nezměnila (If-None-Match odpovídá ETag), odpověď bez těla","headers":{"ETag":{"$ref":"#/components/headers/ETag"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"TooManyRequests":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Překročený limit za minutu, nebo vyčerpaná měsíční kvóta zkušebního tarifu","headers":{"Retry-After":{"description":"Za kolik sekund se limit obnoví","schema":{"type":"integer"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"Unauthorized":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Chybí hlavička X-Api-Key"},"Unprocessable":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Nevalidní parametr"}},"schemas":{"AddressPointOut":{"properties":{"distance_m":{"description":"Vzdálenost od zadaného bodu v metrech - jen v odpovědi /reverse","type":"number"},"district":{"type":["string","null"]},"full_address":{"type":["string","null"]},"house_number":{"type":["integer","null"]},"is_registration_number":{"description":"true = číslo evidenční (č.ev.), false = číslo popisné (č.p.)","type":["boolean","null"]},"lat":{"type":["number","null"]},"lon":{"type":["number","null"]},"municipality":{"type":"string"},"orientation_num":{"type":["string","null"]},"region":{"type":["string","null"]},"ruian_id":{"format":"int64","type":"integer"},"similarity":{"description":"Trigramová podobnost s dotazem; u /address/{ruian_id} vždy null","type":["number","null"]},"street":{"type":["string","null"]},"zip_code":{"pattern":"^\\d{5}$","type":"string"}},"required":["ruian_id","full_address","street","house_number","orientation_num","zip_code","municipality","district","region","is_registration_number","lat","lon","similarity"],"type":"object"},"AutocompleteResponse":{"properties":{"count":{"description":"Počet výsledků v této odpovědi","type":"integer"},"has_more":{"description":"Existuje další stránka - zavolejte znovu s offset + limit","type":"boolean"},"offset":{"description":"Kolik výsledků bylo přeskočeno","type":"integer"},"query":{"type":"string"},"results":{"items":{"$ref":"#/components/schemas/AddressPointOut"},"type":"array"}},"required":["query","count","offset","has_more","results"],"type":"object"},"Detail":{"properties":{"detail":{"type":"string"}},"required":["detail"],"type":"object"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"}},"type":"object"},"HealthResponse":{"properties":{"address_count":{"type":["integer","null"]},"db":{"enum":["ok","unavailable"],"type":"string"},"last_import":{"description":"Poslední úspěšný import z RUIAN; null = zatím žádný","oneOf":[{"$ref":"#/components/schemas/ImportInfo"},{"type":"null"}]},"status":{"enum":["ok","degraded"],"type":"string"}},"required":["status","db","address_count","last_import"],"type":"object"},"ImportHealthResponse":{"properties":{"last_run_error":{"description":"Chyba posledního běhu","pokud selhal":null,"type":"string"},"last_run_status":{"description":"Stav posledního běhu: success, failed nebo running","type":"string"},"last_success":{"oneOf":[{"$ref":"#/components/schemas/ImportInfo"},{"type":"null"}]},"max_age_hours":{"type":"number"},"status":{"enum":["ok","stale","never"],"type":"string"}},"required":["status","max_age_hours","last_success","last_run_status"],"type":"object"},"ImportInfo":{"properties":{"age_hours":{"description":"Stáří dat v hodinách","type":"number"},"finished_at":{"format":"date-time","type":"string"},"rows_loaded":{"type":"integer"}},"required":["finished_at","age_hours","rows_loaded"],"type":"object"},"MunicipalitiesResponse":{"properties":{"municipalities":{"items":{"type":"string"},"type":"array"}},"required":["municipalities"],"type":"object"},"ReverseResponse":{"properties":{"count":{"type":"integer"},"lat":{"type":"number"},"lon":{"type":"number"},"radius":{"description":"Okruh hledání v metrech","type":"number"},"results":{"description":"Adresy seřazené od nejbližší, s distance_m","items":{"$ref":"#/components/schemas/AddressPointOut"},"type":"array"}},"required":["lat","lon","radius","count","results"],"type":"object"},"UsageItem":{"properties":{"day":{"description":"Den v UTC","format":"date","type":"string"},"endpoint":{"enum":["autocomplete","address","municipalities","reverse","validate","usage"],"type":"string"},"rate_limited":{"description":"Z toho odmítnuté rate limitem (429)","type":"integer"},"requests":{"description":"Všechny ověřené požadavky včetně odmítnutých","type":"integer"}},"required":["day","endpoint","requests","rate_limited"],"type":"object"},"UsageResponse":{"properties":{"from":{"format":"date","type":"string"},"items":{"items":{"$ref":"#/components/schemas/UsageItem"},"type":"array"},"plan":{"description":"Tarif klíče; null = klíč bez tarifu (bez kvóty)","oneOf":[{"properties":{"expires_at":{"description":"Konec platnosti klíče (zkušební tarif)","format":"date-time","type":["string","null"]},"month_used":{"description":"Započtené požadavky v aktuálním měsíci (UTC)","přibližně":null,"type":"integer"},"monthly_quota":{"description":"null = bez kvóty","type":["integer","null"]},"name":{"type":"string"},"quota_mode":{"description":"block = po vyčerpání 429, bill = pustit a doúčtovat","enum":["block","bill"],"type":"string"}},"required":["name","monthly_quota","quota_mode","month_used","expires_at"],"type":"object"},{"type":"null"}]},"to":{"format":"date","type":"string"},"total_rate_limited":{"type":"integer"},"total_requests":{"type":"integer"}},"required":["from","to","total_requests","total_rate_limited","plan","items"],"type":"object"},"ValidateItem":{"properties":{"alternatives":{"description":"Další kandidáti (nejvýš 3), typicky u ambiguous","items":{"$ref":"#/components/schemas/AddressPointOut"},"type":"array"},"confidence":{"description":"Podíl částí vstupu","které v nalezené adrese mají protějšek (0-1)":null,"type":"number"},"id":{"description":"Hodnota id ze vstupu (jen pokud byla zadaná)"},"input":{"type":"string"},"match":{"oneOf":[{"$ref":"#/components/schemas/AddressPointOut"},{"type":"null"}]},"status":{"description":"exact = jednoznačná shoda včetně čísla domu; ambiguous = víc adres sedí stejně\ndobře (chybí obec nebo číslo); probable = nejlepší shoda, ale něco nesedí nebo\nchybí číslo domu; not_found = nic dostatečně podobného.\n","enum":["exact","ambiguous","probable","not_found"],"type":"string"},"unmatched":{"description":"Části vstupu (normalizované), které v nalezené adrese nemají protějšek","items":{"type":"string"},"type":"array"}},"required":["input","status","confidence","match","alternatives","unmatched"],"type":"object"},"ValidateRequest":{"example":{"items":[{"address":"Mánesova 742/2, 120 00 Praha 2","id":"objednavka-1"},{"address":"Kounicva 966 Brno","id":2}]},"properties":{"items":{"items":{"properties":{"address":{"description":"Adresa volným textem","maxLength":300,"minLength":1,"type":"string"},"id":{"description":"Libovolná vaše hodnota (řetězec nebo číslo), vrátí se beze změny"}},"required":["address"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"}},"required":["items"],"type":"object"},"ValidateResponse":{"properties":{"count":{"type":"integer"},"items":{"description":"Ve stejném pořadí jako ve vstupu","items":{"$ref":"#/components/schemas/ValidateItem"},"type":"array"}},"required":["count","items"],"type":"object"},"ValidationError":{"properties":{"ctx":{"type":"object"},"input":{},"loc":{"items":{"type":"string"},"type":"array"},"msg":{"type":"string"},"type":{"type":"string"}},"required":["type","loc","msg","input"],"type":"object"}},"securitySchemes":{"APIKeyHeader":{"in":"header","name":"X-Api-Key","type":"apiKey"}}},"info":{"description":"Našeptávání českých adres z dat RUIAN (ČÚZK).\n\nEndpointy pod `/api/v1/` vyžadují hlavičku `X-Api-Key`. Rate limit se počítá\npro API klíč a endpoint; stav je v hlavičkách `X-RateLimit-Limit`,\n`X-RateLimit-Remaining` a `X-RateLimit-Reset` (unix timestamp konce okna).\n\nKlíč v tarifu s měsíční kvótou dostává i `X-Quota-Limit` a `X-Quota-Remaining`.\nZkušební tarif po vyčerpání kvóty odpovídá 429, placené tarify pouští dál\na překročení se doúčtuje. Klíč s vypršelou platností dostane 403.\n\nÚspěšné odpovědi mají hlavičku `ETag`. Pošlete ji zpět v `If-None-Match`\na když se data nezměnila, API vrátí `304 Not Modified` bez těla.\n","title":"Adresy RUIAN API","version":"0.2.0"},"openapi":"3.1.0","paths":{"/api/v1/address/{ruian_id}":{"get":{"operationId":"get_address","parameters":[{"in":"path","name":"ruian_id","required":true,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressPointOut"}}},"description":"Adresní místo","headers":{"ETag":{"$ref":"#/components/headers/ETag"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"304":{"$ref":"#/components/responses/NotModified"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Adresa nenalezena"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Get Address","tags":["autocomplete"]}},"/api/v1/autocomplete":{"get":{"operationId":"autocomplete","parameters":[{"description":"Hledaný text (min. 2 znaky)","in":"query","name":"q","required":true,"schema":{"maxLength":200,"minLength":2,"type":"string"}},{"description":"Maximální počet výsledků","in":"query","name":"limit","schema":{"default":10,"maximum":50,"minimum":1,"type":"integer"}},{"description":"Kolik výsledků přeskočit (stránkování, viz has_more)","in":"query","name":"offset","schema":{"default":0,"maximum":200,"minimum":0,"type":"integer"}},{"description":"Filtr na obec (přesný název, bez ohledu na diakritiku). Pražské adresy mají\nobec \"Praha 1\" až \"Praha 10\"; \"Praha\" bez čísla zahrne všechny obvody.\n","in":"query","name":"municipality","schema":{"type":"string"}},{"description":"Filtr na kraj (název bez ohledu na diakritiku, např. \"Jihomoravský kraj\")","in":"query","name":"region","schema":{"maxLength":100,"type":"string"}},{"description":"Filtr na PSČ","in":"query","name":"zip","schema":{"pattern":"^\\d{5}$","type":"string"}},{"description":"Práh similarity pro záložní trigramové hledání (0.0–1.0)","in":"query","name":"threshold","schema":{"default":0.3,"maximum":1,"minimum":0,"type":"number"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutocompleteResponse"}}},"description":"Výsledky hledání","headers":{"ETag":{"$ref":"#/components/headers/ETag"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"304":{"$ref":"#/components/responses/NotModified"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Autocomplete","tags":["autocomplete"]}},"/api/v1/municipalities":{"get":{"operationId":"municipalities","parameters":[{"description":"Prefix názvu obce","in":"query","name":"q","schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"limit","schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MunicipalitiesResponse"}}},"description":"Seznam obcí","headers":{"ETag":{"$ref":"#/components/headers/ETag"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"304":{"$ref":"#/components/responses/NotModified"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Municipalities","tags":["autocomplete"]}},"/api/v1/reverse":{"get":{"description":"Nejbližší adresy k bodu (WGS84), seřazené podle vzdálenosti.","operationId":"reverse","parameters":[{"description":"Zeměpisná šířka (ČR, 48.5-51.1)","in":"query","name":"lat","required":true,"schema":{"maximum":51.1,"minimum":48.5,"type":"number"}},{"description":"Zeměpisná délka (ČR, 12.0-18.9)","in":"query","name":"lon","required":true,"schema":{"maximum":18.9,"minimum":12,"type":"number"}},{"description":"Okruh v metrech","in":"query","name":"radius","schema":{"default":100,"maximum":1000,"minimum":1,"type":"number"}},{"in":"query","name":"limit","schema":{"default":5,"maximum":20,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseResponse"}}},"description":"Nejbližší adresy (prázdné pole, když v okruhu žádná není)","headers":{"ETag":{"$ref":"#/components/headers/ETag"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"304":{"$ref":"#/components/responses/NotModified"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Reverse","tags":["autocomplete"]}},"/api/v1/usage":{"get":{"description":"Využití API pro váš klíč po dnech (UTC) a endpointech. Bez parametrů\nposledních 30 dní, nejvýš 366 dní. Dnešní čísla se doplňují průběžně.\n","operationId":"usage","parameters":[{"description":"První den (YYYY-MM-DD), výchozí to - 29 dní","in":"query","name":"from","schema":{"format":"date","type":"string"}},{"description":"Poslední den (YYYY-MM-DD), výchozí dnešek","in":"query","name":"to","schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}},"description":"Statistika využití","headers":{"ETag":{"$ref":"#/components/headers/ETag"}}},"304":{"$ref":"#/components/responses/NotModified"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Usage","tags":["autocomplete"]}},"/api/v1/validate":{"post":{"description":"Ověří jednu nebo víc adres (nejvýš 100) zadaných volným textem a ke každé vrátí\nnejlepší adresní místo v RUIAN s mírou jistoty. Každá adresa se do limitu\npožadavků i statistik počítá jako jeden požadavek.\n","operationId":"validate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateResponse"}}},"description":"Výsledky ve stejném pořadí jako vstup"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Tělo požadavku je větší než 256 kB"},"415":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Detail"}}},"description":"Content-Type není application/json"},"422":{"$ref":"#/components/responses/Unprocessable"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"security":[{"APIKeyHeader":[]}],"summary":"Validate","tags":["autocomplete"]}},"/health":{"get":{"description":"Stav služby. Vrací 503, pokud je databáze nedostupná. Stáří dat\n(`last_import`) je jen informace - pro alerting slouží /health/import.\n","operationId":"health","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}},"description":"Služba i databáze běží"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}},"description":"Databáze není dostupná"}},"summary":"Health","tags":["health"]}},"/health/import":{"get":{"description":"Pro monitoring aktuálnosti dat. Vrací 503, když poslední úspěšný import\nz RUIAN je starší než IMPORT_MAX_AGE (výchozí 8 dní) nebo žádný není.\n","operationId":"health_import","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportHealthResponse"}}},"description":"Data jsou aktuální"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportHealthResponse"}}},"description":"Data jsou zastaralá nebo nebyla naimportována"}},"summary":"Health Import","tags":["health"]}}},"tags":[{"name":"autocomplete"},{"name":"health"}]}