{
  "openapi": "3.1.0",
  "info": {
    "title": "regup API pilot",
    "version": "1.0.0-pilot",
    "description": "Bez platieb. Operátorom overené účty,100000integerunits/mesiac Europe/Bratislava spoločne pre projekty/kľúče.1kredit=10units. Klientské doručenie po serverovom debite a automatické refundácie proxy5xx nie sú garantované. Recovery môže ponechať najviac100units/účet/obdobie ako konzervatívny hold; nejde o potvrdenú spotrebu."
  },
  "servers": [
    {
      "url": "https://api.regup.eu"
    }
  ],
  "paths": {
    "/v1/autocomplete/addresses": {
      "get": {
        "summary": "Návrhy adries",
        "description": "Lokálne dáta. Cena1unit=0,1kreditu aj pri platnom prázdnom výsledku. Neznáme parametre a telo GET sa odmietajú.",
        "operationId": "suggestAddresses",
        "security": [
          {
            "ServerKey": []
          },
          {
            "BrowserSession": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 120
            },
            "description": "UTF-8, najviac480bajtov; musí obsahovať písmeno alebo číslo."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cz"
              ],
              "default": "sk"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cs",
                "en"
              ]
            },
            "description": "Predvolené sk pre Slovensko, cs pre Česko; oficiálny názov a adresa sa neprekladajú."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 10
            }
          },
          {
            "name": "latitude",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            },
            "description": "Voliteľná poloha, latitude/longitude musia byť uvedené spolu. Bez nich sa môže použiť lokálny približný GeoIP údaj."
          },
          {
            "name": "longitude",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            },
            "description": "Voliteľná poloha, latitude/longitude musia byť uvedené spolu. Bez nich sa môže použiť lokálny približný GeoIP údaj."
          }
        ],
        "responses": {
          "200": {
            "description": "Úspešná odpoveď.",
            "headers": {
              "X-Request-Id": {
                "description": "ID požiadavky.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Charged-Units": {
                "description": "Cena úspešnej odpovede v celých units; autocomplete1, bootstrap/usage0.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Available-Units": {
                "description": "Pripravená kapacita aktuálneho grantu, nie celý nealokovaný mesačný prídel.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Period": {
                "description": "Kalendárny mesiac Europe/Bratislava.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Reset-At": {
                "description": "Koniec obdobia v UTC.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "$ref": "#/components/schemas/Address"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Neplatné parametre; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Neplatný alebo chýbajúci bearer; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Nepodporovaná metóda, HEAD sa odmieta; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Telo nad16KiB; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rýchlostný alebo mesačný limit; bez kreditu, Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Nedostupný index alebo zatvorené/nedôveryhodné účtovanie; bez deklarovaného úspechu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "CORS preflight bez kreditu",
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Access-Control-Request-Method",
            "in": "header",
            "required": true,
            "schema": {
              "const": "GET"
            }
          },
          {
            "name": "Access-Control-Request-Headers",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Iba Authorization, Content-Type, Accept."
          }
        ],
        "responses": {
          "204": {
            "description": "Presný povolený Origin a očakávaná metóda."
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/autocomplete/companies": {
      "get": {
        "summary": "Návrhy organizácií",
        "description": "Lokálne dáta. Cena1unit=0,1kreditu aj pri platnom prázdnom výsledku. Neznáme parametre a telo GET sa odmietajú.",
        "operationId": "suggestCompanies",
        "security": [
          {
            "ServerKey": []
          },
          {
            "BrowserSession": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 120
            },
            "description": "UTF-8, najviac480bajtov; musí obsahovať písmeno alebo číslo."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cz"
              ],
              "default": "sk"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cs",
                "en"
              ]
            },
            "description": "Predvolené sk pre Slovensko, cs pre Česko; oficiálny názov a adresa sa neprekladajú."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Úspešná odpoveď.",
            "headers": {
              "X-Request-Id": {
                "description": "ID požiadavky.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Charged-Units": {
                "description": "Cena úspešnej odpovede v celých units; autocomplete1, bootstrap/usage0.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Available-Units": {
                "description": "Pripravená kapacita aktuálneho grantu, nie celý nealokovaný mesačný prídel.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Period": {
                "description": "Kalendárny mesiac Europe/Bratislava.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Reset-At": {
                "description": "Koniec obdobia v UTC.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "maxItems": 10,
                      "items": {
                        "$ref": "#/components/schemas/Company"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Neplatné parametre; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Neplatný alebo chýbajúci bearer; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Nepodporovaná metóda, HEAD sa odmieta; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Telo nad16KiB; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rýchlostný alebo mesačný limit; bez kreditu, Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Nedostupný index alebo zatvorené/nedôveryhodné účtovanie; bez deklarovaného úspechu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "CORS preflight bez kreditu",
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Access-Control-Request-Method",
            "in": "header",
            "required": true,
            "schema": {
              "const": "GET"
            }
          },
          {
            "name": "Access-Control-Request-Headers",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Iba Authorization, Content-Type, Accept."
          }
        ],
        "responses": {
          "204": {
            "description": "Presný povolený Origin a očakávaná metóda."
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/browser-sessions": {
      "post": {
        "summary": "Obmedzená browser relácia pre verejný client ID",
        "description": "Default relácia má iba povolené suggestions. companies:read vyžaduje explicitný scopes zoznam a projektové oprávnenie; relácia ostáva IP/Origin-bound15min. 0units.",
        "operationId": "createBrowserSession",
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "pattern": "^rgp_[a-f0-9]{32}$"
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "addresses:suggest",
                        "companies:suggest",
                        "companies:read"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 3,
                    "uniqueItems": true,
                    "description": "Voliteľný explicitný podzoznam povolených browser scopes projektu. Bez neho detail nie je povolený."
                  }
                },
                "required": [
                  "client_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Úspešná odpoveď.",
            "headers": {
              "X-Request-Id": {
                "description": "ID požiadavky.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Charged-Units": {
                "description": "Cena úspešnej odpovede v celých units; autocomplete1, bootstrap/usage0.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Available-Units": {
                "description": "Pripravená kapacita aktuálneho grantu, nie celý nealokovaný mesačný prídel.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Period": {
                "description": "Kalendárny mesiac Europe/Bratislava.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Reset-At": {
                "description": "Koniec obdobia v UTC.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BrowserSession"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Neplatné parametre; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Neplatný alebo chýbajúci bearer; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Nepodporovaná metóda, HEAD sa odmieta; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Telo nad16KiB; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rýchlostný alebo mesačný limit; bez kreditu, Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Nedostupný index alebo zatvorené/nedôveryhodné účtovanie; bez deklarovaného úspechu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "CORS preflight bez kreditu",
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Access-Control-Request-Method",
            "in": "header",
            "required": true,
            "schema": {
              "const": "POST"
            }
          },
          {
            "name": "Access-Control-Request-Headers",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Iba Authorization, Content-Type, Accept."
          }
        ],
        "responses": {
          "204": {
            "description": "Presný povolený Origin a očakávaná metóda."
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/me/usage": {
      "get": {
        "summary": "Použitie spoločného účtu v aktuálnom mesiaci",
        "description": "Scope usage:read; serverový bearer. Bez kreditu, bez parametrov a bez tela. Odlišuje potvrdenú spotrebu a nevysporiadané práva; údaje sa počas súbehu priebežne menia.",
        "operationId": "getUsage",
        "security": [
          {
            "ServerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Úspešná odpoveď.",
            "headers": {
              "X-Request-Id": {
                "description": "ID požiadavky.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Charged-Units": {
                "description": "Cena úspešnej odpovede v celých units; autocomplete1, bootstrap/usage0.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Available-Units": {
                "description": "Pripravená kapacita aktuálneho grantu, nie celý nealokovaný mesačný prídel.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Period": {
                "description": "Kalendárny mesiac Europe/Bratislava.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Credits-Reset-At": {
                "description": "Koniec obdobia v UTC.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Usage"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  },
                  "required": [
                    "data",
                    "meta"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Neplatné parametre; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Neplatný alebo chýbajúci bearer; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Nepodporovaná metóda, HEAD sa odmieta; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Telo nad16KiB; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rýchlostný alebo mesačný limit; bez kreditu, Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Nedostupný index alebo zatvorené/nedôveryhodné účtovanie; bez deklarovaného úspechu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "CORS preflight bez kreditu",
        "security": [],
        "parameters": [
          {
            "name": "Origin",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Access-Control-Request-Method",
            "in": "header",
            "required": true,
            "schema": {
              "const": "GET"
            }
          },
          {
            "name": "Access-Control-Request-Headers",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Iba Authorization, Content-Type, Accept."
          }
        ],
        "responses": {
          "204": {
            "description": "Presný povolený Origin a očakávaná metóda."
          },
          "403": {
            "description": "Nepovolený scope, účet, projekt alebo Origin; bez kreditu.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/companies/{country}/{ico}": {
      "get": {
        "summary": "Základný detail subjektu",
        "operationId": "readCompany",
        "description": "Scope companies:read. Cena10integerunits=1kredit. Iba lokálna MariaDB a explicitný allowlist identity, adresy, právnej formy/stavu, dátumov a proveniencie. Bez query parametrov (aj lang), GET body, bankových účtov, osôb, raw payloadov alebo finančných/OV modulov. Unknown=null; dissolved je historická identita. Existujúce scopes sa nerozšíria automaticky.",
        "x-required-scope": "companies:read",
        "x-cost-units": 10,
        "security": [
          {
            "ServerKey": []
          },
          {
            "BrowserSession": []
          }
        ],
        "parameters": [
          {
            "name": "country",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cz"
              ]
            }
          },
          {
            "name": "ico",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{8}$"
            },
            "description": "Country-qualified IČO ako string vrátane úvodných núl."
          }
        ],
        "responses": {
          "200": {
            "description": "Základný detail z lokálnej MariaDB; presne 10 units = 1 kredit. Žiadne raw alebo bankové polia.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyDetailResponse"
                }
              }
            }
          },
          "400": {
            "description": "Neplatné country/IČO, query alebo telo; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Chýbajúci/neplatný/odvolaný bearer; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "companies:read musí povoľovať projekt aj credential; browser detail vyžaduje explicitný scope; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "company_not_found: nenájdené v doteraz lokálne importovaných dátach, nie dôkaz neexistencie; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Len GET/OPTIONS; HEAD nie je bezplatná dátová cesta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "company_identity_ambiguous: viac aktuálnych alebo nejednoznačných historických záznamov; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate alebo mesačný limit; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lokálne dáta/proveniencia/účtovanie nedostupné; rezervácia sa ruší alebo je recovery hold; 0 potvrdených units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "HTTP telo nad16KiB; 0units. Detail neprijíma telo GET.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "CORS preflight pre detail",
        "parameters": [
          {
            "name": "country",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "sk",
                "cz"
              ]
            }
          },
          {
            "name": "ico",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{8}$"
            },
            "description": "Country-qualified IČO ako string vrátane úvodných núl."
          }
        ],
        "responses": {
          "204": {
            "description": "Presný povolený HTTPS Origin; requested method GET, headers Authorization/Content-Type/Accept. 0units."
          },
          "403": {
            "description": "companies:read musí povoľovať projekt aj credential; browser detail vyžaduje explicitný scope; 0 units.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ServerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "rgk_<64hex>",
        "description": "256náhodnýchbitov; iba Authorization, nikdy URL/JavaScript.90d, odvolateľný."
      },
      "BrowserSession": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "rgb_<64hex>",
        "description": "15min opaque session v pamäti browsera, viazaná na IP+Origin."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retry_after_seconds": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          },
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          }
        },
        "required": [
          "error",
          "request_id"
        ],
        "additionalProperties": false
      },
      "Source": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "attribution": {
            "type": [
              "string",
              "null"
            ]
          },
          "license": {
            "type": [
              "string",
              "null"
            ]
          },
          "license_url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "url"
        ],
        "additionalProperties": false
      },
      "Meta": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "country": {
            "type": "string",
            "enum": [
              "sk",
              "cz"
            ]
          },
          "language": {
            "type": "string",
            "enum": [
              "sk",
              "cs",
              "en"
            ]
          },
          "charged_units": {
            "type": "integer",
            "minimum": 0
          },
          "data_as_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "coverage": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string"
              },
              "source_metadata_updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [],
            "additionalProperties": false
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "request_id",
          "charged_units"
        ],
        "additionalProperties": false
      },
      "AddressComponents": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "street": {
            "type": [
              "string",
              "null"
            ]
          },
          "street_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality_part": {
            "type": [
              "string",
              "null"
            ]
          },
          "municipality_part_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "postal_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "post_office": {
            "type": [
              "string",
              "null"
            ]
          },
          "registration_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidence_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "house_number_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "house_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "orientation_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "orientation_letter": {
            "type": [
              "string",
              "null"
            ]
          },
          "district": {
            "type": [
              "string",
              "null"
            ]
          },
          "district_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "county": {
            "type": [
              "string",
              "null"
            ]
          },
          "county_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "region_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "building_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "coordinates": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "crs": {
                    "const": "OGC:CRS84"
                  },
                  "source": {
                    "type": "object"
                  }
                },
                "required": [
                  "latitude",
                  "longitude",
                  "crs"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "Address": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "country": {
            "type": "string",
            "enum": [
              "sk",
              "cz"
            ]
          },
          "name": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/AddressComponents"
          },
          "source": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "attribution": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "id",
              "url",
              "attribution"
            ],
            "additionalProperties": false
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "country",
          "name",
          "address",
          "source",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "Company": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "country": {
            "type": "string",
            "enum": [
              "sk",
              "cz"
            ]
          },
          "ico": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "country",
          "ico",
          "name",
          "address",
          "status",
          "url",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "BrowserSession": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^rgb_[a-f0-9]{64}$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "addresses:suggest",
                "companies:suggest",
                "companies:read"
              ]
            }
          }
        },
        "required": [
          "token",
          "expires_at",
          "scopes"
        ],
        "additionalProperties": false
      },
      "Usage": {
        "type": "object",
        "properties": {
          "allowance_units": {
            "type": "integer",
            "minimum": 0
          },
          "confirmed_units": {
            "type": "integer",
            "minimum": 0
          },
          "reserved_units": {
            "type": "integer",
            "minimum": 0
          },
          "recovery_hold_units": {
            "type": "integer",
            "minimum": 0
          },
          "prepared_available_units": {
            "type": "integer",
            "minimum": 0
          },
          "pending_spent_units": {
            "type": "integer",
            "minimum": 0
          },
          "in_flight_reserved_units": {
            "type": "integer",
            "minimum": 0
          },
          "accounting_status": {
            "const": "live"
          },
          "period": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}$"
          }
        },
        "required": [
          "allowance_units",
          "confirmed_units",
          "reserved_units",
          "recovery_hold_units",
          "prepared_available_units",
          "pending_spent_units",
          "in_flight_reserved_units",
          "accounting_status",
          "period"
        ],
        "additionalProperties": false
      },
      "CompanyRegistryCode": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "codelist": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "code",
          "name",
          "codelist"
        ],
        "additionalProperties": false
      },
      "CompanyDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-f0-9]{32}$"
          },
          "country": {
            "enum": [
              "sk",
              "cz"
            ]
          },
          "ico": {
            "type": "string",
            "pattern": "^[0-9]{8}$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "dissolved",
              "source_removed",
              "removed",
              null
            ]
          },
          "legal_status": {
            "$ref": "#/components/schemas/CompanyRegistryCode"
          },
          "legal_form": {
            "$ref": "#/components/schemas/CompanyRegistryCode"
          },
          "address": {
            "type": "object",
            "properties": {
              "formatted": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "components": {
                "type": "object",
                "properties": {
                  "street": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "municipality": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "municipality_part": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "municipality_code": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "registration_number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "evidence_number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "orientation_number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "orientation_letter": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "building_number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "postal_code": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "country_code": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "address_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "formatted": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "street",
                  "municipality",
                  "municipality_part",
                  "municipality_code",
                  "registration_number",
                  "evidence_number",
                  "orientation_number",
                  "orientation_letter",
                  "building_number",
                  "postal_code",
                  "country",
                  "country_code",
                  "address_id",
                  "formatted"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "formatted",
              "components"
            ],
            "additionalProperties": false
          },
          "identifiers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "enum": [
                    "ico",
                    "source_id"
                  ]
                },
                "country": {
                  "enum": [
                    "sk",
                    "cz"
                  ]
                },
                "value": {
                  "type": "string"
                },
                "source": {
                  "enum": [
                    "rpo",
                    "ares"
                  ]
                }
              },
              "required": [
                "type",
                "country",
                "value"
              ],
              "additionalProperties": false
            },
            "minItems": 2,
            "maxItems": 2
          },
          "dates": {
            "type": "object",
            "properties": {
              "established_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "dissolved_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            },
            "required": [
              "established_at",
              "dissolved_at"
            ],
            "additionalProperties": false
          },
          "registration": {
            "type": "object",
            "properties": {
              "register": {
                "$ref": "#/components/schemas/CompanyRegistryCode"
              },
              "office": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "number": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "register",
              "office",
              "number"
            ],
            "additionalProperties": false
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "provenance": {
            "type": "object",
            "properties": {
              "source_code": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "source_key": {
                "type": "string"
              },
              "revision_id": {
                "type": "string"
              },
              "record_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "file_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "observed_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fetched_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "projection_updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "projection_version": {
                "type": "string"
              }
            },
            "required": [
              "source_code",
              "dataset",
              "source_key",
              "revision_id",
              "record_sha256",
              "file_sha256",
              "observed_at",
              "fetched_at",
              "source_updated_at",
              "projection_updated_at",
              "projection_version"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "country",
          "ico",
          "name",
          "status",
          "legal_status",
          "legal_form",
          "address",
          "identifiers",
          "dates",
          "registration",
          "url",
          "provenance"
        ],
        "additionalProperties": false
      },
      "CompanyDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CompanyDetail"
          },
          "meta": {
            "type": "object",
            "properties": {
              "request_id": {
                "type": "string"
              },
              "country": {
                "enum": [
                  "sk",
                  "cz"
                ]
              },
              "charged_units": {
                "const": 10
              },
              "data_as_of": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "coverage": {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string"
                  },
                  "source_metadata_updated_at": {
                    "type": "string"
                  }
                },
                "required": [
                  "state",
                  "source_metadata_updated_at"
                ],
                "additionalProperties": false
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "enum": [
                        "rpo",
                        "ares"
                      ]
                    },
                    "dataset": {
                      "enum": [
                        "rpo",
                        "res",
                        "vr"
                      ]
                    },
                    "url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "attribution": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "license": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "license_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "notice": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "code",
                    "dataset",
                    "url",
                    "attribution",
                    "license",
                    "license_url",
                    "notice"
                  ],
                  "additionalProperties": false
                },
                "minItems": 1,
                "maxItems": 1
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "request_id",
              "country",
              "charged_units",
              "data_as_of",
              "coverage",
              "sources",
              "warnings"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "data",
          "meta"
        ],
        "additionalProperties": false
      }
    }
  }
}
