{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/qelka-com/json-schema/qelka-com-company-result-schema.json",
  "title": "CompanyResult",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/qelka-com-openapi.yml#/components/schemas/CompanyResult",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^lkp_[0-9A-HJKMNP-TV-Z]{10,26}$",
      "description": "Unique identifier of this lookup."
    },
    "object": {
      "type": "string",
      "const": "company"
    },
    "input": {
      "type": "string"
    },
    "query": {
      "type": "string",
      "enum": [
        "id",
        "vat",
        "name"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "found",
        "not_found",
        "invalid",
        "unsupported",
        "unavailable"
      ],
      "description": "found: a record is returned (billed). not_found: the registry has no such company. invalid: the identifier fails its format or check digit. unsupported: this kind of lookup is not possible for the country. unavailable: the registry did not answer, or is not configured. Only found is billed."
    },
    "reason": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "invalid_format",
            "invalid_checksum",
            "not_in_registry",
            "no_match",
            "not_in_gleif",
            "vat_not_registered",
            "vat_not_linked",
            "name_search_unsupported",
            "registry_unavailable",
            "registry_not_configured"
          ],
          "description": "Why no record is returned, null when one is. not_in_gleif: the fallback found no LEI record, which does not mean the company does not exist. vat_not_linked: the VAT number cannot be tied to a registry record in that country (GB, CH). name_search_unsupported: the registry has no name search and GLEIF found nothing."
        },
        {
          "type": "null"
        }
      ]
    },
    "country": {
      "description": "ISO 3166-1 alpha-2 country of the registry.",
      "type": [
        "string",
        "null"
      ]
    },
    "legal_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "trade_names": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Trade names, acronyms, auxiliary and parallel names."
    },
    "previous_names": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "identifiers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "siren, siret, orgnr, business_id, ico, krs, nip, regon, company_number, vat, lei, registered_as, rna or eu_id."
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "company_status": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "active",
            "closed"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "active, or closed (struck off, dissolved, ceased). Null when the registry does not say."
    },
    "status_detail": {
      "description": "Insolvency or winding-up state when the registry reports one: liquidation, bankruptcy, administration, reorganisation, or the status wording of Companies House.",
      "type": [
        "string",
        "null"
      ]
    },
    "incorporated_on": {
      "description": "Date of creation or incorporation, YYYY-MM-DD.",
      "type": [
        "string",
        "null"
      ]
    },
    "closed_on": {
      "type": [
        "string",
        "null"
      ]
    },
    "legal_form": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "code",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "registered_address": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "lines": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "postal_code": {
              "type": [
                "string",
                "null"
              ]
            },
            "city": {
              "type": [
                "string",
                "null"
              ]
            },
            "region": {
              "type": [
                "string",
                "null"
              ]
            },
            "country": {
              "description": "ISO 3166-1 alpha-2 code.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "lines",
            "postal_code",
            "city",
            "region",
            "country"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "activity": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "string",
              "description": "Main activity code as the registry publishes it."
            },
            "scheme": {
              "type": "string",
              "description": "Classification of the code: NAF rév. 2, UK SIC 2007, SN, TOL, CZ-NACE, PKD or NACE."
            },
            "label": {
              "description": "Label from the registry, in its language, or the English NACE Rev. 2 label when the registry gives none.",
              "type": [
                "string",
                "null"
              ]
            },
            "nace": {
              "description": "NACE Rev. 2 class (4 digits), when the national code maps to one.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "code",
            "scheme",
            "label",
            "nace"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "headcount": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "min": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "max": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ],
              "description": "Null for an open-ended band such as 10,000 and more. Equal to min when the registry publishes an exact count."
            },
            "year": {
              "description": "Year the band refers to, when the registry gives it.",
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "min",
            "max",
            "year"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "share_capital": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number"
            },
            "currency": {
              "type": "string"
            }
          },
          "required": [
            "amount",
            "currency"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "website": {
      "type": [
        "string",
        "null"
      ]
    },
    "officers": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "role": {
                "description": "Role as the registry words it, in its language.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "person",
                  "company"
                ]
              },
              "appointed_on": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "birth_date": {
                "description": "Year and month of birth (YYYY-MM) when the registry publishes it. Never the full date.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "identifier": {
                "description": "Registration number of a company officer, such as the SIREN of an auditor.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "name",
              "role",
              "kind",
              "appointed_on",
              "birth_date",
              "identifier"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Current officers and directors, up to 50. Null when the registry does not publish them, an empty list when it publishes none."
    },
    "financials": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "year": {
              "type": "string"
            },
            "revenue": {
              "type": [
                "number",
                "null"
              ]
            },
            "net_income": {
              "type": [
                "number",
                "null"
              ]
            },
            "currency": {
              "type": "string"
            }
          },
          "required": [
            "year",
            "revenue",
            "net_income",
            "currency"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Latest revenue and net income the registry publishes (France)."
    },
    "establishments": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "total": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "open": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "total",
            "open"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Number of establishments, open and in total (France)."
    },
    "lei": {
      "description": "Legal Entity Identifier, from GLEIF, when the company has one.",
      "type": [
        "string",
        "null"
      ]
    },
    "matches": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "id": {
                "type": "string",
                "description": "Identifier to send as id for the full record."
              },
              "country": {
                "type": "string"
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "company_status": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "active",
                      "closed"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "name",
              "id",
              "country",
              "city",
              "company_status"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "For a name search: up to 10 candidates, best first. Null otherwise."
    },
    "source": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "registry": {
              "type": "string",
              "enum": [
                "fr_sirene",
                "no_brreg",
                "fi_prh",
                "cz_ares",
                "pl_krs",
                "gb_companies_house",
                "gleif",
                "vies"
              ],
              "description": "Registry the record comes from. gleif and vies are the fallbacks for countries without a registry connection."
            },
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string"
            },
            "license": {
              "type": "string"
            },
            "fetched_at": {
              "type": "string",
              "description": "When the registry was read. A cached result keeps the time of the original read."
            }
          },
          "required": [
            "registry",
            "name",
            "url",
            "license",
            "fetched_at"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "credits_used": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Credits debited for this call. Cached results cost the same; failed upstream calls cost 0."
    },
    "cached": {
      "type": "boolean",
      "description": "True when the result was served from the 7-day result cache. Send `fresh: true` to bypass it."
    }
  },
  "required": [
    "id",
    "object",
    "input",
    "query",
    "status",
    "reason",
    "country",
    "legal_name",
    "trade_names",
    "previous_names",
    "identifiers",
    "company_status",
    "status_detail",
    "incorporated_on",
    "closed_on",
    "legal_form",
    "registered_address",
    "activity",
    "headcount",
    "share_capital",
    "website",
    "officers",
    "financials",
    "establishments",
    "lei",
    "matches",
    "source",
    "credits_used",
    "cached"
  ],
  "additionalProperties": false
}