{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/avoindata-prh-fi/json-schema/avoindata-prh-fi-company-result-schema.json",
  "title": "CompanyResult",
  "description": "Details of company or organisation",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/avoindata-prh-fi-ytj-openapi.yml#/components/schemas/CompanyResult",
  "type": "object",
  "required": [
    "totalResults",
    "companies"
  ],
  "properties": {
    "totalResults": {
      "type": "integer",
      "format": "int64",
      "description": "Total number of results"
    },
    "companies": {
      "type": "array",
      "description": "Details of company or organisation",
      "items": {
        "$ref": "#/$defs/Company"
      }
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "description": "Address details",
      "required": [
        "type",
        "source"
      ],
      "properties": {
        "type": {
          "type": "integer",
          "format": "int32",
          "description": "Type of address, street address: 1, postal address: 2. "
        },
        "street": {
          "type": [
            "string",
            "null"
          ],
          "description": "Street address",
          "minLength": 0,
          "maxLength": 50
        },
        "postCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Postal code",
          "minLength": 0,
          "maxLength": 5
        },
        "postOffices": {
          "type": "array",
          "description": "Town or city in various languages",
          "items": {
            "$ref": "#/$defs/PostOffice"
          },
          "minItems": 0
        },
        "postOfficeBox": {
          "type": [
            "string",
            "null"
          ],
          "description": "PO Box",
          "minLength": 0,
          "maxLength": 5
        },
        "buildingNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Building",
          "minLength": 0,
          "maxLength": 13
        },
        "entrance": {
          "type": [
            "string",
            "null"
          ],
          "description": "Entrance",
          "minLength": 0,
          "maxLength": 13
        },
        "apartmentNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Apartment",
          "minLength": 0,
          "maxLength": 4
        },
        "apartmentIdSuffix": {
          "type": [
            "string",
            "null"
          ],
          "description": "Divider",
          "minLength": 0,
          "maxLength": 1
        },
        "co": {
          "type": [
            "string",
            "null"
          ],
          "description": "C/o in the address",
          "minLength": 0,
          "maxLength": 34
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "Two-letter country code",
          "minLength": 0,
          "maxLength": 2
        },
        "freeAddressLine": {
          "type": [
            "string",
            "null"
          ],
          "description": "Free-format address for instance for an address outside Finland. Returns are replaced by spaces, spaces are replaced by underscores, such as in Norgårdsvägen_3 _ SE-451_75 Uddevalla.",
          "minLength": 0,
          "maxLength": 1000
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      }
    },
    "Company": {
      "type": "object",
      "description": "Details of company or organisation",
      "required": [
        "businessId",
        "registeredEntries",
        "tradeRegisterStatus",
        "lastModified"
      ],
      "properties": {
        "businessId": {
          "type": "object",
          "required": [
            "value",
            "source"
          ],
          "description": "Business ID, for example 0116297-6",
          "properties": {
            "value": {
              "type": "string",
              "description": "Business ID",
              "minLength": 9,
              "maxLength": 9
            },
            "registrationDate": {
              "type": [
                "string",
                "null"
              ],
              "format": "date",
              "description": "Y-tunnuksen antamispäivä",
              "minLength": 10,
              "maxLength": 10
            },
            "source": {
              "$ref": "#/$defs/Source"
            }
          }
        },
        "euId": {
          "type": "object",
          "required": [
            "value",
            "source"
          ],
          "description": "EUID, for example FIFPRO.0116297-6",
          "properties": {
            "value": {
              "type": "string",
              "description": "EUID",
              "minLength": 16,
              "maxLength": 16
            },
            "source": {
              "$ref": "#/$defs/Source"
            }
          }
        },
        "names": {
          "type": "array",
          "description": "Company names; company name, parallel company names and auxiliary company names",
          "items": {
            "$ref": "#/$defs/RegisterName"
          },
          "minItems": 0
        },
        "mainBusinessLine": {
          "type": "object",
          "required": [
            "type",
            "source"
          ],
          "description": "Main line of business",
          "properties": {
            "type": {
              "type": "string",
              "description": "TOL 2008 code",
              "minLength": 2,
              "maxLength": 5
            },
            "descriptions": {
              "type": "array",
              "description": "TOL 2008 descriptions",
              "items": {
                "$ref": "#/$defs/DescriptionEntry"
              },
              "minItems": 0
            },
            "typeCodeSet": {
              "type": "string",
              "description": "Code lists TOIMI, TOIMI2 and TOIMI3, TOIMI4 of the Standard Industrial Classification TOL 2008",
              "minLength": 5,
              "maxLength": 6
            },
            "registrationDate": {
              "type": [
                "string",
                "null"
              ],
              "format": "date",
              "description": "Start date of TOL 2008 code in the format yyyy-mm-dd",
              "minLength": 10,
              "maxLength": 10
            },
            "source": {
              "$ref": "#/$defs/Source"
            }
          }
        },
        "website": {
          "type": "object",
          "required": [
            "url",
            "source"
          ],
          "description": "Company's website",
          "properties": {
            "url": {
              "type": "string",
              "description": "Website",
              "minLength": 0,
              "maxLength": 255
            },
            "registrationDate": {
              "type": [
                "string",
                "null"
              ],
              "format": "date",
              "minLength": 10,
              "maxLength": 10
            },
            "source": {
              "$ref": "#/$defs/Source"
            }
          }
        },
        "companyForms": {
          "type": "array",
          "description": "Company form and previous details, if any",
          "items": {
            "$ref": "#/$defs/CompanyForm"
          },
          "minItems": 0,
          "maxItems": 2
        },
        "companySituations": {
          "type": "array",
          "description": "Company situation (restructuring, liquidation or bankruptcy, if any)",
          "items": {
            "$ref": "#/$defs/CompanySituation"
          },
          "minItems": 0
        },
        "registeredEntries": {
          "type": "array",
          "description": "Company’s register entries",
          "items": {
            "$ref": "#/$defs/RegisteredEntry"
          },
          "minItems": 0
        },
        "addresses": {
          "type": "array",
          "description": "Company’s street or postal address",
          "items": {
            "$ref": "#/$defs/Address"
          },
          "minItems": 0,
          "maxItems": 2
        },
        "tradeRegisterStatus": {
          "type": "string",
          "description": "[Company status on the Finnish Trade Register](/opendata-ytj-api/v3/description?code=REK_KDI&lang=en)\n"
        },
        "status": {
          "type": "string",
          "description": "[Business ID status](/opendata-ytj-api/v3/description?code=STATUS3&lang=en)\n"
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration of the company in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 10,
          "maxLength": 10,
          "format": "date",
          "description": "Date of dissolution in the format yyyy-mm-dd"
        },
        "lastModified": {
          "type": "string",
          "minLength": 19,
          "maxLength": 19,
          "format": "date-time",
          "x-field-extra-annotation": "@com.fasterxml.jackson.annotation.JsonFormat(shape = com.fasterxml.jackson.annotation.JsonFormat.Shape.STRING, pattern = \"yyyy-MM-ddTHH:mm:ss\")",
          "description": "Latest update, including seconds, without a time zone in the format ‘yyyy-mm-ddT00:00:00'"
        }
      }
    },
    "CompanyForm": {
      "type": "object",
      "required": [
        "type",
        "version",
        "source"
      ],
      "description": "Company form",
      "properties": {
        "type": {
          "type": "string",
          "description": "[Company form code](/opendata-ytj-api/v3/description?code=YRMU&lang=en)\n",
          "minLength": 1,
          "maxLength": 8
        },
        "descriptions": {
          "type": "array",
          "description": "Company form descriptions",
          "items": {
            "$ref": "#/$defs/DescriptionEntry"
          },
          "minItems": 0
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "End date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "version": {
          "type": "integer",
          "format": "int32",
          "description": "Version, 1 is the current version, other numbers are previous versions"
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      }
    },
    "CompanySituation": {
      "type": "object",
      "required": [
        "type",
        "source"
      ],
      "description": "Company situation (restructuring, liquidation or bankruptcy, if any)",
      "properties": {
        "type": {
          "type": "string",
          "description": "[Company situation code](/opendata-ytj-api/v3/description?code=SELTILA,SANE,KONK&lang=en)\n",
          "enum": [
            "SANE",
            "SELTILA",
            "KONK"
          ]
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "End date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      }
    },
    "DescriptionEntry": {
      "type": "object",
      "required": [
        "languageCode"
      ],
      "description": "Data description",
      "properties": {
        "languageCode": {
          "type": "string",
          "description": "Language code, 1 - Finnish, 2 - Swedish, 3 - English",
          "maxLength": 2
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Code description",
          "maxLength": 255
        }
      }
    },
    "PostOffice": {
      "type": "object",
      "required": [
        "city",
        "languageCode"
      ],
      "description": "Postal addresses",
      "properties": {
        "city": {
          "type": "string",
          "description": "Town or city",
          "maxLength": 50
        },
        "languageCode": {
          "type": "string",
          "description": "[Language code](/opendata-ytj-api/v3/description?code=KIELI&lang=en)\n",
          "maxLength": 8
        },
        "municipalityCode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Municipality code",
          "minLength": 3,
          "maxLength": 3
        }
      }
    },
    "RegisterName": {
      "type": "object",
      "description": "Name details",
      "required": [
        "name",
        "type",
        "version",
        "source"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Company name",
          "minLength": 0,
          "maxLength": 1000
        },
        "type": {
          "type": "string",
          "description": "[Type of name](/opendata-ytj-api/v3/description?code=TLAJI&lang=en)\n",
          "minLength": 1,
          "maxLength": 8
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "End date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "version": {
          "type": "integer",
          "format": "int32",
          "description": "Version, 1 is the current version, other numbers are previous versions"
        },
        "source": {
          "$ref": "#/$defs/Source"
        }
      }
    },
    "RegisteredEntry": {
      "type": "object",
      "required": [
        "type",
        "register",
        "authority"
      ],
      "description": "Register entries",
      "properties": {
        "type": {
          "type": "string",
          "description": "[Company registration status code](/opendata-ytj-api/v3/description?code=REK_KDI&lang=en). Must be interpreted in the REK_KDI code list by combining the register entry code with the register code separated by an underscore, such as in '1_0', indicating unregistered on the Finnish\n",
          "minLength": 1,
          "maxLength": 8
        },
        "descriptions": {
          "type": "array",
          "description": "Registration status descriptions",
          "items": {
            "$ref": "#/$defs/DescriptionEntry"
          },
          "minItems": 0
        },
        "registrationDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "End date of registration in the format yyyy-mm-dd",
          "minLength": 10,
          "maxLength": 10
        },
        "register": {
          "type": "string",
          "description": "[Register code](/opendata-ytj-api/v3/description?code=REK&lang=en)\n",
          "minLength": 1,
          "maxLength": 8
        },
        "authority": {
          "type": "string",
          "description": "[Authority code](/opendata-ytj-api/v3/description?code=VIRANOM&lang=en)\n",
          "minLength": 1,
          "maxLength": 8
        }
      }
    },
    "Source": {
      "type": "string",
      "description": "<a aria-label=\"Data source, opens in a new window\" rel=\"noopener\" href=\"/opendata-ytj-api/v3/description?code=TLAHDE&lang=en\">Data source <svg width=\"15\" height=\"14\" viewBox=\"0 -9 24 24\"> <path margin=\"0\" fill=\"#035ca7\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\"></path></svg></a>\n"
    }
  }
}